Cannot Lah

by shanscendent

Komorebi Tiling Window Manager

November 28, 2024, updated December 17, 2024

Windows’ virtual desktop feature is a hot mess. After struggling to configure AutoHotkey and DLLs to try and make virtual desktops work properly with shortcuts, I gave up and tried Komorebi instead, after disliking GlazeWM in the past. I have to say, it’s been a pleasant experience!

Komorebi comes with a hotkey daemon to trigger commands, a tiling wm, and a status bar

Here’s how to get started, plus my example configuration

Prerequisites

Note that komorebi actually comes with whkd (a simple hotkey daemon), but we’ll be using AutoHotkey v2.0 in this tutorial instead for hotkeys (wkhd doesn’t support the Win key as a modifier). If you want existing compatibility with AHK v1.1 scripts, install v1.1 before you install v2.0, they’ll coexist together

I’d recommend setting your taskbar to auto-hide since there’s already a status bar

Komorebi

Installation

First, enable long path support in a PowerShell window with admin rights

Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1

Then close that window

Disable unnecessary system animations in Settings > Accessibility > Visual effects > Animation effects

Open a new PowerShell window, then install komorebi using winget

winget install LGUG2Z.komorebi

Restart your terminal for the command to take effect

Download the example configuration files to your USERPROFILE, create a PowerShell profile script

komorebic quickstart
if (!(Test-Path -Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force
}

To figure out where the profile script is, run $PROFILE in PowerShell. Then, add

$Env:KOMOREBI_AHK_EXE = "C:\Program Files\AutoHotkey\v2\AutoHotkey.exe"

to the script. This tells komorebi where the AHK executable is

Create a komorebi.ahk file in your USERPROFILE, then paste the contents of the file here, since we’re not using wkhd.

Enable autostart

komorebic enable-autostart --ahk --bar

You’re now ready to get started with komorebi!

Usage

Start and stop komorebi

komorebic start --ahk --bar
komorebic stop

Customization

Edit these files (in USERPROFILE) for customization. If komorebi is running, it should auto reload, but will silently fail on config errors. Stop and start it again, and you should see errors when it starts. Configuration and bar reference in the docs

komorebi.ahk

It uses Alt by default, but I’ve bound my caps lock key as my hyper key, so I use all modifier keys ^!#a as modifiers. Customize the hotkeys as you see fit.

Some extra commands that you may find useful binding, for a multi monitor setup

  • focus-monitor
  • cycle-send-to-monitor

komorebi.json

  • change default_workspace_padding and default_container_padding to 5, as big borders are distracting. You can reduce border_width as well
    • a value lower than 5 might break window sizing for some apps, especially if you have monitors with different DPIs
  • set stackbar.mode to Never, as it takes up a lot of space
  • you can customize border_colours and theme, refer to catppuccin for palettes and colours
  • tiling layouts: my favourite workspace layout is VerticalStack, so I’ve set all of the workspaces (virtual desktops) to that instead
  • configure multiple monitors
    • set display index (run command while komorebi is running)
    • configure workspaces according to monitor order

komorebi.bar.json

It’s nice out of the box, so I only changed the theme.

Issue Fixes

  • If you’re using a dock (especially a DisplayLink one), consider turning off USB battery saver in Settings > Bluetooth & devices > USB so komorebi doesn’t break when you wake up from sleep
  • komorebi-bar processes don’t seem to get killed with you run komorebic stop, so if you have a lot, use Get-Process -Name komorebi-bar | Stop-Process -Force to kill them

References