Skip to content

EngineeringMechanicsB/AHK_WM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฒ AHK WM v2.8.5

AutoHotkey v2 Platform License Release

English ็ฎ€ไฝ“ไธญๆ–‡

A tiny, fast, single-file window manager for Windows โ€” powered by AutoHotkey v2.


๐Ÿ“‘ Contents


โœจ Features

๐Ÿ“„ Single file One .ahk script, zero dependencies ๐Ÿงฉ Smart Tiling
โšก Fast No runtime framework ๐Ÿ–ฅ๏ธ 9 Virtual Desktops
๐Ÿ–ฅ๏ธ Win 7 ~ 11 All modern Windows versions ๐Ÿฅง Pie Menu
๐Ÿงน Low interference Shared-computer friendly ๐Ÿ“Š Status Bar
โš™๏ธ INI config Edit and reload instantly ๐ŸŽจ 20+ Themes
๐ŸŒˆ Gradient colors Bar, borders, PowerMenu ๐Ÿ“‹ Clipboard History

Two years of daily-use refinement. Built because every other Windows WM was too heavy and made my machine unusable for anyone else.


๐Ÿ“ธ Screenshots

Preview Description
Screenshots Desktop Overview โ€” borders, tiling, multi-window layout
Smart Tile Smart Tiling โ€” one key arranges all windows on current monitor
Pie Menu Pie Menu โ€” radial menu, Space + Right Mouse
WinSelect WinSelect โ€” letter-labeled overlay for quick switching
Status Bar Status Bar โ€” desktop indicator, clock, date, progress bar
Help Page Built-in Help โ€” Alt + / for full hotkey reference

๐ŸŽจ Bar Widgets (v2.8)

Per-element gradient backgrounds (bg), gradient text (tx), rounded corners, and span-based alignment โ€” each widget is independently styled via the layout string.

Bar Widgets Full
Gradient bg widgets with rounded corners (desktops, date, time, progress, CPU, mem, disk)

Bar Widgets Detail
Close-up: gradient backgrounds and current-desktop highlight with rounded corners

Bar Layout
Layout configuration in action

Bar Config
Configuration format: N,element,span,colors,bg|tx,on|off

๐ŸŒˆ Gradient Borders (v2.8)

BorderDrag, BorderPin, and BorderUnfocus support comma-separated gradient colors.

Border Gradient
Drag border with gradient color

Border Fullscreen
Border gradient in action


๐Ÿ“ฆ Installation

Option 1: Run the .ahk script โญ Recommended

  1. Install AutoHotkey v2 โ†’ https://www.autohotkey.com/
  2. Download wm.ahk from the latest release
  3. Run as Administrator (required for elevated windows)

Done.

Option 2: Compiled .exe

Run the pre-compiled executable โ€” no AHK installation needed for basic use.

Download Latest Release

โš ๏ธ Pie menu customization and some advanced features require AHK v2. Running the .ahk script is recommended.


๐Ÿš€ Quick Start

Action Hotkey
๐Ÿ“– Help page Alt + /
๐Ÿงฉ Tile current monitor Alt + D
โœ‹ Move window (anywhere) Alt + Left Mouse
๐Ÿ“ Resize window (anywhere) Alt + Right Mouse
๐Ÿ”„ Switch desktop 1~9 Alt + 1 ~ 9
๐Ÿ“ฆ Move window to desktop Alt + Shift + 1 ~ 9
๐Ÿš€ Move & follow to desktop Ctrl + Alt + 1 ~ 9
๐Ÿ“Š Toggle status bar Ctrl + Alt + B
๐Ÿ’พ Save layout Alt + Shift + S
๐Ÿ” Restore layout Alt + Shift + R
๐Ÿงฒ Gather all windows Alt + Shift + G
๐Ÿ” Window transparency Alt + Mouse Wheel
๐Ÿ“Œ Toggle always-on-top Alt + T
โŒ Close window under mouse Alt + Q
๐Ÿ”ƒ Reload script Alt + R
๐Ÿ›‘ Safe exit Alt + F12
โšก Power menu Alt + X
๐Ÿฅง Pie menu Space + Right Mouse

