This comprehensive guide covers everything you need to know about using Komorebi, a tiling window manager for Windows, with AutoHotKey for keyboard shortcuts.
Installation
-
Install Komorebi:
winget install LGUG2Z.komorebior with Scoop:
scoop bucket add extras scoop install komorebi -
Ensure AutoHotKey is installed (v2 is recommended)
-
Download Komorebi example configurations:
komorebic quickstart -
Start Komorebi with AutoHotKey:
komorebic stop --whkd # If already running with whkd komorebic start --ahk
Core Concepts
- Monitors: Your physical displays
- Workspaces: Virtual spaces on each monitor (default: 9 per monitor, numbered 0-8)
- Containers: Hold and arrange windows in different layouts
- Stacks: Multiple windows occupying the same container, toggled through with shortcuts
Complete AutoHotKey Configuration
Create a komorebi.ahk file in your user profile directory with the following content:
#Requires AutoHotkey v2.0.2
#SingleInstance Force
Komorebic(cmd) {
RunWait(format("komorebic.exe {}", cmd), , "Hide")
}
; ===== BASIC CONTROLS =====
!q::Komorebic("close") ; Alt+Q: Close focused window
!m::Komorebic("minimize") ; Alt+M: Minimize focused window
!+o::Komorebic("reload-configuration") ; Alt+Shift+O: Reload Komorebi configuration
^!r::Reload ; Ctrl+Alt+R: Reload AHK script
; ===== WINDOW FOCUS =====
!h::Komorebic("focus left") ; Alt+H: Focus window to the left
!j::Komorebic("focus down") ; Alt+J: Focus window below
!k::Komorebic("focus up") ; Alt+K: Focus window above
!l::Komorebic("focus right") ; Alt+L: Focus window to the right
!+[::Komorebic("cycle-focus previous") ; Alt+Shift+[: Focus previous window
!+]::Komorebic("cycle-focus next") ; Alt+Shift+]: Focus next window
; ===== WINDOW MOVEMENT =====
!+h::Komorebic("move left") ; Alt+Shift+H: Move window left
!+j::Komorebic("move down") ; Alt+Shift+J: Move window down
!+k::Komorebic("move up") ; Alt+Shift+K: Move window up
!+l::Komorebic("move right") ; Alt+Shift+L: Move window right
; ===== WINDOW STACKING =====
!Left::Komorebic("stack left") ; Alt+Left: Stack window to the left
!Down::Komorebic("stack down") ; Alt+Down: Stack window below
!Up::Komorebic("stack up") ; Alt+Up: Stack window above
!Right::Komorebic("stack right") ; Alt+Right: Stack window to the right
!`;::Komorebic("unstack") ; Alt+;: Unstack window (remove from stack)
![::Komorebic("cycle-stack previous") ; Alt+[: Switch to previous window in stack
!]::Komorebic("cycle-stack next") ; Alt+]: Switch to next window in stack
; ===== WINDOW RESIZING =====
!+Left::Komorebic("resize-window left") ; Alt+Shift+Left: Resize window left
!+Down::Komorebic("resize-window down") ; Alt+Shift+Down: Resize window down
!+Up::Komorebic("resize-window up") ; Alt+Shift+Up: Resize window up
!+Right::Komorebic("resize-window right") ; Alt+Shift+Right: Resize window right
; ===== WORKSPACE MANAGEMENT =====
!1::Komorebic("focus-workspace 0") ; Alt+1: Switch to workspace 1
!2::Komorebic("focus-workspace 1") ; Alt+2: Switch to workspace 2
!3::Komorebic("focus-workspace 2") ; Alt+3: Switch to workspace 3
!4::Komorebic("focus-workspace 3") ; Alt+4: Switch to workspace 4
!5::Komorebic("focus-workspace 4") ; Alt+5: Switch to workspace 5
!6::Komorebic("focus-workspace 5") ; Alt+6: Switch to workspace 6
!7::Komorebic("focus-workspace 6") ; Alt+7: Switch to workspace 7
!8::Komorebic("focus-workspace 7") ; Alt+8: Switch to workspace 8
!9::Komorebic("focus-workspace 8") ; Alt+9: Switch to workspace 9
; ===== MOVING WINDOWS BETWEEN WORKSPACES =====
!+1::Komorebic("move-to-workspace 0") ; Alt+Shift+1: Move window to workspace 1
!+2::Komorebic("move-to-workspace 1") ; Alt+Shift+2: Move window to workspace 2
!+3::Komorebic("move-to-workspace 2") ; Alt+Shift+3: Move window to workspace 3
!+4::Komorebic("move-to-workspace 3") ; Alt+Shift+4: Move window to workspace 4
!+5::Komorebic("move-to-workspace 4") ; Alt+Shift+5: Move window to workspace 5
!+6::Komorebic("move-to-workspace 5") ; Alt+Shift+6: Move window to workspace 6
!+7::Komorebic("move-to-workspace 6") ; Alt+Shift+7: Move window to workspace 7
!+8::Komorebic("move-to-workspace 7") ; Alt+Shift+8: Move window to workspace 8
!+9::Komorebic("move-to-workspace 8") ; Alt+Shift+9: Move window to workspace 9
; ===== WORKSPACE CYCLING =====
!Tab::Komorebic("cycle-workspace next") ; Alt+Tab: Switch to next workspace
!+Tab::Komorebic("cycle-workspace previous") ; Alt+Shift+Tab: Switch to previous workspace
; ===== LAYOUT MANAGEMENT =====
!x::Komorebic("flip-layout horizontal") ; Alt+X: Flip layout horizontally
!y::Komorebic("flip-layout vertical") ; Alt+Y: Flip layout vertically
!c::Komorebic("promote") ; Alt+C: Promote window (make it primary)
!+Backspace::Komorebic("retile") ; Alt+Shift+Backspace: Force retile all windows
!Backspace::Komorebic("toggle-float") ; Alt+Backspace: Toggle float for focused window
!t::Komorebic("toggle-float-all") ; Alt+T: Toggle float for all windows on workspace
!w::Komorebic("toggle-monocle") ; Alt+W: Toggle monocle mode (maximize current window)
!+r::Komorebic("toggle-tiling-direction") ; Alt+Shift+R: Toggle between horizontal/vertical tiling
; ===== MONITOR MANAGEMENT =====
!,::Komorebic("cycle-monitor previous") ; Alt+,: Focus previous monitor
!.::Komorebic("cycle-monitor next") ; Alt+.: Focus next monitor
!+,::Komorebic("move-container-to-monitor previous") ; Alt+Shift+,: Move window to previous monitor
!+.::Komorebic("move-container-to-monitor next") ; Alt+Shift+.: Move window to next monitor
; ===== APPLICATION SHORTCUTS =====
; Uncomment and customize as needed
; !f::
; {
; if !WinExist("ahk_exe firefox.exe")
; Run "firefox.exe"
; else
; WinActivate "ahk_exe firefox.exe"
; }
;
; !b::
; {
; if !WinExist("ahk_exe chrome.exe")
; Run "chrome.exe"
; else
; WinActivate "ahk_exe chrome.exe"
; }Detailed Feature Guide
Working with Window Stacks
Stacking allows multiple windows to share the same container in the tiling layout.
-
Create a stack:
- Focus a window and press
Alt+Left/Right/Up/Downto stack it on an adjacent window - The focused window will be stacked on top of the target window
- Focus a window and press
-
Navigate within a stack:
Alt+[: Cycle to previous window in stackAlt+]: Cycle to next window in stack
-
Remove from stack:
Alt+;: Remove the current window from the stack- The window will be placed according to the current layout
Window Layouts
Komorebi offers multiple layouts that automatically arrange windows:
-
BSP (Binary Space Partition) - Default
- Divides space recursively, alternating between horizontal and vertical splits
Alt+Shift+Rtoggles between horizontal/vertical tiling
-
Columns
- Arranges windows in columns
- Primary window on left, secondary windows stacked vertically on right
-
Rows
- Arranges windows in rows
- Primary window on top, secondary windows stacked horizontally below
-
Modifying Layouts:
Alt+C: Promote focused window to primary positionAlt+X: Flip layout horizontallyAlt+Y: Flip layout vertically
Special Modes
-
Monocle Mode:
Alt+W: Toggle monocle mode (maximizes current window)- Useful for focusing on one task without closing other windows
-
Floating Mode:
Alt+Backspace: Toggle float for current windowAlt+T: Toggle float for all windows- Useful for windows that don’t work well with tiling
Customization Tips
Changing Modifier Keys
If you prefer using Windows key instead of Alt:
- Replace
!with#in the AHK script - For example, change
!h::to#h::
Custom Commands
Create custom sequences for specific workflows:
!0:: { ; Alt+0: Arrange for coding
Komorebic("focus-workspace 0")
Komorebic("change-layout rows")
Komorebic("resize-window down 200")
}Application-Specific Rules
Set up rules for specific applications in your applications.yaml file:
- identifier: ahk_exe explorer.exe
float: trueWindow Borders
Enable colorful window borders in komorebi.json:
{
"border": true,
"border_width": 10,
"border_color": {
"r": 50,
"g": 50,
"b": 50
},
"border_color_active": {
"r": 0,
"g": 120,
"b": 215
}
}Troubleshooting
Shortcuts Not Working
-
Check if AHK is running:
- Look for the AHK icon in system tray
- Run
Get-Process AutoHotkeyin PowerShell
-
Restart Komorebi and AHK:
komorebic stop --ahk komorebic start --ahk -
Verify AHK path:
- Set
KOMOREBI_AHK_EXEenvironment variable if needed:
$Env:KOMOREBI_AHK_EXE = "AutoHotkeyU64.exe" - Set
Window Management Issues
- Run
komorebic retileto force reconsideration of all windows - Use
komorebic checkto verify your configuration is found - Check logs at
%LOCALAPPDATA%\komorebi\komorebi.log
Advanced Features
Multi-Monitor Setup
-
Focus monitors:
Alt+,: Focus previous monitorAlt+.: Focus next monitor
-
Move windows between monitors:
Alt+Shift+,: Move to previous monitorAlt+Shift+.: Move to next monitor
Status Bar Integration
Enable the status bar in your setup:
komorebic start --ahk --barCustomize bar in komorebi.bar.json to show:
- Workspace indicators
- Active window title
- System resources
- Date and time
Resources
- Documentation: https://lgug2z.github.io/komorebi/
- GitHub Repository: https://github.com/LGUG2Z/komorebi
- Discord: Available for komorebi-related discussion (link on GitHub)
This guide covers everything you need to become proficient with Komorebi and AutoHotKey, enabling a powerful tiling window management experience on Windows!