My Ultimate Windows 10 Window Management Setup

February 11, 2023

#Windows #FancyWM #Kanata

Background

Iā€™ve always been disappointed with the default experience of managing application windows and searching (for files, open apps, anything really) in Windows 10. In general, I find that Windows isnā€™t as keyboard driven as Iā€™d like.

Below is a list of features I need from my graphical shell:

  • Manipulate application windows and navigate virtual desktops using keyboard shortcuts
  • Quickly switch between apps/windows using keyboard
  • Search open windows using keyboard in a view with window previews
  • Search files and launch applications quickly
  • Automatically tile windows in order to keep things organized and make effective use of screen space
  • Make it clear which application window is focused
  • Reduce mouse movements as much as possible by having the mouse cursor automatically move according to focus events (ex. Alt-Tab)

I rely on a mix of built-in Windows settings and shortcuts as well as external programs and scripts to make this workflow possible for me on Windows 10/11. It took me some time to figure out how to piece all these things together into a coherent workflow, so I decided to document my steps in this post. Hopefully, you find the contents of this post useful. If not, at least I have this setup documented for myself.

Built-in Settings/Shortcuts

These are a list of built-in Windows settings and keyboard shortcuts related to window management that I use on a daily basis.

Basic window manipulation

Win+Up (may have to repeat again): Maximize window. Win+Down (may have to repeat again): Minimize window. Alt+F4: Close window.

Although there are built-in shortcuts for snapping windows to the left/right half of screen or quarters of a screen, I donā€™t use them since I rely on FancyWM to perform these actions.

Switch between virtual desktops

Ctrl+Win+Left : Switch to the previous virtual desktop. Ctrl+Win+Right: Switch to the next virtual desktop.

Win+Tab: Open the virtual desktop switcher. I mainly use this to see which virtual desktops are empty and move to them. You can move to other desktops by clicking on them. Hit the shortcut again or hit Esc to exit out of this view.

Virtual destkop switcher

Move window to next/previous monitor

Shift+Win+Left: Send window to the previous monitor. Shift+Win+Right: Send window to the next monitor.

Navigating elements within popups

Tab: Cycle to next element (ex. a button). Shift+Tab: Cycle to the previous element (ex. a button).

Works not just in popups but in UAC prompts, notification tray, and many other UI elements.

Open notification view

Windows 10: Win+A: Open the notification tray. Windows 11: Win+N: Open the notification tray.

We can use the Tab/Shift+Tab shortcuts from the above section to navigate the notification view. Hit Shift+Tab a few times after opening the view to get to the clear all notifications button. Then hit Enter to clear all notifications.

I find this trick is really useful when Iā€™m using my 43" 4K monitor for work, since itā€™s a pain to move the mouse to the other side of the screen just to clear notifications.

Close notification view

Active window border highlight using accent color

Open Settings > Personalization > Colors. Pick a specific accent color or pick accent color automatically based on wallpaper. We need to have an accent color set since that will be the color the active window border is highlighted with.

Color settings

Hereā€™s what application windows look by default, without active window border highlight.

Windows Termianl focused with active window border highlight off

Windows terminal is the active window here. But itā€™s really hard to tell that.

Now, hereā€™s what it looks like when active window border highlight is on. Itā€™s much more obvious that Windows Terminal is the focused window since the border is highlighted in red.

Windows Terminal focused with active window border highlight on

The built-in active window highlight does have some limitations though. Mainly, it doesnā€™t seem to work on apps built with Electron.

Switch between apps on task bar using keyboard

On each machine, I pin my 10 most used applications at the beginning of the taskbar. That way I can leverage the default shortcuts to switch to any of the first 10 pinned apps on the taskbar.

Win+1: Switch to first pinned app on the taskbar Win+2: Switch to second pinned app on the taskbar ā€¦ Win+9: Switch to the ninth pinned app on the taskbar Win+0: Switch to the tenth pinned app on the taskbar

Hereā€™s an illustration from my taskbar.

Taskbar App Numbering

Now, these keyboard shortcuts have some interesting behaviour:

  1. When a pinned app has no windows open, hitting the shortcut will launch the app in the current virtual desktop. In my example, if I hit Win+0, it would open Bitwarden in the current virtual desktop.
  2. When a pinned app has a single window open and the window is not focused, hitting the shortcut will switch to the virtual desktop the window is on and will focus the window. If the window was minimized, it will be restored.
  3. When a pinned app has a single window open and the window is focused, hitting the shortcut will minimize it.
  4. When a pinned app has multiple windows open, hitting the shortcut will cycle through the windows of the application. Releasing the shortcut will switch to the selected window of the app.
    • Note: You can only cycle between windows of the application, you canā€™t minimize/maximize any of the windows using the shortcut like you could when the app only had one window.

