diff options
author | Jesse Luehrs <doy@stripe.com> | 2021-03-02 10:52:02 -0800 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-03-02 13:55:29 -0500 |
commit | 12e9b9c0cb462e77cdf450d9616d9860ead7867e (patch) | |
tree | 062e4f0f4db30a6c5fdc2aacc7b54024289c2bde | |
parent | 6f1a9da97d46468ada900dbc4033f0ea6995258a (diff) | |
download | conf-12e9b9c0cb462e77cdf450d9616d9860ead7867e.tar.gz conf-12e9b9c0cb462e77cdf450d9616d9860ead7867e.zip |
use the hammerspoon spaces module
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.st-doy2 | 6 | ||||
-rw-r--r-- | hammerspoon/init.lua | 12 | ||||
m--------- | hammerspoon/src/spaces | 0 |
5 files changed, 17 insertions, 5 deletions
@@ -1,5 +1,6 @@ /config/alacritty/alacritty.yml /config/darksky/api +/hammerspoon/hs /local/share/fortune/*.dat /less /mpdscribble/mpdscribble.conf diff --git a/.gitmodules b/.gitmodules index 6138d43..19a2de8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -82,3 +82,6 @@ [submodule "vim/pack/filetype/start/terraform"] path = vim/pack/filetype/start/terraform url = git://github.com/hashivim/vim-terraform +[submodule "hammerspoon/src/spaces"] + path = hammerspoon/src/spaces + url = git://github.com/asmagill/hs._asm.undocumented.spaces diff --git a/Makefile.st-doy2 b/Makefile.st-doy2 index d4b3106..e7bd455 100644 --- a/Makefile.st-doy2 +++ b/Makefile.st-doy2 @@ -10,7 +10,11 @@ EMPTYDIRS := \ INSTALL_CUSTOM := \ BUILD := \ - config/alacritty/alacritty.yml + config/alacritty/alacritty.yml \ + hammerspoon/hs/_asm/undocumented/spaces/internal.so config/alacritty/alacritty.yml : config/alacritty/alacritty.yml.st-doy2 $(LN) $(notdir $<) $@ + +hammerspoon/hs/_asm/undocumented/spaces/internal.so : + cd hammerspoon/src/spaces && PREFIX=$(HOME)/conf/hammerspoon make install 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 +Subproject 25aecf2c48eb72afbd76abc00d9f6edadeca280 |