A lightweight tiling window manager for Windows written in Kotlin using JNA and Compose Desktop.
KWM automatically arranges application windows into a tiling layout and provides workspace management, keyboard-driven window control, and a real-time status bar.
The goal of this project is to bring a Linux-style tiling workflow (similar to i3, XMonad, or GlazeWM) to Windows while keeping the implementation simple and hackable.
Windows are automatically arranged in a tiling layout.
Current layout:
1 window → fullscreen
2 windows → left / right
3 windows → left + top-right + bottom-right
4 windows → left + 3 stacked right
Windows are dynamically re-tiled when:
- a new window appears
- a window closes
- windows are reordered
- workspaces change
KWM supports multiple workspaces.
Each workspace maintains its own window list.
Switching workspace will:
- hide windows from the previous workspace
- restore windows from the new workspace
- re-tile them
- focus the primary window
Windows can be reordered or moved using hotkeys.
Operations supported:
- Promote window to master
- Move window up/down in stack
- Move window to another workspace
- Switch workspaces
KWM can optionally enable focus-follows-mouse.
When the cursor moves over a window, that window receives focus without changing the tiling order.
A top bar built with Compose Desktop displays real-time information.
Left side:
- Workspace indicators
Center:
- Current date
- Current time
Right side:
- CPU usage
- RAM usage
- Battery level
Example layout:
[1] [2] [3] [4] [5] Fri Feb 21 23:18 CPU 17% RAM 43% BAT 92%
The project is organized into multiple modules.
KWM
│
├─ core
│ Window management engine
│ - window discovery
│ - tiling logic
│ - workspace system
│ - hotkey handling
│
├─ bar
│ Compose Desktop UI
│ - workspace indicators
│ - system stats
│ - clock
│
└─ launcher
Application entry point
Starts both WM and bar
Design principle:
core → window manager engine
bar → UI only
launcher → connects both
The window manager engine does not depend on the UI.
Language:
- Kotlin
Libraries:
- JNA (Java Native Access) — Win32 API integration
- Compose Desktop — status bar UI
- OSHI — system statistics (CPU, RAM, battery)
KWM listens to Windows events using:
SetWinEventHook
Events captured include:
- window creation
- window destruction
- foreground changes
When events occur, KWM:
- updates workspace window lists
- recalculates the tiling layout
- applies new window positions using Win32 APIs
- JDK 17+
- Gradle
- Windows
git clone https://github.com/<your-username>/kwm
cd kwm
./gradlew :launcher:run
Responsible for:
- tiling layout
- window promotion
- window movement
- workspace switching
Maintains window lists for each workspace.
Handles:
- window insertion
- window removal
- workspace switching
- window swapping
Applies tiling layouts by calling Win32 APIs such as:
SetWindowPos
MoveWindow
ShowWindow
Provides system statistics for the bar using OSHI.
Updates:
- CPU usage
- RAM usage
- battery state
- clock
Compose Desktop application responsible for rendering the top bar.
Displays:
- workspace state
- system stats
- time/date
- Single monitor support
- Fixed tiling layout
- No configuration file yet
- No animated transitions
- Windows only
Planned features.
- multi-monitor support
- configurable layouts
- smart gaps
- floating windows
- layout switching
- window titles in bar
- system tray integration
- weather widget
- notification area
- config file for keybinds
- layout configuration
- workspace naming
- replace polling with event-driven mouse focus
- improve window detection filtering
This project is inspired by:
- GlazeWM
- DWM
- yabai
Contributions are welcome.
Possible areas:
- layout algorithms
- multi-monitor support
- animation improvements
- better window detection
- UI improvements
MIT License
Mohit Singh
Computer Science Student
IIIT Sonepat 2022-26