Dotfiles managed with Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(configs): add hammerspoon

+93
+84
config/hammerspoon/init.lua
··· 1 + ---@diagnostic disable: undefined-global 2 + 3 + local top_padding = 40 4 + 5 + local center_tall = function() 6 + local win = hs.window.focusedWindow() 7 + local f = win:frame() 8 + local screen = win:screen() 9 + local max = screen:frame() 10 + 11 + f.w = 3 * max.w / 5 12 + f.h = max.h - top_padding 13 + win:setFrame(f) 14 + win:centerOnScreen() 15 + f = win:frame() 16 + f.y = f.y + 10 17 + win:setFrame(f) 18 + end 19 + 20 + local center = function() 21 + local win = hs.window.focusedWindow() 22 + local f = win:frame() 23 + local screen = win:screen() 24 + local max = screen:frame() 25 + 26 + f.w = 3 * max.w / 5 27 + f.h = max.h / 1.5 28 + win:setFrame(f) 29 + win:centerOnScreen() 30 + end 31 + 32 + hs.hotkey.bind({ "alt", "shift" }, "G", function() 33 + center_tall() 34 + end) 35 + 36 + hs.hotkey.bind({ "alt", "shift" }, "C", function() 37 + center() 38 + end) 39 + 40 + hs.hotkey.bind({ "alt", "ctrl", "shift" }, "R", function() 41 + hs.reload() 42 + end) 43 + 44 + -- Bind Command + ` (Backtick) to cycle windows of the same app 45 + hs.hotkey.bind({ "alt", "shift" }, "N", function() 46 + local win = hs.window.focusedWindow() 47 + if not win then 48 + return 49 + end 50 + 51 + local app = win:application() 52 + local appWindows = app:allWindows() 53 + 54 + -- 1. Filter for standard, visible windows 55 + local validWindows = {} 56 + for _, w in ipairs(appWindows) do 57 + if w:isStandard() and w:isVisible() then 58 + table.insert(validWindows, w) 59 + end 60 + end 61 + 62 + if #validWindows < 2 then 63 + return 64 + end 65 + 66 + -- 2. SORT the windows by ID to ensure a stable loop order 67 + table.sort(validWindows, function(a, b) 68 + return a:id() < b:id() 69 + end) 70 + 71 + -- 3. Find current index in the sorted list 72 + local currentIndex = 0 73 + for i, w in ipairs(validWindows) do 74 + if w:id() == win:id() then 75 + currentIndex = i 76 + break 77 + end 78 + end 79 + 80 + -- 4. Calculate next index and focus 81 + local nextIndex = (currentIndex % #validWindows) + 1 82 + validWindows[nextIndex]:focus() 83 + end) 84 + hs.alert.show("Config loaded")
+9
configs.nix
··· 27 27 28 28 alacritty = { }; 29 29 ghostty = { }; 30 + hammerspoon = { 31 + configDir = false; 32 + paths = [ 33 + { 34 + src = "init.lua"; 35 + dest = ".hammerspoon/init.lua"; 36 + } 37 + ]; 38 + }; 30 39 helix = { active = false; }; 31 40 karabiner = { }; 32 41 kitty = { active = false;};