๐Ÿ’ก Press Alt + / anytime โ€” the built-in help page lists every hotkey.


๐Ÿงฐ Detailed Features

๐Ÿ–ฅ๏ธ Virtual Desktops

9 desktops with independent focus tracking per desktop.

Action Hotkey
Switch to desktop 1~9 Alt + 1 ~ 9
Move window to desktop Alt + Shift + 1 ~ 9
Move window & follow Ctrl + Alt + 1 ~ 9
Gather all windows here Alt + Shift + G

Hide method: minimize or transparency. Mark windows as always-visible across desktops.

[Desktop]
HideMethod=minimize        ; minimize | transparency

๐Ÿงฉ Smart Tiling

A single hotkey arranges all visible windows on the current monitor. Layouts adapt to monitor aspect ratio โ€” standard (16:9/16:10), vertical (portrait), and ultrawide each get their own rules.

Default: Alt + D

[Tiling]
Gap=8
Rules=1,3,1,1/2,1;1,3,2,2/2,1/2;1,3,3,2/2,2/2;

Rule format: M,N,I,X,Y

Field Meaning Example
M Monitor index (* = all) 1
N Total windows on monitor 3
I This window's index (1-based) 2
X Horizontal span 1 = full, a/b = segment a, (a-c)/b = segments a~c
Y Vertical span Same syntax

Exclude windows by title, class, or process:

[Exclude]
Title=re:.*Steam.*;=Calculator
Class=AceApp
Process=devenv.exe;chrome.exe

Protected tiling boundaries via SetTileBound / ClearTileBound.


โœ‹ KDE-style Drag

Move and resize from anywhere on the window โ€” no need to grab the title bar.

Alt + Left Mouse  โ†’  Move
Alt + Right Mouse โ†’  Resize

DWM frame delta compensation for pixel-accurate positioning.


๐Ÿฅง Pie Menu

8-direction radial menu on Space + Right Mouse. Items, opacity, font size, and center zone are all configurable.

[PieMenu]
SizePct=28
CenterZonePct=27
Opacity=78
FontSize=14
FontSizeActive=22

๐Ÿ“Š Status Bar

Multi-monitor bar with proportional layout, gradient colors, rounded corners, and alignment control. Shows virtual desktops, clock, date, work progress, system stats, and custom text/icons.

[Bar]
HeightPct=3
Opacity=78
MonitorIdx=1
position=top              ; top | bottom

Element layout format (gradient + rounded + alignment):

; N,element,span,colors,bg|tx,on|off
layout=1,time,20/20,ff0000,00ff00,tx;desktops,(1-3)/20,FAB387,A020F0,bg,on;cpu,14/-20
Parameter Values Notes
N Bar instance # (default 1) For multi-bar setups
element desktops, time, date, progress, wifi, bluetooth, battery, volume, disk, mem, cpu, custom_1..n
span a/b, a/+b, a/-b, (a-c)/b, (a-c)/+b, (a-c)/-b +=right-align, -=left-align, none=center
colors One or more 6-digit hex (comma-separated) Supports # prefix
mode bg = colored background, tx = gradient text
rounded on or off Rounded corners (bg mode)

Span alignment โ€” the +/- sign controls both individual cell text alignment AND overall group position within the span:

  • (1-3)/20 โ†’ centered in span
  • (1-3)/+20 โ†’ right-aligned group, text right-aligned
  • (1-3)/-20 โ†’ left-aligned group, text left-aligned

Current desktop highlight โ€” set current_desktop_color with the same colors,bg|tx,on|off format to give the active desktop a distinct visual highlight:

current_desktop_color=FAB387,A020F0,bg,on

