https://github.com/tuanpham-dev/spaceman
https://github.com/tuanpham-dev/spaceman
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tuanpham-dev/spaceman
- Owner: tuanpham-dev
- License: mit
- Created: 2022-12-22T06:07:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-22T06:59:42.000Z (over 3 years ago)
- Last Synced: 2025-03-06T19:41:44.650Z (over 1 year ago)
- Language: Lua
- Size: 4.88 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Space Manager
This [Hammerspoon](http://www.hammerspoon.org/) config enhances MacOS mission control by providing more functionalities for using keyboard (without mouse) to work with spaces. They are:
* Workspace switcher wrap around.
* Add/Remove workspace.
* Move focused window to a space.
* Move mouse to a monitor.
* Space indicator in menubar or OSD.
## Prerequisites
* [Hammerspoon](http://www.hammerspoon.org/) must be installed.
* Keyboard shortcut for Mission Control -> Move left a space and Move right a space must be default as Control–Left Arrow (⌃←) and Control–Right Arrow (⌃→).
## Usage
- Download and copy `utils.lua`, `spaces.lua` and `space-indicator.lua` in `dot-hammerspoon` to your `~/.hammerspoon`.
- Append content of `dot-hammerspoon/init.lua` to your `~/.hammerspoon/init.lua`.
Default keyboard shortcuts are:
| Command | hotkey |
|-------------------------------|--------|
| Move left a space | ⌘⌃← |
| Move right a space | ⌘⌃→ |
| Insert a space | ⌘⌃↓ |
| Remove last space | ⌘⌃↑ |
| Move window to left space | ⌘⌃⇧← |
| Move window to right space | ⌘⌃⇧→ |
| Move mouse to previous screen | ⌘⌥⇧↑ |
| Move mouse to next screen | ⌘⌥⇧↓ |
| Start Space Indicator | ⌘⌃⌥⇧S |
## Customization
To set diferent hotkey you can change the value of `spaces.hotkeys[function]`. For example this bind ⌘⌥← to Move left a space and ⌘⌥→ to Move right a space.
```lua
local spaces = require('spaces')
local spaceIndicator = require('space-indicator')
spaces.hotkeys.moveLeftSpace = { mods = {'cmd', 'alt'}, key = 'left' }
spaces.hotkeys.moveLeftSpace = { mods = {'cmd', 'alt'}, key = 'right' }
spaces.insertRemoveSpaceCallback = spaceIndicator.render
spaces.init()
spaceIndicator.init()
```
To add more hotkey to a function you can do something like this:
```lua
...
hs.hotkey.bind({'cmd', 'alt', 'shift'}, 'left', spaces.moveMouseToPreviousScreen)
hs.hotkey.bind({'cmd', 'alt', 'shift'}, 'left', spaces.moveMouseToNextScreen)
...
```
## Reference
Full list of function of spaces module
| Function Name |
|---------------------------|
| moveLeftSpace |
| moveRightSpace |
| insertSpace |
| removeSpace |
| moveWindowToLeftSpace |
| moveWindowToRightSpace |
| moveMouseToPreviousScreen |
| moveMouseToNextScreen |