cell
. Each cell is an hs.geometry
rect with these fields:'0,0 1x1'
will be in the upper-left corner'2,0 1x1'
will be in the upper-right cornerhs.grid.show()
; The grid will be overlaid on the focused or frontmost window's screen with keyboard hints. To resize/move the window, you can select the corner cells of the desired position. For a move-only, you can select a cell and confirm with 'return'. The selected cell will become the new upper-left of the window. You can also use the arrow keys to move the window onto adjacent screens, and the tab/shift-tab keys to cycle to the next/previous window. Once you selected a cell, you can use the arrow keys to navigate through the grid. In this case, the grid will highlight the selected cells. After highlighting enough cells, press enter to move/resize the window to the highlighted area.hs.grid.HINTS
hs.keycodes.map
) to be used for the interactive resizing interface.hs.inspect(hs.grid.HINTS)
from the console will show you how the table is builths.grid.show()
When displaying interactive grid, if gird dimensions (hs.grid.setGrid()
) are greater than HINTS
dimensions, then Hammerspoon merges few cells such that interactive grid dimensions do not exceed HINTS
dimensions. This is done to make sure interactive grid cells do not run out of hints. The interactive grid ends up with cells of varying height and width. The actual grid is not affected. If you use API methods like hs.grid.pushWindowDown()
, you will not face this issue at all. If you have a grid of higher dimensions and require an interactive gird that accurately models underlying grid then set HINTS
variable to a table that has same dimensions as your grid. Following is an example of grid that has 16 columnshs.grid.ui
hs.grid.adjustWindow(fn, window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.get(win) -> cell
hs.window
object to get the cell ofhs.geometry
rect), or nil if an error occurredhs.grid.getCell(cell, screen) -> hs.geometry
hs.geometry
rect for a cell on a particular screenhs.geometry
rect or argument to construct onehs.screen
object or argument to hs.screen.find()
where the cell is locatedhs.geometry
rect for a cell on a particular screen or nil if the screen isn't foundhs.grid.getGrid(screen) -> hs.geometry size
hs.screen
object, or a valid argument to hs.screen.find()
, indicating the screen to get the grid of; if omitted or nil, gets the default grid, which is used when no specific grid is found for any given screen/resolutionhs.geometry
size object indicating the number of columns and rows in the gridhs.grid.getGridFrame(screen) -> hs.geometry rect
hs.screen
object, or a valid argument to hs.screen.find()
, indicating the screen to get the grid frame ofhs.geometry
rect object indicating the frame used by the grid for the given screen; if no custom frame was given via hs.grid.setGrid()
, returns the screen's framehs.grid.hide()
.hide()
will call iths.grid.maximizeWindow(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.pushWindowDown(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.pushWindowLeft(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.pushWindowRight(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.pushWindowUp(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.resizeWindowShorter(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.resizeWindowTaller(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.resizeWindowThinner(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.resizeWindowWider(window) -> hs.grid
hs.window
object to act on; if omitted, the focused or frontmost window will be usedhs.grid
module for method chaininghs.grid.set(win, cell, screen) -> hs.grid
hs.window
object representing the window to operate onhs.geometry
rect or argument to construct one, to apply to the windowhs.screen
object or argument to hs.screen.find()
representing the screen to place the window on; if omitted the window's current screen will be usedhs.grid
module for method chaininghs.grid.setGrid(grid,screen,frame) -> hs.grid
hs.geometry
size, or argument to construct one, indicating the number of columns and rows for the gridhs.screen
object, or a valid argument to hs.screen.find()
, indicating the screen(s) to apply the grid to; if omitted or nil, sets the default grid, which is used when no specific grid is found for any given screen/resolutionhs.geometry
rect object indicating the frame that the grid will occupy for the given screen; if omitted or nil, the screen's :frame()
will be used; use this argument if you want e.g. to leave a strip of the desktop unoccluded when using GeekTool or similar. The screen
argument must be non-nil when setting a custom grid frame.hs.grid
module for method chaininghs.grid.setMargins(margins) -> hs.grid
hs.geometry
point or size, or argument to construct one, indicating the desired margins between windows in screen pointshs.grid
module for method chaininghs.grid.show([exitedCallback][, multipleWindows])
true
, the resizing grid won't automatically go away after selecting the desired cells for the frontmost window; instead, it'll switch to the next windowtab
or shift-tab
in the modal interface will cycle to the next or previous window; if multipleWindows
is false or omitted, the first press will just enable the multiple windows behaviourhs.grid.HINTS
accordinglyhs.grid.HINTS
depending on your requirements. See note in HINTS
.hs.grid.snap(win) -> hs.grid
hs.window
object to snaphs.grid
module for method chaininghs.grid.toggleShow([exitedCallback][, multipleWindows])
hs.grid.show()
and hs.grid.hide()
true
, the resizing grid won't automatically go away after selecting the desired cells for the frontmost window; instead, it'll switch to the next window