-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Deeb-Swihart
committed
Apr 18, 2020
1 parent
651265c
commit 3d6bcf6
Showing
8 changed files
with
98 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function reloadConfig(files) | ||
doReload = false | ||
for _,file in pairs(files) do | ||
if file:sub(-4) == ".lua" then | ||
doReload = true | ||
end | ||
end | ||
if doReload then | ||
hs.reload() | ||
end | ||
end | ||
myWatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start() | ||
hs.alert.show("Config loaded") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- ~/.hammerspoon/usb.lua | ||
local module = {} | ||
module.watcher = nil | ||
|
||
function usbDeviceCallback(data) | ||
pn = data["productName"] | ||
evt = data["eventType"] | ||
if (pn == "Schiit Modi 3") then | ||
if evt == "added" then | ||
dac = hs.audiodevice.findOutputByName(pn) | ||
if dac ~= nil then | ||
dac:setDefaultOutputDevice() | ||
end | ||
end | ||
elseif (pn == "Blue Snowball ") then | ||
if evt == "added" then | ||
mic = hs.audiodevice.findAudioDeviceByName(pn) | ||
if mic ~= nil then | ||
mic:setDefaultInputDevice() | ||
end | ||
end | ||
end | ||
end | ||
|
||
module.watcher = hs.usb.watcher.new(usbDeviceCallback) | ||
module.watcher:start() | ||
return module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local module = {} | ||
module.watcher = nil | ||
local homeSSID = "chrowireless" | ||
local lastSSID = hs.wifi.currentNetwork() | ||
|
||
function ssidChangedCallback() | ||
newSSID = hs.wifi.currentNetwork() | ||
|
||
if newSSID == homeSSID and lastSSID ~= homeSSID then | ||
-- We just joined our home WiFi network | ||
hs.audiodevice.defaultOutputDevice():setVolume(25) | ||
elseif newSSID ~= homeSSID and lastSSID == homeSSID then | ||
-- We just departed our home WiFi network | ||
hs.audiodevice.defaultOutputDevice():setVolume(0) | ||
end | ||
|
||
lastSSID = newSSID | ||
end | ||
|
||
module.watcher = hs.wifi.watcher.new(ssidChangedCallback) | ||
module.watcher:start() | ||
return module |