One of my biggest producitity drains is seamlessly switching to different applications. Windows doesn’t have good native ways to do this. Especially when I have 10 or 20 different things open. A picture is worth 1000 words, so take a look at my work environment:
You might be wandering why I have so many icons on my taskbar. I generally dedicate different icons for different sets of tasks. Then I group those set of icons together, seperated by blank spaces.
Here is a typical workday for me to illustrate my point:
First thing in the morning I’ll do my daily standup, and write things I finished the day before. Then I’ll delve into ecommerce development. So I need to have my atom IDE, reference docs, and development browser open.
An hour in I’ll get interrupted and need to handle some client work. This might be a half hour consultation over the phone / in person. Or an quotation/invoice I need to email out. In any case, I need to have a different set of tabs and windows open.
I’ll try and go back to my development environment. Only to struggle to find a folder, the project I was working on, the reference manual, etc. Or forget what I was doing.
Swapping gears like this eats into a lot of lost time. I spend a good part of my time dealing with with my windows taskbar wasteland I’ve made. This in turn makes it harder to concentrate… so I take longer than I need to on a given task.
A solution is to access common apps / docs with hotkeys. I tend to reference these type of docs often:
- Development docs
- Code snippets & notes
- Ecommerce project
Windows has a native shortcut key for the first 9 items on the taskbar. In this example below, Firefox is on position 1, Atom is on position 2, etc.
If I press WIN+1, it minimizes or maximizes firefox
However, on atom I have 3 windows open. If I want to find my project called “codesnippets”. I have to press WIN+2 key two times to get there. The problem is I don’t know how many times I need to press this hotkey. It depends how many windows for that app is open. It could be 2,3, or 4 times generally. This makes the native shortcut key unreliable.
Here is a detailed breakdown of what each window I have under my Atom application:
My goal is to have one hotkey binded to “code snippets” window in Atom.
The general solution looks like so:
- Press a key
- Maximize the “code snippet & notes” window in my Atom application
- Press same key again
- Minimize above
- Repeat cycle
This sounds simple and easy to do on paper. But I’ve spent months thinking about a solution that scales well and is easy to maintain. I’ve written a similar autohotkey script here for toggling applications to the top. And searched many videos, posted on forums, etc. I’ve dug through every alternative I could come up with. No good solutions were found
This is my solution:
This gif showcases the following:
- Shows I have 3 windows open in my Atom application
- Press F2 to maximize the “code snippets” folder
- Press F2 to minimize above.
How exactly does it work?
Two applications, autokey (a scripting language) and phrase-express (easy macro writer). I have written a previous post explaining 14 different use cases with phrase express. Here is what happens with the above macro
- Press F2
- F2 triggers F13
- F13 maximize a specific application’s window titled “code snippets” via phrase express
- Press F2
- F2 triggers F14
- F14 minimizes the same window
The autohotkey code is here. Checkout this video to learn how to compile it.
F2flag := !F2flag
Phrase express settings
You might be wandering why I use both a autohotkey and phrase-express. Phrase-express is a great way to quickly write and manage 90% of your everyday macros. Without getting bogged down by syntax. Most macros that I write takes me less than 30 seconds to make in phrase-express.
However, it has some limited functionality. You can’t do things like custom GUI’s, or conditional expressions.
This is where autohotkey is used instead. You let phrase express do the customization and hard lifting. Autohotkey handles everything else