docs » ArrangeDesktop

Easily create, save, and use desktop arrangements.

Positioning logic adapted from https://github.com/dploeger/hammerspoon-window-manager

API Overview

API Documentation

Variables

arrangements
Signature ArrangeDesktop.arrangements
Type Variable
Description Contains the configured desktop arrangements
Source Source/ArrangeDesktop.spoon/init.lua line 21
configFile
Signature ArrangeDesktop.configFile
Type Variable
Description Defines where the config file is stored. Defaults to hs.spoons.scriptPath()/config.json
Source Source/ArrangeDesktop.spoon/init.lua line 26
logger
Signature ArrangeDesktop.logger
Type Variable
Description Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.
Source Source/ArrangeDesktop.spoon/init.lua line 16

Functions

_buildArrangement
Signature ArrangeDesktop._buildArrangement() -> table
Type Function
Description Builds the configuration for the current desktop arrangement.
Parameters
  • None
Returns
  • A table containing the configuration data for the current desktop arrangement
Source Source/ArrangeDesktop.spoon/init.lua line 72
_loadConfiguration
Signature ArrangeDesktop._loadConfiguration() -> table or nil
Type Function
Description Loads the configuration file.
Parameters
  • None
Returns
  • A table containing the configured desktop arrangements, or nil if an error occurred
Source Source/ArrangeDesktop.spoon/init.lua line 31
_positionApp
Signature ArrangeDesktop._positionApp(app, appTitle, screen, frame)
Type Function
Description Positions all windows for an application based on the given configuration.
Parameters
  • app - A table of the application instance
  • appTitle - The name of the application, e.g., Slack, Firefox, etc.
  • screen - A table of the position of the screen (x, y integer pair) to place the application window into
  • frame - A table of the frame details for the application window, e.g., {w=12, h=12, x=12, y=12}
Returns
Source Source/ArrangeDesktop.spoon/init.lua line 113
_writeConfiguration
Signature ArrangeDesktop._writeConfiguration(config) -> bool
Type Function
Description Writes the configuration to a file.
Parameters
  • config - A table containing the configuration to write
Returns
  • A boolean indicating if the write was successful
Source Source/ArrangeDesktop.spoon/init.lua line 59

Methods

addMenuItems
Signature ArrangeDesktop:addMenuItems(menuItems) -> table
Type Method
Description Add menu items to a table for each configured desktop arrangement.
Parameters
  • menuItems - A table of menu items to append to
Returns
  • A table of menu items
Source Source/ArrangeDesktop.spoon/init.lua line 154
arrange
Signature ArrangeDesktop:arrange(arrangement)
Type Method
Description Arrange the desktop based on a given configuration
Parameters
  • arrangement - A table of arrangement data
Returns
Source Source/ArrangeDesktop.spoon/init.lua line 135
createArrangement
Signature ArrangeDesktop:createArrangement()
Type Method
Description Creates the desktop arrangement and saves it to the configuration file.
Parameters
  • None
Returns
Source Source/ArrangeDesktop.spoon/init.lua line 186