From ceabbe3c927acf6dcb04f3f32b42c88068644f5f Mon Sep 17 00:00:00 2001 From: Lukas Cech Date: Thu, 30 Jan 2025 09:34:16 +0100 Subject: [PATCH] Fix loading spoons --- home-manager/hammerspoon/window-move.lua | 26 +++++++++++++--------- home-manager/hammerspoon/window-tiling.lua | 7 +++--- home-manager/lcech-mac-veracode.nix | 1 + 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/home-manager/hammerspoon/window-move.lua b/home-manager/hammerspoon/window-move.lua index b098ced..acce2a4 100644 --- a/home-manager/hammerspoon/window-move.lua +++ b/home-manager/hammerspoon/window-move.lua @@ -1,15 +1,21 @@ -(function() - local hyper = { "ctrl", "alt", "cmd" } - +windowMove = function() -- move window to next screen - hs.hotkey.bind(hyper, "N", function() + hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "N", function() local win = hs.window.focusedWindow() win:moveToScreen(win:screen():next()) end) - for i = 1, 3 do - hs.hotkey.bind(hyper, "pad" .. i, function() - hs.window.focusedWindow():moveToScreen(i) - end) - end -end)() + + -- Windows seem to be indexed by primary screen first + hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function() + hs.window.focusedWindow():moveToScreen(hs.screen.allScreens()[3]) + end) + hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad2", function() + hs.window.focusedWindow():moveToScreen(hs.screen.allScreens()[1]) + end) + hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad3", function() + hs.window.focusedWindow():moveToScreen(hs.screen.allScreens()[2]) + end) +end + +windowMove() diff --git a/home-manager/hammerspoon/window-tiling.lua b/home-manager/hammerspoon/window-tiling.lua index bf53599..213836b 100644 --- a/home-manager/hammerspoon/window-tiling.lua +++ b/home-manager/hammerspoon/window-tiling.lua @@ -1,4 +1,4 @@ -(function() +windowTiling =function() hs.window.animationDuration = 0 hs.window.setShadows(false) local hyper = { "ctrl", "alt", "cmd" } @@ -147,7 +147,6 @@ end wm:init() +end - hs.notify.show("Welcome to Hammerspoon", "Have fun!", "") - -end)() +windowTiling() diff --git a/home-manager/lcech-mac-veracode.nix b/home-manager/lcech-mac-veracode.nix index a9b068c..4aada14 100644 --- a/home-manager/lcech-mac-veracode.nix +++ b/home-manager/lcech-mac-veracode.nix @@ -43,6 +43,7 @@ in "${homedir}/.hammerspoon/init.lua" = { text = '' ${builtins.readFile ./hammerspoon/window-tiling.lua} + ${builtins.readFile ./hammerspoon/window-move.lua} ''; };