Available elements: desktops, time, date, progress, wifi, bluetooth, battery, volume, disk, mem, cpu, custom_1..custom_n

  • Colors support # prefix: #FF0000,#00FF00
  • Legacy element:span,color format still compatible
  • Auto-hides when a fullscreen app is detected
  • Pause-on-fullscreen option ([General] PauseOnFullscreen=on)
  • Toggle: Ctrl + Alt + B ยท Reload: Alt + R

๐Ÿ–ผ๏ธ Window Borders

Visual borders for active, dragged, pinned, and managed windows โ€” now with gradient color support.

Mode Purpose
Focus border Highlights the active window
Drag border Visual feedback during move/resize
Pin border Marks always-on-top windows
All-window borders Borders on every visible window
[Border]
Mode=full                  ; full | top
Thickness=15
RoundedCorners=on
Radius=10
; Colors support gradients: color1,color2,...

Border colors (BorderDrag, BorderPin, BorderUnfocus) support comma-separated gradient colors.


๐Ÿ”ค WinSelect

Letter-labeled overlay โ€” press a key to jump to that window. Scales windows down, overlays letters. Sidebar mode with configurable position. Auto-dismiss on timeout. Restores always-on-top state on exit.

[WinSelect]
SidebarWidth=200
SidebarPosition=right     ; left | right
Timeout=3000

โŒจ๏ธ WTM Mode

Keyboard-driven dynamic tiling preview. Auto-tiles on activation, has its own border system, desktop-switch aware.

โš ๏ธ Experimental โ€” hotkeys disabled by default.

[WTM]
BorderMode=full
BorderFocusColor=A020F0
BorderThickness=8
Gap=10

Enable it:

[Hotkeys]
WTMToggle=Alt+Shift+D

๐Ÿ“ Window Snapping

Edge snapping during move and resize โ€” snaps to other window edges and screen edges.

[Snapping]
SnapDistance=10
SnapReleaseDistance=20

๐Ÿ’พ Layout Save/Restore

Snapshot and restore all window positions, sizes, and states.

Action Hotkey
Save layout Alt + Shift + S
Restore layout Alt + Shift + R

๐ŸŽจ Themes

20+ built-in themes, instant hot-switching. Each defines: background, text, accent, task, border, pie menu, power menu, and WTM colors.

nord ยท tokyonight ยท dracula ยท gruvbox ยท monokai
solarized-dark ยท solarized-light ยท catppuccin-mocha ยท catppuccin-latte
onedark ยท ayu-dark ยท github-dark ยท rose-pine ยท everforest
kanagawa ยท material-deep ยท nightfox ยท palenight ยท horizon ยท oxocarbon

Switch from the system tray menu or config. Export current theme with ExportThemeToCustom().


โฑ๏ธ Work Timer

Status bar progress bar showing how far through the workday you are.

[WorkTime]
Mode=off
WorkStart=0900
WorkEnd=1745
TaskTimes=1_1200_1300     ; Monday 12:00-13:00 (lunch)

Per-weekday task slots, weekend bar option, percentage display.


๐Ÿ“‹ Clipboard History

Monitors clipboard changes and logs them to file. Built-in viewer for reviewing past clips. Includes 200ms debounce to suppress rapid duplicate triggers.

[Paths]
OutputDir=C:\Users\...\Documents
OutputFile=CB.txt

๐Ÿ”Œ Editor & Terminal

Quick-launch terminal and editor from anywhere. Explorer integration โ€” get selected files, get current path.

[Paths]
VimPath=C:\path\to\your\editor.exe
TerminalExe=wt.exe         ; Windows Terminal

โšก Power Menu & More

Power menu (Alt + X): shutdown, sleep, reboot. Button colors follow the active theme.

