Skip to content

Configuration

imawizard edited this page Jul 30, 2024 · 2 revisions
;; Use all default values.
mwm := MiguruWM()

;; Overwrite some options.
mwm := MiguruWM({
    layout: "floating",
    padding: { left: 20, right: 20, top: 10, bottom: 10 },
})
Attribute Default Description

layout

""

See Layouts.

masterSize

0.5

Specifies the ratio that is used to size the primary area.

masterCount

1

Specifies how many windows should be placed in the primary area.

padding

{
    left: 0,
    top: 0,
    right: 0,
    bottom: 0,
}

Specifies the spacing to the monitor edges.

spacing

0

Specifies the spacing between windows.

tilingMinWidth

500

New windows are automatically tiled, except when their width or height is smaller than the respective option (or they fall into one of the ahk window groups) in which case they are floating.

tilingMinHeight

500

See above.

tilingInsertion

"last"

Specifies where new tiled windows are inserted. Possible values are:

  • first: a new window will become the new master window

  • last: it will become the last window in the secondary pane

  • before-mru: it will be inserted before the active window

  • after-mru: it will be inserted after the active window

floatingAlwaysOnTop

false

If true, floating windows are set to be always on top.

focusFollowsMouse

false

If true, uses SPI_SETACTIVEWINDOWTRACKING to activate focusing windows through moving the mouse.

mouseFollowsFocus

false

If true, move the mouse to the center of a window when calling mwm.Do("focus-window", …).

followWindowToWorkspace

false

If true, calling mwm.Do("send-to-workspace", …) switches to the workspace the window was sent to.

followWindowToMonitor

false

If true, calling mwm.Do("send-to-monitor", …) focuses the monitor the window was sent to.

focusWorkspaceByWindow

true

Changes the behavior of mwm.Do("focus-workspace", …):

  • true: Results in WinActivate(target-workspace.ActiveWindow) and will switch to another workspace by focusing its last active window (also focus the workspace’s last active monitor).

  • "same-monitor" v0.2.0 : Same as above, but keep focus on currently active monitor.

  • false: Results in IVirtualDesktopManagerInternal.SwitchDesktop, with prior taskbar-focus (prevent taskbar from flashing) and subsequent Alt-Escape keypress (focus last active window). This makes Windows decide which window and which monitor will get focus upon switching workspaces. Possible caveats: There are windows that always steal focus upon switching workspaces, like minimized MS Teams or pinned windows.

delays

{
    retryManage: 100,
    retile2ndTime: 200,
    windowHidden: 200,
    sendMonitorRetile: 100,
    pinnedWindowFocused: 100,
    onDisplayChange: 1000,
}

Specifies the delays to wait before doing certain actions. Higher values give more precise window handling, but less nice user experience.

  • retryManage: Specifies the delay to try picking up new windows a second time if some winapi/com function failed the first time.

  • retile2ndTime: Specifies the delay before retiling windows a second time (this copes with window positions that are off for some reason after the first retile).

  • windowHidden: Specifies the delay to wait before handling a window’s hide-event as a close. Smaller values make retiling snappier when a window disappears. However, it increases the possibility of falsely recognizing the hide-event when switching virtual desktops as a close-event which would result in windows being seen as new when switching back to that virtual desktop, repositioning the windows again and possibly differently.

  • sendMonitorRetile: Specifies the delay to wait before retiling a window’s new monitor a second time (at the time of EV_WINDOW_SHOWN for the new monitor the winapi functions for sizing and positioning don’t yet work correctly when dpi changes are involved).

  • pinnedWindowFocused: (only relevant if focusWorkspaceByWindow: false) Upon switching workspaces with IVirtualDesktopManagerInternal.SwitchDesktop there’s a EV_WINDOW_FOCUSED-event for pinned windows, right before the EV_DESKTOP_CHANGED-event. This delay tries to mitigate that pinned windows would always be the active window when switching workspaces by waiting for possible succeeding EV_WINDOW_FOCUSED-events of other windows before registering the pinned window as active.

  • onDisplayChange: Specifies the delay to wait before windows are retiled when dis-/ connecting monitors. Smaller values result in snappier behaviour, but since it takes some time for message propagation and windows to react to the display-change it could result in incorrect window sizing and positioning.

showPopup

""

Callback that gets called to show popup messages. opts.activeMonitor is the index of the current monitor (from left to right).

focusIndicator

""

AHK Window Groups

GroupAdd("MIGURU_AUTOFLOAT", "Microsoft Teams-Notification ahk_exe Teams.exe")
GroupAdd("MIGURU_DECOLESS", "ahk_exe qutebrowser.exe")
  • MIGURU_DECOLESS: Explicitly handle and tile windows that have no title bar like e.g. alacritty or qutebrowser which would get ignored otherwise.

  • MIGURU_IGNORE: New windows that match an entry won’t be picked up but ignored. So they are neither moved/resized nor focused with mwm.Do("focus-window", …).

  • MIGURU_AUTOFLOAT: Float all new windows that match an entry. Floating windows won’t get positioned or resized automatically like tiled windows. They can be set to be always on top with floatingAlwaysOnTop and come after the tiled ones when iterating through the windows with mwm.Do("focus-window", …).

See the autohotkey docs for information on GroupAdd.

Clone this wiki locally