A scrolling window manager. Inspired by PaperWM Gnome extension.
PaperWM:start()
will begin automatically tiling new and existing windows.
PaperWM:stop()
will release control over windows.
PaperWM::bindHotkeys()
will move / resize windows using keyboard shortcuts.
Here is an example Hammerspoon config:
PaperWM = hs.loadSpoon("PaperWM")
PaperWM:bindHotkeys({
-- switch to a new focused window in tiled grid
focus_left = {{"alt", "cmd"}, "left"},
focus_right = {{"alt", "cmd"}, "right"},
focus_up = {{"alt", "cmd"}, "up"},
focus_down = {{"alt", "cmd"}, "down"},
-- move windows around in tiled grid
swap_left = {{"alt", "cmd", "shift"}, "left"},
swap_right = {{"alt", "cmd", "shift"}, "right"},
swap_up = {{"alt", "cmd", "shift"}, "up"},
swap_down = {{"alt", "cmd", "shift"}, "down"},
-- position and resize focused window
center_window = {{"alt", "cmd"}, "c"},
full_width = {{"alt", "cmd"}, "f"},
cycle_width = {{"alt", "cmd"}, "r"},
reverse_cycle_width = {{"ctrl", "alt", "cmd"}, "r"},
cycle_height = {{"alt", "cmd", "shift"}, "r"},
reverse_cycle_height = {{"ctrl", "alt", "cmd", "shift"}, "r"},
-- move focused window into / out of a column
slurp_in = {{"alt", "cmd"}, "i"},
barf_out = {{"alt", "cmd"}, "o"},
--- move the focused window into / out of the tiling layer
toggle_floating = {{"alt", "cmd", "shift"}, "escape"},
-- switch to a new Mission Control space
switch_space_1 = {{"alt", "cmd"}, "1"},
switch_space_2 = {{"alt", "cmd"}, "2"},
switch_space_3 = {{"alt", "cmd"}, "3"},
switch_space_4 = {{"alt", "cmd"}, "4"},
switch_space_5 = {{"alt", "cmd"}, "5"},
switch_space_6 = {{"alt", "cmd"}, "6"},
switch_space_7 = {{"alt", "cmd"}, "7"},
switch_space_8 = {{"alt", "cmd"}, "8"},
switch_space_9 = {{"alt", "cmd"}, "9"},
-- move focused window to a new space and tile
move_window_1 = {{"alt", "cmd", "shift"}, "1"},
move_window_2 = {{"alt", "cmd", "shift"}, "2"},
move_window_3 = {{"alt", "cmd", "shift"}, "3"},
move_window_4 = {{"alt", "cmd", "shift"}, "4"},
move_window_5 = {{"alt", "cmd", "shift"}, "5"},
move_window_6 = {{"alt", "cmd", "shift"}, "6"},
move_window_7 = {{"alt", "cmd", "shift"}, "7"},
move_window_8 = {{"alt", "cmd", "shift"}, "8"},
move_window_9 = {{"alt", "cmd", "shift"}, "9"}
})
PaperWM:start()
Use PaperWM:bindHotkeys(PaperWM.default_hotkeys)
for defaults.
Set PaperWM.window_gap
to the number of pixels to space between windows and
the top and bottom screen edges.
Overwrite PaperWM.window_filter
to ignore specific applications. For example:
PaperWM.window_filter = PaperWM.window_filter:setAppFilter("Finder", false)
PaperWM:start() -- restart for new window filter to take effect
Set PaperWM.window_ratios
to the ratios to cycle window widths and heights
through. For example:
PaperWM.window_ratios = { 1/3, 1/2, 2/3 }
Under System Preferences -> Mission Control, unselect "Automatically rearrange Spaces based on most recent use" and select "Displays have separate Spaces".
MacOS does not allow a window to be moved fully off-screen. Windows that would be tiled off-screen are placed in a margin on the left and right edge of the screen. They are still visible and clickable.
It's difficult to detect when a window is dragged from one space or screen to another. Use the move_window_N commands to move windows between spaces and screens.
Arrange screens vertically to prevent windows from bleeding into other screens.
Signature | PaperWM.default_hotkeys |
---|---|
Type | Variable |
Description | Default hotkeys for moving / resizing windows |
Source | Source/PaperWM.spoon/init.lua line 132 |
Signature | PaperWM.logger |
---|---|
Type | Variable |
Description | Logger object. Can be accessed to set default log level. |
Source | Source/PaperWM.spoon/init.lua line 202 |
Signature | PaperWM.window_filter |
---|---|
Type | Variable |
Description | Windows captured by this filter are automatically tiled and managed |
Source | Source/PaperWM.spoon/init.lua line 177 |
Signature | PaperWM.window_gap |
---|---|
Type | Variable |
Description | Number of pixels between tiled windows |
Source | Source/PaperWM.spoon/init.lua line 187 |
Signature | PaperWM.window_ratios |
---|---|
Type | Variable |
Description | Size of the on-screen margin to place off-screen windows |
Source | Source/PaperWM.spoon/init.lua line 197 |
Signature | PaperWM:addWindow(add_window) |
---|---|
Type | Method |
Description | Adds a window to layout and tiles. |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 652 |
Signature | PaperWM:barfWindow() |
---|---|
Type | Method |
Description | Removes current window from column and places it to the right |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1135 |
Signature | PaperWM.bindHotkeys(mapping) |
---|---|
Type | Method |
Description | Binds hotkeys for PaperWM |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1455 |
Signature | PaperWM:centerWindow() |
---|---|
Type | Method |
Description | Moves current window to center of screen, without resizing. |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 937 |
Signature | PaperWM:cycleWindowSize(direction, cycle_direction) |
---|---|
Type | Method |
Description | Resizes current window by cycling through width or height ratios. |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 990 |
Signature | PaperWM:focusWindow(direction, focused_index) |
---|---|
Type | Method |
Description | Change focus to a nearby window |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 771 |
Signature | PaperWM:incrementSpace(direction) |
---|---|
Type | Method |
Description | Switch to a Mission Control space to the left or right of current space |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1209 |
Signature | PaperWM::moveWindow(window, frame) |
---|---|
Type | Method |
Description | Resizes a window without triggering a windowMoved event |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1351 |
Signature | PaperWM:moveWindowToSpace(index, window) |
---|---|
Type | Method |
Description | Moves the current window to a new Mission Control space |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1243 |
Signature | PaperWM:refreshWindows() |
---|---|
Type | Method |
Description | Searches for all windows that match window filter. |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 618 |
Signature | PaperWM:remove_window(remove_window, skip_new_window_focus) |
---|---|
Type | Method |
Description | Remove window from tiling layout |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 720 |
Signature | PaperWM:setWindowFullWidth() |
---|---|
Type | Method |
Description | Resizes current window's width to width of screen, without adjusting height. |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 965 |
Signature | PaperWM:slurpWindow() |
---|---|
Type | Method |
Description | Moves current window into column of windows to the left |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1067 |
Signature | PaperWM:start() |
---|---|
Type | Method |
Description | Start automatic tiling of windows |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 396 |
Signature | PaperWM:stop() |
---|---|
Type | Method |
Description | Stop automatic tiling of windows |
Parameters |
|
Returns |
|
Source | Source/PaperWM.spoon/init.lua line 447 |
Signature | PaperWM:swapWindows(direction) |
---|---|
Type | Method |
Description | Swaps window postions between current window and window in specified direction. |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 824 |
Signature | PaperWM:switchToSpace(index) |
---|---|
Type | Method |
Description | Switch to a Mission Control space |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1192 |
Signature | PaperWM:tileColumn(windows, bounds, h, w, id, h4id) |
---|---|
Type | Method |
Description | Tile a column of windows |
Parameters |
|
Returns |
|
Notes |
|
Source | Source/PaperWM.spoon/init.lua line 470 |
Signature | PaperWM:tileSpace(space) |
---|---|
Type | Method |
Description | Tile all windows within a space |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 522 |
Signature | PaperWM:toggleFloating() |
---|---|
Type | Method |
Description | Add or remove focused window from the floating layer and retile the space |
Parameters |
|
Returns | |
Source | Source/PaperWM.spoon/init.lua line 1380 |