docs » Spacer

Name and switch Mission Control spaces in the menu bar, with fullscreen support!

Download: Spacer.spoon.zip

README: README.md

Space names can be changed from the menubar by holding Alt while selecting the desired space to rename. These are persisted between launches via the hs.settings module.

A GUI based space "chooser" can be opened space_chooser hotkey (default cmd+space)

Current application can be put in fullscreen to the left of the current space via the toggle_fullscreen_window_to_left hotkey (default cmd+shift+f)

API Overview

API Documentation

Constants

settingsKey
Signature Spacer.settingsKey
Type Constant
Description

Key used for persisting space names between Hammerspoon launches via hs.settings.

Source Source/Spacer.spoon/init.lua line 27

Variables

defaultHotkeys
Signature Spacer.defaultHotkeys
Type Variable
Description

Default hotkey to use for the space chooser and fullscreen

Source Source/Spacer.spoon/init.lua line 37
delayedWindowClickTimer
Signature Spacer.delayedWindowClickTimer
Type Variable
Description

hs.timer used in fullscreenWindowToLeft to perform a delayed left click.

Source Source/Spacer.spoon/init.lua line 110
exitFullScreenKeystroke
Signature Spacer.exitFullScreenKeystroke
Type Variable
Description

Keystroke representing shortcut to exit a full screen application. Defaults to

Source Source/Spacer.spoon/init.lua line 56
focusedSpace
Signature Spacer.focusedSpace
Type Variable
Description

int with the ID of the currently focused space.

Source Source/Spacer.spoon/init.lua line 100
logger
Signature Spacer.logger
Type Variable
Description

Logger object used within the Spoon. Can be accessed to set the default log

Source Source/Spacer.spoon/init.lua line 62
logLevel
Signature Spacer.logLevel
Type Variable
Description

Spacer specific log level override, see hs.logger.setLogLevel for options.

Source Source/Spacer.spoon/init.lua line 68
orderedSpaceNames
Signature Spacer.orderedSpaceNames
Type Variable
Description

Table with an ordered list of the space names, which is used when loading

Source Source/Spacer.spoon/init.lua line 94
orderedSpaces
Signature Spacer.orderedSpaces
Type Variable
Description

Table holding an ordered list of space IDs, which is then used to resolve

Source Source/Spacer.spoon/init.lua line 88
spaceChooser
Signature Spacer.spaceChooser
Type Variable
Description

hs.chooser object representing the Space chooser.

Source Source/Spacer.spoon/init.lua line 105
spaceNames
Signature Spacer.spaceNames
Type Variable
Description

Table with key-value mapping of Space ID to it's user set name.

Source Source/Spacer.spoon/init.lua line 83
spaceWatcher
Signature Spacer.spaceWatcher
Type Variable
Description

hs.spaces.watcher instance used for monitoring for space changes.

Source Source/Spacer.spoon/init.lua line 78
tilingMenuItem
Signature Spacer.tilingMenuItem
Type Variable
Description

Menu item for tiling window to the left. Set this according to your language.

Source Source/Spacer.spoon/init.lua line 51
tilingMenuSection
Signature Spacer.tilingMenuSection
Type Variable
Description

Menu "section" which has tiling options. Set this according to your language.

Source Source/Spacer.spoon/init.lua line 46

Methods

exitFullscreen
Signature Spacer:exitFullscreen(window)
Type Method
Description

Exit fullscreen on window.

Parameters
  • None
Returns
  • None
Notes
  • This presses the keystroke cmd+ctrl+f by default, which should work globally
    • Configurable via exitFullscreenKeystroke
Source Source/Spacer.spoon/init.lua line 526
fullscreenWindowToLeft
Signature Spacer:fullscreenWindowToLeft(app)
Type Method
Description

Fullscreen app's focused window to the left of current space.

Parameters
  • app - hs.application to fullscreen
Returns
  • None
Notes
  • Attempts to select Window -> Tile Window to Left of Screen in app menu
    • Manually configurable via tilingMenuSection and tilingMenuItem
  • If this doesn't work, it will manually macro the OS flow for this
    • Show the menu for the green resize button in the top left
    • Press Down, Down, and Return to select Tile Window to Left of Screen
  • Clicks around the top-left of the current screen to exit tiling and fullscreen
  • Returns mouse to original position
  • All credit for this goes to clay_golem on Apple StackExchange
    • https://apple.stackexchange.com/posts/462160/revisions
Source Source/Spacer.spoon/init.lua line 495
init
Signature Spacer:init()
Type Method
Description

Spoon initializer method for Spacer.

Parameters
  • None
Returns
  • None
Source Source/Spacer.spoon/init.lua line 600
start
Signature Spacer:start()
Type Method
Description

Spoon start method for Spacer. Creates/starts menu bar item and space watcher.

Parameters
  • None
Returns
  • None
Source Source/Spacer.spoon/init.lua line 614
stop
Signature Spacer:stop()
Type Method
Description

Spoon stop method for Spacer. Deletes menu bar item and stops space watcher.

Parameters
  • None
Returns
  • None
Source Source/Spacer.spoon/init.lua line 659
toggleFullscreenWindowToLeft
Signature Spacer:toggleFullscreenWindowToLeft()
Type Method
Description

Toggle the fullscreen state of current window to left of space.

Parameters
  • args - Args provided to hs CLI after "--" via _cli.args.
Returns
  • None
Notes
  • This is bound by default to Cmd+Shift+F and will call fullscreenWindowToLeft or exitFullscreen based on the current fullscreen state of the application.
Source Source/Spacer.spoon/init.lua line 458