Other keyboard shortcuts

I only listed my most used keyboard shortcuts in this article but you can find full list of them here.

Multitasking settings

Open Settings > System > Multitasking. I like to use the following settings. I especially rely on Alt+Tab showing windows from all virtual desktops. I personally donā€™t find switching between Edge tabs in my OS to be a useful feature since I can do that from within Edge just fine.

Windows Multi-tasking Settings

Improve Windows Search

Open Settings > Search > Searching Windows. Make sure Enhanced search is on, so Windows can find more files than by default.

Windows File Search Settings

Third-Party Programs

For me, the built-in settings and behaviours of Windows arenā€™t enough. To create the workflow for managing windows and searching files that I want, this is my list of essential programs as well as relevant configuration for them.

Everything

Even with Enhanced Windows Search enabled, I sometimes canā€™t find what Iā€™m looking for. So I use Everything in those cases.

PowerToys

PowerToys is a collection of useful utilities that make Windows so much more useful. Here I will focus on the utilities and the settings for those utilities that are related to window management and searching.

In terms of general settings, I always run PowerToys as Admin, so I can use the utilities on admin windows.

Run PowerToys as Admin

PowerToys Run

PowerToys Run is an application launcher for Windows. You can use it to search applications, open windows, files, do currency conversions, and much more. I like to think of it as a superpowered Windows search. Iā€™ve been a user of application launchers across multiple platforms (Launchy, KRunner) for years now. I canā€™t live without them anymore!

Hereā€™s some basic settings I enable for PowerToys Run:

PowerToys Run Settings

For built-in plugins, I disable Web Search and OneNote. I enable everything else. The Visual Studio Code Workspaces plugin is particularly handy for me.

I install an unofficial Everything Plugin for PowerToys run. The link will take you to the releases page which has the installation instructions. The only thing to note is that you need to extract the zip file using 7z instead the built-in archiver. Alternately, can install the plugin from chocolatey.

After installing the plugin, restart PowerToys. Then enable the plugin and set a global activation key.

PowerToys Run EveryThing Plugin Settings

This is how I typically run searches using Everything. I rarely use the actual Everything application.

FancyZones

FancyZones is a utility that extends the built-in window snapping/tiling features of Windows. You can specify custom zones that you can manually snap windows to using the mouse. By default, Windows can only snap windows to half or a quarter of the screen. But with FancyZones, you can create your own custom zones which you pre-define and then you snap to these zones.

I actually find the core functionality of FancyZones to be useless. Itā€™s too much work for me to manually snap windows using my mouse compared to using a tiling WM extension like FancyWM. But there is one useful thing that FancyZones does for me.

When using multiple monitors, by default Windows will open applications on the primary monitor, not the current active monitor. This drives me nuts since I always want apps to open on the monitor that has focus because thatā€™s where I usually need the application to be and thatā€™s also typically where my mouse cursor is. Without FancyZones and this specific setting enabled, I would always have to drag the window to the monitor that previously had focus if it wasnā€™t the primary monitor which was a pain!

FancyZones Window Settings

I also like to make sure these settings for FancyZones are enabled to prevent dragging windows using mouse from activating FancyZones.

FancyZones Zone Settings

Alt-Tab Terminator

Alt-Tab Terminator is a program that replaces the default Windows Alt+Tab view (which shows windows with small previews in a grid) with a list view that is searchable and has much larger window previews.

Hereā€™s a screenshot of the program running:

Alt-Tab Terminator