Additional features:

  • ๐Ÿ–ฑ๏ธ System tray โ€” right-click for theme switch, reload, safe exit
  • ๐Ÿ›ก๏ธ Fault isolation โ€” WMGuard() wraps all operations in try/catch
  • ๐Ÿ“ Error logging โ€” WMLogErr() deduplicates repeated errors
  • ๐Ÿ”„ Auto config repair โ€” missing keys added on every startup
  • ๐Ÿ” Transparency โ€” Alt + Mouse Wheel on any window
  • ๐Ÿ“Œ Always-on-top โ€” Alt + T
  • ๐Ÿ”‡ Minimize window under mouse
  • ๐Ÿ–ฅ๏ธ Maximize window under mouse

๐Ÿ”” External OSD (v2.8.5)

Other AHK scripts can show OSD messages through AHK_WM via a standard WM_COPYDATA message. No polling, no temp files โ€” just one function call.

Drop this function into your script:

; Show an OSD banner through AHK_WM. AHK_WM must be running.
AHK_WM_OSD(text, duration := 1000) {
    DetectHiddenWindows(true)
    h := WinExist("wm.ahk ahk_class AutoHotkey")
    if !h
        return false
    payload := "OSD:" . text . ":" . duration
    c := StrPut(payload, "UTF-16")
    b := Buffer(A_PtrSize * 3, 0)
    NumPut("Ptr",  0,             b, 0)
    NumPut("UInt", c,             b, A_PtrSize)
    NumPut("Ptr",  StrPtr(payload), b, A_PtrSize * 2)
    SendMessage(0x4A, 0, b.Ptr, , "ahk_id " . h)
    return true
}

AHK_WM_OSD("Build passed!", 3000)

See wm_osd.ahk for a ready-to-run example.


โš™๏ธ Configuration

Single INI file:

%USERPROFILE%\.config\AHK_WM\wm_config.ini
Section Purpose
[General] Theme, font, transparency step, pause-on-fullscreen
[Theme] All color definitions (gradients supported)
[Paths] Editor, terminal, clipboard log paths
[Desktop] Virtual desktop count, hide method
[Bar] Height, opacity, layout, alignment, rounded corners
[Border] Mode, thickness, colors, rounded corners
[Tiling] Gap, custom layout rules, exclusions
[WTM] Keyboard tiling mode settings
[PieMenu] Size, opacity, font settings
[GUI] Help window & OSD preferences
[WorkTime] Work hours, task slots, progress bar
[Exclude] Window exclusions (title/class/process)
[Hotkeys] All keybindings
[Snapping] Snap distance, release distance
[WinSelect] Sidebar position, width, timeout

๐Ÿ’ก Edit config, press Alt + R to reload โ€” no restart needed.


๐Ÿ› ๏ธ Changelog

v2.8.5 (2026-07-10)

  • ๐Ÿ› GDI handle leak fixed โ€” CreateGradient() 1ร—1 seed bitmap was leaked on every call (up to 100/s during border drag); now properly freed
  • ๐Ÿ› Rapid desktop-switch race fixed โ€” DesktopIsSwitching flag guards SwitchDesktop, WTM/AllBorders ticks, TogglePin, GatherAll, and SaveLayoutStateForReload
  • โšก Bar polling optimized โ€” WiFi and disk info cached for 30 s, avoiding per-second netsh subprocess spawn and DriveGetSpaceFree I/O
  • ๐Ÿ†• External OSD interface โ€” WM_COPYDATA receiver lets other scripts pop OSD messages; includes wm_osd_helper.ahk library + wm_osd_send.ahk standalone sender
  • ๐Ÿงน Duplicate code extracted โ€” _GetHwndUnderMouse, _RemoveFromAllDesktops, _GetTileMode, _BorderPlaceFrame, _BuildSysWidget shared helpers
  • ๐Ÿงน UpdateClock table-driven โ€” SysWidgets array replaces 7 repeated if-blocks in bar clock update
  • ๐Ÿงน _BuildElements unified โ€” WidgetMeta Map + multi-value case fallthrough replaces 7 repeated cases
  • ๐ŸŽจ Tiling edge gap fixed โ€” Gap=0 now truly flush to screen edges; DWM compensation preserved for window-to-window spacing only

