komorebi

repository·master·Indexed 12 days ago

https://github.com/lgug2z/komorebi

A tiling window manager for Windows 10+ that extends the Desktop Window Manager (DWM). It provides CLI-based control over windows, workspaces, and monitors via komorebic, and is designed for configuration through tools like whkd or AutoHotKey. Version 0.1.42.

Tokens
76.1K
Snippets
381
Records
450
Agent score
94%

What's inside komorebi

  1. Overview of komorebi

    master

    komorebi is a tiling window manager for Windows 10 and above that acts as an extension to Microsoft's Desktop Window Manager (DWM). It allows users to manage application windows, virtual workspaces, and display monitors via a Command Line Interface (CLI).

    To set up custom keyboard shortcuts, the CLI can be used in conjunction with third-party software such as whkd or AutoHotKey. By default, komorebi aims to make minimal modifications to the OS; any desktop environment modifications are opt-in via user configuration files.

  2. Understand the komorebi data model

    master

    komorebi organizes the desktop using a hierarchical structure of monitors, workspaces, and containers:

    1. Monitor: A physical monitor representing a rectangle of the available work area. Each monitor contains one or more virtual workspaces.
    2. Workspace: A virtual area within a monitor. Workspaces manage containers and their dimensions, but they do not track individual application windows directly.
    3. Container: A rectangle within a workspace that holds one or more application windows.

    Key Rules:

    • Every monitor has its own collection of virtual workspaces.
    • Every application window must belong to a container (even if the container only holds that single window).
    • Multiple application windows can be stacked and cycled through within the same container inside a workspace.
  3. Understand Komorebi data privacy and local storage

    master

    Komorebi is designed with privacy in mind: no data regarding your device or usage of the software leaves your local machine.

    All data maintained by Komorebi is stored locally in the following directory, which is owned by the user running the process: $Env:LOCALAPPDATA\komorebi\

    This directory contains:

    1. Log files: Used for debugging and process monitoring.
    2. Temporary window handles (HWNDs): A list of the window handles currently being managed by the Komorebi process.
  4. Licensing and Commercial Use for komorebi

    master

    komorebi uses the Komorebi 2.0.0 license (a fork of PolyForm Strict 1.0.0).

    Personal Use

    • You are free to use the software for personal use.
    • Redistribution or distribution of new works (hard-forks) is not permitted.
    • You may fork the project for personal use or to submit pull requests upstream.
    • Commercial use (e.g., using it at work) is NOT permitted under the standard license.

    Commercial Use

    • If you need to use komorebi for work, you must acquire an Individual Commercial Use License.
    • This license permits commercial use for the licensed individual only for the duration of a valid paid subscription.
    • Pricing and purchase information can be found at lgug2z.com/software/komorebi.
  5. Use widgets in Komorebi Bar

    master

    Widgets are the building blocks of the bar and are organized into three positional arrays: left_widgets, center_widgets, and right_widgets.

    Each widget is defined as an object where the key is the widget type and the value is its specific configuration object.

    {
      "left_widgets": [
        { "Komorebi": { "option": "value" } }
      ],
      "center_widgets": [],
      "right_widgets": []
    }
  6. Configure click fallbacks for problematic tray icons

    master

    If certain tray icons are 'zombie' icons (they register a callback but don't respond to clicks), you can define fallback shell commands that run instead of the native click action. Fallback commands always take priority.

    Supported Fallback Logic:

    • By Exe: Runs a command for a specific executable.
    • By Tooltip Condition: Runs a command if the tooltip matches a specific pattern (e.g., EndsWith).

    Example Fallback Scenarios:

    • SecurityHealthSystray.exe (any tooltip) $\rightarrow$ start windowsdefender://
    • explorer.exe (tooltip ends with %) $\rightarrow$ start ms-settings:apps-volume
    • explorer.exe (empty tooltip) $\rightarrow$ start ms-settings:batterysaver
  7. Understand the komorebi architecture and components

    master

    komorebi is a tiling window manager for Windows consisting of several key components:

    • komorebi.exe: The core window manager binary.
    • komorebic.exe: The primary CLI tool used to send commands to the window manager.
    • komorebi-bar.exe: A customizable status bar deeply integrated with the manager.
    • whkd: A simple hotkey daemon recommended for binding komorebic.exe commands to keyboard shortcuts.

    Note on Key Bindings: komorebi does not handle hotkeys itself. While whkd is recommended for simplicity, it does not support certain Windows key combinations due to Microsoft restrictions. If you require complex Windows key bindings, use AutoHotKey instead.

  8. Available komorebi layouts

    master

    Komorebi supports several tiling layouts to suit different monitor setups:

    • BSP: Binary Space Partitioning.
    • Vertical Stack: Windows stacked vertically.
    • RightMainVerticalStack: A large main window on the right with a vertical stack on the left.
    • Horizontal Stack: Windows stacked horizontally.
    • Columns: Windows arranged in columns.
    • Rows: Windows arranged in rows (recommended for vertical monitors).
    • Ultrawide Vertical Stack: Optimized for ultrawide monitors.
    • Grid: A grid-based layout (similar to LeftWM) that does not support resizing window tiles.
  9. How column_ratios and row_ratios apply to different layouts

    master

    The meaning of column_ratios and row_ratios changes depending on the active layout:

    Layoutcolumn_ratiosrow_ratios
    ColumnsWidth of each column-
    Rows-Height of each row
    GridWidth of each column (rows are equal height)-
    BSP[0] as horizontal split ratio[0] as vertical split ratio
    VerticalStack[0] as primary column widthStack row heights
    RightMainVerticalStack[0] as primary column widthStack row heights
    HorizontalStackStack column widths[0] as primary row height
    UltrawideVerticalStack[0] center, [1] left columnTertiary stack row heights

    Note for BSP: BSP only uses the first value ([0]) from each array. This single ratio is applied consistently to all splits of that type.

  10. Understand the komorebi architecture and input handling

    master

    komorebi follows a decoupled architecture where it does not handle keyboard or mouse inputs directly. Instead, it responds to WinEvents and messages received via a dedicated socket.

    To control komorebi, you must use a third-party program (such as whkd or ahk) to capture user input and translate it into commands for komorebic (the CLI), which then communicates with the komorebi process via a socket.

    Architecture Flow: whkd/ahk (Input) $\rightarrow$ komorebic (CLI) $\leftrightarrow$ komorebi (Core Process)

              PROCESS                SOCKET
    whkd/ahk  -------->  komorebic  <------>  komorebi
  11. Understand the Komorebi License and Commercial Use

    master

    komorebi is distributed as educational source software under the Komorebi 2.0.0 license (a fork of PolyForm Strict 1.0.0).

    Personal Use

    Free for personal use, excluding redistribution or the distribution of new works (hard-forks) based on the software.

    Commercial Use

    The Komorebi 2.0.0 license does not permit commercial use (e.g., using the software at work). For commercial use, you must obtain an Individual Commercial Use License. Information on pricing and purchase links can be found at lgug2z.com/software/komorebi.

    Students with MDM Devices

    If you are a student using a device enrolled in Mobile Device Management (MDM), your usage still falls under the Komorebi License 2.0.0. You can request the removal of the corporate splash screen by emailing the maintainer from your institutional email address with the subject komorebi - student with an MDM device.

  12. Set global layout defaults using layout_defaults

    master

    To avoid repeating configuration for every workspace, use the top-level layout_defaults setting. This allows you to define layout_options and layout_options_rules for specific layouts globally.

    Resolution Cascade (Precedence)

    Global defaults act as a fallback. The resolution follows this logic:

    1. If a workspace defines either layout_options or layout_options_rules, it completely replaces all global layout_defaults for that layout. You cannot mix workspace-level and global-level settings.
    2. If a workspace has neither setting, it inherits the global layout_defaults for its layout.

    Precedence Summary:

    • Workspace (Rules + Base) > Workspace (Base only) > Workspace (Rules only) > Global Defaults.
    {
      "layout_defaults": {
        "VerticalStack": {
          "layout_options": { "column_ratios": [0.7] },
          "layout_options_rules": {
            "2": { "column_ratios": [0.7] },
            "3": { "column_ratios": [0.55] },
            "5": { "column_ratios": [0.4] }
          }
        }
      },
      "monitors": [
        {
          "workspaces": [
            {
              "name": "main",
              "layout": "VerticalStack"
            }
          ]
        }
      ]
    }