For me the app has a few killer features:

  • Search and preview open applications (this is super useful when you have a lot of apps open)
  • Ability to set a keyboard shortcut to cycle through windows of same application
    • By default Windows canā€™t do this
    • On OSX/Linux typically this behaviour is bound to Alt + ` by default

These are my preferred settings for this program:

Alt-Tab Terminator Settings: General

Alt-Tab Terminator Settings: Appearance

Alt-Tab Terminator Settings: HotKeys

As you can see, I donā€™t actually use Alt+Tab Terminator to replace Alt+Tab. In general, I only use Alt+Tab to switch between the current window and previously focused window. The default Alt+Tab is fine for that. Beyond that, I typically switch between my most common applications using Win + Number shortcuts. I use Alt+Tab Terminator only to switch to applications that I canā€™t switch to using Win + Number . I launch Alt-Tab Terminator by using a custom keyboard shortcut CapsLock + Tab. This keyboard shortcut invokes Alt-Tab Terminator by invoking itā€™s exe directly (see kanata section for more details). I donā€™t use Alt+Tab Terminator to replace Win + Tab since the virtual desktop preview is pretty useful for me.

FancyWM

FancyWM is a tiling window manager extension for the Windows Desktop. It doesnā€™t replace the built-in Window Manager, it simply hooks into it and provides tiling capabilities over it. Itā€™s similar in concept to Pop Shell, Bismuth, or yabai.

I personally find a tiling window manager to be really useful. It helps me keeps my application windows organized and lets me navigate open windows easily with the keyboard. When using a laptop, I donā€™t have to use the trackpad as much to get around. When using a large 4K monitor, it lets me create layouts on the fly to effectively use all that space without getting eye strain or having to use the mouse too much.

There are a lot of other projects out there trying to bring tiling window manager capabilities to the Windows Desktop. But I found those projects were either unstable, hard to configure, hard to use, or didnā€™t integrate well with Windows.

These are the things I really like about FancyWM:

  • Easy to install (just grab it from the MS Store)
  • Easy to use
    • Almost no configuration required
    • Donā€™t need to remember complicated keyboard shortcuts to start using it
      • FancyWM uses an activation key sequence (default Shift+Win ) from which you then type in another keyboard shortcut to perform some action. If you havenā€™t typed another shortcut after hitting the activation sequence, a menu with all available shortcuts will popup making it so you donā€™t really need to memorize anything to start using FancyWM.
  • It only tiles restored windows
    • FancyWM doesnā€™t tile maximized windows so you can use the entire screen when the situation calls for it
    • When the window is restored (ie. unmaximized), FancyWM will then automatically tile it
  • Can manipulate tiled windows with both mouse and keyboard shortcuts
    • Can resize and move Windows around using mouse and they will still be automatically tiled.
    • Can even move around entire panels using mouse (I think this is the only way, I havenā€™t found keyboard shortcut for it).
  • Integrates with native Windows Virtual Desktops
    • Other tiling WM projects for Windows try to create their own ā€œworkspaceā€ functionality outside of native virtual desktops and that has never worked well for me. The built-in virtual desktop implementation in Windows is fine, I just need more keyboard shortcuts to work with them than what comes baked into Windows (which FancyWM does deliver).

Hereā€™s a short demo of FancyWM. These are the features of FancyWM Iā€™m showing (all using keyboard shortcuts):

  • Split panel horizontally or vertically
  • Stack windows in same panel
  • Focus windows in a direction
  • Move and swap windows in a direction
  • Resize windows
  • Temporarily float windows

Now hereā€™s another demo of FancyWM focusing on handling of virtual desktops. Iā€™m demoing the following features (all using keyboard shortcuts):

  • Focus specific virtual desktop by number (Shift+Win followed by Number after short delay)
    • This shortcuts seems to even work in the Virtual Desktop Switcher
  • Move window to specific virtual desktop by number (Shift+Win followed by Shift+Number after short delay)
  • Focus previous virtual desktop (Shift+Win followed by Q after short delay)
    • This shortcuts seems to even work in the Virtual Desktop Switcher
  • Move window to previous virtual desktop (Shift+Win followed by Shift+Q after short delay)

FancyWM has a lot of other cool features that I havenā€™t gone into (ex. moving window to specific monitor number, etc.) and new features are added regularly.

While the activation sequence makes FancyWM very user friendly, it also introduces a lot of extra keystrokes everytime you need to do something. Luckily, FancyWM has the capability to call itā€™s executable directly to perform these actions. To focus to the window on the left you can use this command in a shell: cmd fancywm.exe --action MoveFocusLeft. Then, you can use a keyboard remapping software like AutoHotKey or kanata to bind these commands to custom keyboard shortcuts.

Kanata

kanata is an advanced keyboard remapping software that allows you to segment your keyboard into several ā€œlayersā€ of functionality and to perform different actions depending on how you press a key (tapping a key versus holding a key can perform two different actions). You can set up your keyboard so that holding a specific key will activate a new layer on your keyboard where keys will behave differently than on your default layer.

Hereā€™s an example. When youā€™re typing normally the default layer is active. In this case, when you type n, it will output ā€˜nā€™ as normal. Say you hold Tab and while itā€™s held you enter another layer. In this layer, when you hit n instead of outputting ā€˜nā€™ you output Ctrl+Win+Left which is the keyboard shortcut for moving to the virtual desktop on the left.

My main use of kanata is to create a navigation layer that is activated while I hold the Tab key. When I press any other key while holding tab, it will execute a navigation command (usually a call to fancywm.exe). This way, I can directionally focus and move windows without using the FancyWM activation sequence which saves me a lot of keystrokes.

Why use kanata for this purpose over AutoHotKey (or some other software)?

  1. Setting up layers on the keyboard and doing different actions based on tapping vs holding a key is much easier in kanata than AutoHotKey.
    1. My kanata config for remapping keys is significantly shorter and more powerful than the AutoHotKey script I previously used for the same purpose.
  2. kanata supports remapping your keyboard at a much lower level than AutoHotKey and similar software. kanata has an alternate implementation in windows (kanata_wintercept.exe) that uses the interception kernel driver to remap keys. This allows you to remap keys from admin programs without running kanata as admin and to use it in places where AutoHotKey or the regular kanata implementation (kanata.exe) wouldnā€™t work such as the login screen.

To install kanata, download kanata_cmd_allowed.exe and kanata_wintercept_cmd_allowed.exe from the releases page and download it somewhere on your computer. I stick with the latest stable release.

Hereā€™s my full kanata config.

In addition to the navigation layer behaviour described above, there are some other interesting things we can do with this kanata configuration. When typing normally (in the default layer) if you tap CapsLock it will send Esc. If you hold CapsLock and/or hit another key, you will enter the modal layer. The modal layer will be active as long as CapsLock is held. In the modal layer, CapsLock+Tab will open Alt-Tab Terminator. CapsLock+h will send left arrow. CapsLock+df will send Ctrl+Shift. Hold CapsLock+df with one hand and then hold h and this essentially sends Ctrl+Shift+Left(hold) which is the standard shortcut for selecting text to the left. These remaps in the modal layer essentially allow me to navigate text using vim-like bindings in any application!

Holding the backtick key will activate the numbers layer and the layer will be active while the backtick key is held. When in the numbers layer, typing certain keys will send numbers instead of the keys (ex. k sends 2). This effectively allows you to get numpad-like functionality on keyboards without it (ex. laptop keyboard).

To use this kanata configuration, save the above config file in the same location that you store that kanata executables. Then you can run kanata with this custom config:

.\kanata_cmd_allowed.exe --cfg kanata.kbd

Or if you want to use the interception driver instead of the default keyboard hook mechanism:

.\kanata_wintercept_cmd_allowed.exe --cfg kanata.kbd

To automatically start kanata at startup, you can use the Windows Task Scheduler.

AutoHotKey

AutoHotKey is a scripting language to automate things in Windows.

When installing AutoHotKey, make sure the circled option is checked since it will allow AutoHotKey scripts to handle programs running as Admin.

AutoHotkey Installation

Mouse Follows Focus

This is an AutoHotKey script that automatically centers the mouse on a newly focused window that was focused due to a keyboard shortcut (ex. Alt-Tab, Win+Number). Focus events that were caused by mouse movements will not change mouse position.

Below is a demonstration of the default Windows behaviour when switching between application windows using keyboard shortcuts (in this case, Win+Number). You can see that the focused window changes but the mouse cursor still stays at the same position.

Below is a demonstration of ā€˜Mouse Follows Focusā€™. Now when I switch windows using keyboard shortcuts, the mouse cursor is automatically moved to the center of the newly focused window. This is especially useful when working with multi-monitor setups, since you can avoid having to physically drag your mouse to move the cursor to another monitor when the focused window changes via keyboard. But I also like this when working on a laptop on the couch since I donā€™t have to use the trackpad so much.

Handling admin windows with AutoHotKey

AutoHotKey scripts wonā€™t work on Admin windows by default. Need to follow this guide to be able to make an AutoHotKey script handle Admin windows without running it as admin.

Running AutoHotKey script on startup

I also use the Windows Task Scheduler to run mouse_follows_focus.ahk on startup. Alternately, you could make a shortcut to your script and then place it in shell:startup.

Problems

When mouse cursor follows focus, sometimes mouse cursor is focused on the taskbar instead of an application window

When window focus events are invoked, it seems that Windows will switch focus to the taskbar and then focus on the actual window. The script adds a short delay to compensate for this but sometimes itā€™s not enough, so you end up in a situation where the mouse cursor is still on the taskbar and hasnā€™t moved to the application window (as shown below).

Usually hitting Alt+Tab once or twice would help to recenter the mouse.

Conclusion

Although it took a bit of time to set this all up, Iā€™m really happy with the result. I find Iā€™m now much more productive in Windows.