Skip to content

Commit

Permalink
Merge pull request #210 from mr-mustash/u/pking/fixing_hammerspoon
Browse files Browse the repository at this point in the history
Fixing Hammerspoon:
  • Loading branch information
mr-mustash authored Nov 8, 2024
2 parents 4f114b8 + 7c16446 commit 495865a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions tilde/.hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ menubarLargeStyle = { font = { name = "DejaVuSansMono Nerd Font Mono", size = 20

defaultStyle = { font = { name = ".AppleSystemUIFont", size = 13 } }

Homedir = os.getenv( "HOME" )

-- ========================================================================= }}}
-- Important functions ===================================================== {{{
run = require("functions/run")
Expand Down
8 changes: 5 additions & 3 deletions tilde/.hammerspoon/spoon-config/urls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ function urls.init()
spoon.URLDispatcher.url_patterns = {
{"https://captive.apple.com/", builtin},
{"https?://%w+.beatsense.com", builtin},
{"https?://%w+.twitter.com/", builtin},
{"https?://%w+.zoom.us/j/", meetings},
{"https?://%w+.tiktok.com", builtin},
{"https?://%w+.twitter.com/", builtin},
{"https?://%w+.w2g.tv", builtin},
{"https?://%w+.x.com/", builtin},
{"https?://%w+.zoom.us/j/", meetings},
{"https?://meet.google.com", builtin},
{"https?://tiktok.com", builtin},
{"https?://twitter.com/", builtin},
{"https?://w2g.tv", builtin},
{"https?://www.beatsense.com", builtin},
{"https?://x.com/", builtin},
{"https?://zoom.us/j/", meetings},
}

Expand Down
8 changes: 4 additions & 4 deletions tilde/.hammerspoon/system/audioControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ local function trapVolumeControls()

-- Send volume up to external monitor if connected and it's the default audio output
if event["key"] == "SOUND_UP" then
run.cmd("/Users/patrickking/bin/m1ddc", { "chg", "volume", "+5" })
run.cmd(string.format("%s/bin/m1ddc", Homedir), { "chg", "volume", "+5" })
return true
end
if event["key"] == "SOUND_DOWN" then
run.cmd("/Users/patrickking/bin/m1ddc", { "chg", "volume", "-5" })
run.cmd(string.format("%s/bin/m1ddc", Homedir), { "chg", "volume", "-5" })
return true
end
end
Expand Down Expand Up @@ -186,7 +186,7 @@ end
function audioControl.muteOutputs()
for _, device in pairs(hs.audiodevice.allOutputDevices()) do
if device:name() == secrets.audioControl.monitorOutput then
run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "on" })
run.cmd(string.format("%s/bin/m1ddc", Homedir), { "set", "mute", "on" })
_log("External display " .. device:name() .. " muted")
return
end
Expand All @@ -201,7 +201,7 @@ end
function audioControl.unmuteOutputs()
for _, device in pairs(hs.audiodevice.allOutputDevices()) do
if device:name() == secrets.audioControl.monitorOutput then
run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "off" })
run.cmd(string.format("%s/bin/m1ddc", Homedir), { "set", "mute", "off" })
_log("External display " .. device:name() .. " unmuted")
return
end
Expand Down
2 changes: 1 addition & 1 deletion tilde/.hammerspoon/system/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function display.setAllBrightness(brightness)
else
_log("Setting " .. display:name() .. " brightness to " .. brightness)
-- Use ddcctl to set the brightness of all external displays
run.cmd("/Users/patrickking/bin/m1ddc", {"set", "luminance", tostring(brightness)})
run.cmd(string.format("%s/bin/m1ddc", Homedir), {"set", "luminance", tostring(brightness)})
end
end
end
Expand Down

0 comments on commit 495865a

Please sign in to comment.