Distraction-Free Development in Android Studio

Raxit Majithiya
4 min readDec 15, 2018

--

A productivity tip for JetBrains IDEs.

If you are like me who prefers to stay focused to code and everything other than code feels bothering, you’re probably going to find something helpful here. This particular tip is something I get asked a lot when someone looks at my IDE and realizes that it’s Android Studio, not Visual Studio Code.

JetBrains IDEs are highly customizable yet sometimes too cluttered with tools and panels. One nice thing is that there is a “Distraction Free Mode”. It helps you keep focused on the current file and mainly useful during presentations. However, once we actually start working in the Distraction Free mode with multiple tabs and panels, it starts getting a bit confusing and inconvenient to manage.

Wouldn’t it be great if we could tweak this beautiful Android Studio IDE to make it look something like this?

Distraction-Free Android Studio, ready to create something amazing.

No more toolbar, sidebar, status bar, or even the menu bar. Just plain old distraction-free environment to stay focused and productive while still being able to switch tabs and bring up panels as needed (💡 ⌘+Number toggles panels. Ex: ⌘+1 to toggle the project panel).

For the perspective, here’s the what it looks like by default by the way:

Default view with “everything on it”.

The solution is simple: we want to create a macro and assign a shortcut to it. Here is how:

1. Create a Macro

To get above screenshot, I have created this Macro:

Macro: Distraction Free

Here are the actions in this Macro:

  1. View > Toggle “Toolbar”
  2. View > Toggle “Tool Buttons”
  3. View > Toggle “Status Bar”
  4. View > Toggle “Navigation Bar”
  5. View > Active Editor > Toggle “Show Gutter Icons”

In case this is your first time creating a Macro, here is how to create one:

  1. From Edit Menu > Macros > Select “Start Macro Recording”.
  2. Perform all the actions that we would like this macro to do. Since this particular macro only involves toggling a bunch of options under the View menu, we will just be opening View and hitting the option we want to toggle.
  3. Once we are done with all 5 Actions, stop recording the Macro from Edit > Macros > Stop Macro Recording.
  4. That’s it. Name this macro and we are done.

We can now run this macro to toggle our version of the Distraction-Free mode.

2. Assign a Keyboard Shortcut:

It would be pretty inconvenient if we had to run this macro from Edit menu every time we want to toggle, right? There’s an easy way to solve this: Assign a shortcut to a menu item.

Android Studio Preferences > Search “Distraction Free” (the name of our macro)

Here is how:

  • As shown in the screenshot, open preferences > search for the name of our macro.
  • Now we can add a shortcut to our Menu item “Macro > Distraction Free” by double-clicking on that menu and assigning a shortcut.

As you can see, I assigned ⌘+ Shift+0 to my macro.

That’s it. Our distraction Free mode is now ready. Keep hitting ⌘+Shift+0 and have fun!

Extra Goodies:

  1. Code + Panels (who can live without panels?)

Using Logcat and other panels such as file browser, Debug window, etc are much more convenient in this mode.

Left: Default mode with Logcat. Right: Distraction-Free mode with Logcat

While this may not feel like much of a problem when working on wide screens, it doesn’t take long enough to get annoyed with the cluttered UI when debugging or viewing logs and code together.

2. Toggle the Gutter area

You may have realized that we are also toggling Gutter in our Distraction-Free macro. However, sometimes we do need the Gutter around to see some Gutter Icons such as overridden methods, breakpoints, etc.

To make toggling of the Gutter area easy, we can add a new custom shortcut:

Toggle Gutter with ⌘+ Shift+9

Now we can hit ⌘+ Shift+0 to enter Distraction-Free mode and ⌘+ Shift+9 to toggle the gutter area when needed.

I love sharing my productivity tips and also learning about yours. If you have some ideas based on this post, want to share more tips, need any help or just want to say 👋, hit me up on twitter.

--

--