v2.8.4 (2026-07-01)

  • ๐Ÿ› Clipboard fixed โ€” RecordClipboard() was missing FileAppend; history is now actually written to file
  • ๐Ÿ› Bar white edge fixed โ€” RoundWindowEx now disables DWM non-client rendering before SetWindowRgn, eliminating white artifacts on Win10 19041+
  • ๐Ÿ› ShowWin fixed โ€” SW_SHOWNA(8) โ†’ SW_RESTORE(9); minimized windows now restore correctly
  • ๐Ÿ› Desktops white clipping โ€” layoutBg creation moved to _BuildElements (same timing as other elements), resolving alignment-dependent white gaps
  • ๐Ÿ†• Span alignment โ€” +/- sign in span format now controls both group positioning and text alignment
  • ๐Ÿ†• Tx mode in highlight โ€” tx mode correctly renders desktop labels with default color when no background is specified
  • ๐Ÿงน GDI leak โ€” task-marker bitmaps now tracked and released on bar destroy
  • ๐Ÿงน Cleanup โ€” removed legacy globals, deduplicated INI parsing, added Persistent directive
  • โšก Clipboard debounce โ€” 200ms filter suppresses rapid duplicate fires

v2.8.0 (2026-06-29)

  • ๐ŸŒˆ Gradient colors โ€” bar elements, borders, and PowerMenu now support gradient backgrounds and gradient text
  • ๐Ÿ”ฒ Bar rounded corners โ€” per-element on|off switch for bg-mode rounded corners
  • ๐ŸŽจ Bar layout overhaul โ€” new N,element,span,colors,bg|tx,on|off format with granular control
  • ๐Ÿ”ง Border gradient โ€” BorderDrag/BorderPin/BorderUnfocus support comma-separated gradient colors
  • โš™๏ธ Pause-on-fullscreen โ€” [General] PauseOnFullscreen=on suspends hotkeys when gaming
  • ๐Ÿ” Transparency step โ€” configurable step size, snap to multiples
  • ๐Ÿงน Code cleaned โ€” removed legacy migration, legacy WTM globals, redundant sections
  • ๐Ÿ› Fixed โ€” bg rounded corners, single-color bg rendering, transparency minimum, help/OSD theme follow

v2.6.4 (2026-06-18)

  • ๐Ÿ†• Config integrity check โ€” auto-detect missing keys & add defaults on every startup
  • ๐Ÿ› Pin border rounding โ€” now reads from config
  • ๐Ÿ”ง DWM compensation โ€” extracted into shared function

๐Ÿ”ฎ Roadmap

  • Config consolidation โ€” clean up two years of accumulated INI cruft
  • WTM mode โ€” edge cases, crash recovery, multi-monitor improvements
  • Per-monitor desktops โ€” independent desktop switching per monitor
  • Package managers โ€” Scoop, Chocolatey, winget distribution

โ“ Troubleshooting

Symptom Fix
Hotkeys fail in admin windows Run script as Administrator
Pie menu customization broken Install AHK v2 (not just the .exe)
Games / UWP act strange Add to [Exclude]
Status bar hidden by fullscreen By design. Toggle with Ctrl+Alt+B
Borders look offset Adjust Border thickness or radius
Remote Desktop issues Some features differ over RDP (DWM changes)

๐Ÿค Contributing

  • ๐Ÿ› Bug reports โ€” Open an issue with repro steps and Windows version
  • ๐Ÿ’ก Feature requests โ€” Open an issue with the enhancement label
  • ๐Ÿ”ง Pull requests โ€” Welcome. For large changes, open an issue first.
  • ๐ŸŽจ Themes โ€” Submit with a screenshot.

๐Ÿ“„ License

MIT ยฉ 2024-2026 EngineeringMechanicsB


โญ Star History

Star History Chart

footer

Made with AutoHotkey v2 ยท Two years and counting

About

A tiny, fast, single-file, AHK window manager for Windows

Topics

Resources

License

Stars

6 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors