99 lines
3.2 KiB
Lua
99 lines
3.2 KiB
Lua
-- ~/.hammerspoon/init.lua
|
|
-- Load Config First
|
|
-- config = require("Config")
|
|
--
|
|
-- Load your HyperKey
|
|
require("HyperKey")
|
|
|
|
require('SearchWindows')
|
|
require('Caffeine')
|
|
require('AppBorders')
|
|
require('LayoutSelector')
|
|
require('System_Tweaks') -- Used for Time Machine Throttle Disable
|
|
-- require("Focus") -- Does not work with layout saver - Not needed if using Monocle
|
|
Network = require("NetworkCenter")
|
|
|
|
-- Load the window management module
|
|
local windowMgr = require("WindowManager")
|
|
local productivity = require("productivity")
|
|
|
|
-- For Affine
|
|
local quickNote = require("affine_quick_note")
|
|
quickNote.init()
|
|
require("affine_clipper"):init()
|
|
---
|
|
-- Load Google API Monitor
|
|
-- local googleMonitor = require("google_monitor")
|
|
-- googleMonitor.init()
|
|
--
|
|
|
|
-- Load Spoon Files
|
|
hs.loadSpoon('SpoonInstall')
|
|
hs.loadSpoon('SpeedMenu')
|
|
hs.loadSpoon('BrewInfo')
|
|
-- hs.loadSpoon('Seal')
|
|
|
|
--- 3. Run/Configure Spoons
|
|
|
|
---- SpeedMenu Config
|
|
if spoon.SpeedMenu then
|
|
-- 1. Define the Fix Function (includes MAC and IPv6)
|
|
local function applyFullMenuFix()
|
|
local interface = spoon.SpeedMenu.interface or "en0"
|
|
local ssid = hs.wifi.currentNetwork() or "Disconnected"
|
|
local details = hs.network.interfaceDetails(interface)
|
|
|
|
local ipv4 = (details and details.IPv4) and details.IPv4.Addresses[1] or "N/A"
|
|
local ipv6 = (details and details.IPv6) and details.IPv6.Addresses[1] or "N/A"
|
|
|
|
-- Get MAC Address via shell
|
|
local macaddr = hs.execute('ifconfig ' .. interface .. ' | grep ether | awk \'{print $2}\''):gsub("%s+", "")
|
|
|
|
local menuitems = {
|
|
{ title = "SSID: " .. ssid, fn = function() hs.pasteboard.setContents(ssid) end },
|
|
{ title = "IPv4: " .. ipv4, fn = function() hs.pasteboard.setContents(ipv4) end },
|
|
{ title = "IPv6: " .. ipv6, fn = function() hs.pasteboard.setContents(ipv6) end },
|
|
{ title = "MAC: " .. macaddr, fn = function() hs.pasteboard.setContents(macaddr) end },
|
|
{ title = "-" },
|
|
{ title = "Rescan Network Interfaces", fn = function() spoon.SpeedMenu:rescan() end }
|
|
}
|
|
spoon.SpeedMenu.menubar:setMenu(menuitems)
|
|
end
|
|
|
|
-- 2. Hook the rescan method
|
|
local oldRescan = spoon.SpeedMenu.rescan
|
|
spoon.SpeedMenu.rescan = function(self)
|
|
oldRescan(self)
|
|
applyFullMenuFix()
|
|
end
|
|
|
|
-- 3. Toggle Logic (Starts as OFF)
|
|
local speedMenuRunning = false
|
|
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
|
|
if speedMenuRunning then
|
|
spoon.SpeedMenu:stop()
|
|
hs.alert.show("SpeedMenu Stopped")
|
|
else
|
|
spoon.SpeedMenu:start() -- This puts it in the menu bar
|
|
applyFullMenuFix() -- This populates the data
|
|
hs.alert.show("SpeedMenu Started")
|
|
end
|
|
speedMenuRunning = not speedMenuRunning
|
|
end)
|
|
end
|
|
---- SpeedMenu Config END
|
|
|
|
---- BrewInfo
|
|
if spoon.BrewInfo then
|
|
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "I", function()
|
|
spoon.BrewInfo:showBrewInfo()
|
|
end)
|
|
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "J", function()
|
|
spoon.BrewInfo:showBrewInfoCurSel()
|
|
end)
|
|
end
|
|
---- BrewInfo END
|
|
|
|
-- Add this line to the module section of your init.lua
|
|
|
|
hs.alert.show("Hammerspoon Config Reloaded") |