this repo has no description
0
fork

Configure Feed

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

hammerspoon: fmt and shuffling

+43 -19
+43 -19
hammerspoon/init.lua
··· 1 1 local appBindings = { 2 - ["1"] = "Helium", 3 - ["2"] = "Ghostty", 2 + ["1"] = "Ghostty", 3 + ["2"] = "Helium", 4 4 ["3"] = "Slack", 5 5 ["4"] = "Mail", 6 6 ["5"] = "Messages", 7 7 ["6"] = "Zoom.us", 8 8 ["8"] = "Spotify", 9 - ["9"] = "Obsidian", 10 - ["0"] = "Todoist", 9 + ["9"] = "Todoist", 10 + ["0"] = "Obsidian", 11 11 } 12 12 13 13 for key, app in pairs(appBindings) do ··· 25 25 26 26 local function moveWindow(fn) 27 27 local win = hs.window.focusedWindow() 28 - if not win then return end 28 + if not win then 29 + return 30 + end 29 31 local screen = win:screen():frame() 30 32 fn(win, screen) 31 33 end 32 34 33 35 local windowBindings = { 34 - h = function(w, s) w:setFrame({ x = s.x, y = s.y, w = s.w / 2, h = s.h }) end, 35 - l = function(w, s) w:setFrame({ x = s.x + s.w / 2, y = s.y, w = s.w / 2, h = s.h }) end, 36 - Return = function(w, s) w:setFrame(s) end, 37 - u = function(w, s) w:setFrame({ x = s.x, y = s.y, w = s.w / 2, h = s.h / 2 }) end, 38 - i = function(w, s) w:setFrame({ x = s.x + s.w / 2, y = s.y, w = s.w / 2, h = s.h / 2 }) end, 39 - j = function(w, s) w:setFrame({ x = s.x, y = s.y + s.h / 2, w = s.w / 2, h = s.h / 2 }) end, 40 - k = function(w, s) w:setFrame({ x = s.x + s.w / 2, y = s.y + s.h / 2, w = s.w / 2, h = s.h / 2 }) end, 36 + h = function(w, s) 37 + w:setFrame({ x = s.x, y = s.y, w = s.w / 2, h = s.h }) 38 + end, 39 + l = function(w, s) 40 + w:setFrame({ x = s.x + s.w / 2, y = s.y, w = s.w / 2, h = s.h }) 41 + end, 42 + Return = function(w, s) 43 + w:setFrame(s) 44 + end, 45 + u = function(w, s) 46 + w:setFrame({ x = s.x, y = s.y, w = s.w / 2, h = s.h / 2 }) 47 + end, 48 + i = function(w, s) 49 + w:setFrame({ x = s.x + s.w / 2, y = s.y, w = s.w / 2, h = s.h / 2 }) 50 + end, 51 + j = function(w, s) 52 + w:setFrame({ x = s.x, y = s.y + s.h / 2, w = s.w / 2, h = s.h / 2 }) 53 + end, 54 + k = function(w, s) 55 + w:setFrame({ x = s.x + s.w / 2, y = s.y + s.h / 2, w = s.w / 2, h = s.h / 2 }) 56 + end, 41 57 } 42 58 43 59 for key, fn in pairs(windowBindings) do 44 - hs.hotkey.bind({ "ctrl", "alt" }, key, function() moveWindow(fn) end) 60 + hs.hotkey.bind({ "ctrl", "alt" }, key, function() 61 + moveWindow(fn) 62 + end) 45 63 end 46 64 47 65 -- Cycling window positions (thirds and 2/3rds) ··· 50 68 -- g: 1/3 width, cycles right → middle → left 51 69 hs.hotkey.bind({ "ctrl", "alt" }, "g", function() 52 70 local win = hs.window.focusedWindow() 53 - if not win then return end 71 + if not win then 72 + return 73 + end 54 74 local s = win:screen():frame() 55 75 local positions = { 56 76 { x = s.x + s.w * 2 / 3, y = s.y, w = s.w / 3, h = s.h }, 57 - { x = s.x + s.w / 3, y = s.y, w = s.w / 3, h = s.h }, 58 - { x = s.x, y = s.y, w = s.w / 3, h = s.h }, 77 + { x = s.x + s.w / 3, y = s.y, w = s.w / 3, h = s.h }, 78 + { x = s.x, y = s.y, w = s.w / 3, h = s.h }, 59 79 } 60 80 cycleState.g = (cycleState.g % #positions) + 1 61 81 win:setFrame(positions[cycleState.g]) ··· 64 84 -- e: 2/3 width, cycles left → right 65 85 hs.hotkey.bind({ "ctrl", "alt" }, "e", function() 66 86 local win = hs.window.focusedWindow() 67 - if not win then return end 87 + if not win then 88 + return 89 + end 68 90 local s = win:screen():frame() 69 91 local positions = { 70 - { x = s.x, y = s.y, w = s.w * 2 / 3, h = s.h }, 92 + { x = s.x, y = s.y, w = s.w * 2 / 3, h = s.h }, 71 93 { x = s.x + s.w / 3, y = s.y, w = s.w * 2 / 3, h = s.h }, 72 94 } 73 95 cycleState.e = (cycleState.e % #positions) + 1 ··· 80 102 local volumeAlertId = nil 81 103 82 104 local function showVolumeAlert(vol) 83 - if volumeAlertId then hs.alert.closeSpecific(volumeAlertId) end 105 + if volumeAlertId then 106 + hs.alert.closeSpecific(volumeAlertId) 107 + end 84 108 volumeAlertId = hs.alert.show("Volume: " .. math.floor(vol) .. "%") 85 109 end 86 110