From 12e9b9c0cb462e77cdf450d9616d9860ead7867e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 2 Mar 2021 10:52:02 -0800 Subject: use the hammerspoon spaces module --- hammerspoon/init.lua | 12 ++++++++---- hammerspoon/src/spaces | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) create mode 160000 hammerspoon/src/spaces (limited to 'hammerspoon') diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index c68ca8d..3b38695 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -3,6 +3,8 @@ spoon.ReloadConfiguration:start() hs.loadSpoon("SpeedMenu") +spaces = require("hs._asm.undocumented.spaces") + -- apparently hs.eventtap.keyStroke doesn't always work, this is more reliable -- https://github.com/Hammerspoon/hammerspoon/issues/1984#issuecomment-455317739 doKeyStroke = function(modifiers, character) @@ -60,13 +62,15 @@ end) for i = 1, 6 do hs.hotkey.bind({"alt"}, tostring(i), function() - doKeyStroke({"ctrl"}, tostring(i)) + id = spaces.layout()[spaces.mainScreenUUID()][i] + spaces.changeToSpace(id) + end) + hs.hotkey.bind({"alt", "shift"}, tostring(i), function() + id = spaces.layout()[spaces.mainScreenUUID()][i] + hs.window.focusedWindow():spacesMoveTo(id) end) end --- bindings for window movement are handled by amethyst, since hammerspoon --- doesn't support that well - extra_bindings = { ["Alacritty"] = hs.hotkey.modal.new(), ["Google Chrome"] = hs.hotkey.modal.new(), diff --git a/hammerspoon/src/spaces b/hammerspoon/src/spaces new file mode 160000 index 0000000..25aecf2 --- /dev/null +++ b/hammerspoon/src/spaces @@ -0,0 +1 @@ +Subproject commit 25aecf2c48eb72afbd76abc00d9f6edadeca2805 -- cgit v1.2.3-54-g00ecf