I like the detail how the very same key (just mostly in combination with meta/windows key) is kinda idiomatic toggle for terminal, what most programmers "live in". I wonder if digital graphic artists happen to launch their scratchpads or paint programs in a similar manner.
Btw, for use-cases when you need to keep the "toggled" window opened and do not want to close, minimize or hide it or something and just need the fastest flip to, flip back to previous window "toggle", super useful but (for me) long time forgotten native Windows hotkey is *`Alt + Escape`* - it simply switches to previous focused window without even showing window overview (like Alt+Tab).
So AutoHotkey *v1* boilerplate for such switcher/launcher then could be something like:
Or if you do not want that window to clobber the taskbar, you can use `WinHide` instead of that Alt+Win `send, !{escape}` and add WinShow to WinActivate, but it does not work well with some kinds of windows. Also for window detection it may sometimes be more suitable to use `ahk_exe` or `ahk_class`.
I do include Minimize-if-already-active though. I like to be able to temporary flip an application into focus (e.g. Outlook) and then return to what I was previously working on.
Plus a tweak: When launching, programs may open in the background because Windows attempts to prevent applications stealing focus when you are working in another program. I overcome this by focusing the tray before launching.
It uses AHK's window groups.
I only regret having written this in AHK v1, which was a bit of a pain in the neck.
I intend rewrite them in AHK v2, which looks like a halfway step to ES6 with lambdas, closures and all. So many quirks gone! I tried it a bit and it felt more fun and productive.
As a simpler alternative (which I use for work), one can pin the 10 most used applications on the taskbar and do:
- Win+<N> to launch, toggle, or choose a window from the Nth application
- Ctrl+Win+<N> to launch, toggle or cycle through the windows from the Nth application
- Shift+Win+<N> to launch a new window
- Alt+Win+<N> to bring up the Jump List
Then you can use a simpler hotkey manager (like PowerToys' Keyboard Manager) to bind to the Ctrl+Win+<N> shortcuts.
> Plus a tweak: When launching, programs may open in the background because Windows attempts to prevent applications stealing focus when you are working in another program. I overcome this by focusing the tray before launching.
Aaah! That explains some things. That does happen to me sometimes and it's a bit annoying. I got used to pressing my hotkey again when I noticed the taskbar icon blinking green to bring up the new window, or just spamming WinActivate and hope for the best. Thanks!
Yes, Win+<number> is also a gem that almost seems to be deliberately hidden, (like Win+T, Win+B). One thing that helps is to see actual numbers in the taskbar, what, to my knowledge, is currently possible in Windows 10 (only) with third-party app: https://ramensoftware.com/7-taskbar-numberer . For startup
will show same number for grouped windows so cycling will work.
Btw most tabbed interfaces have the same bindings for focusing first, second ... last tab (Ctrl+<number> in most browsers, Ctrl+9 for the last tab, usually).
I like to apply same "tab principles" to taskbar, so last thing missing here is to be able to "Ctrl+PgUp/PgDown" through windows in Taskbar order just like in sane browsers (with Win in place of Ctrl).
I attempted to do it with AHK but failed miserably, but luckily another third-party app, (7+ Taskbar Tweaker, from the same author as Numberer) can do that through advanced settings. Config in gist: https://gist.github.com/myfonj/62b4e0d393f4a97df5e9904df5e77...
(Sadly, none of those will probably ever work outside Windows 10 (?))
Ah, sorry, my bad, it should have been "Escape" instead of ~"Windows key"~.
`Alt + Escape`, that is. Thanks for pointing it out. Corrected.
(You see, I almost never use this shortcut directly, b/c I only exploit it in those AHK scripts to do the "to previous" flip without doing any additional persistence or querying in the script, so I messed up when recalling it. In fact I thought it was `Win+Escape`, tried it, found out it was `Alt+Escape` instead, and then finally wrote `Alt+Win`. Bad braining today.)
Btw, for use-cases when you need to keep the "toggled" window opened and do not want to close, minimize or hide it or something and just need the fastest flip to, flip back to previous window "toggle", super useful but (for me) long time forgotten native Windows hotkey is *`Alt + Escape`* - it simply switches to previous focused window without even showing window overview (like Alt+Tab).
So AutoHotkey *v1* boilerplate for such switcher/launcher then could be something like:
Or if you do not want that window to clobber the taskbar, you can use `WinHide` instead of that Alt+Win `send, !{escape}` and add WinShow to WinActivate, but it does not work well with some kinds of windows. Also for window detection it may sometimes be more suitable to use `ahk_exe` or `ahk_class`.