feat: daedalus brew
This commit is contained in:
parent
b744693f0e
commit
c39f8252f7
8 changed files with 159 additions and 38 deletions
|
|
@ -2,13 +2,33 @@
|
|||
with lib;
|
||||
with lib.my;
|
||||
{
|
||||
networking.hostName = "daedalus";
|
||||
|
||||
users.users.ragon = {
|
||||
name = "ragon";
|
||||
home = "/Users/ragon";
|
||||
};
|
||||
|
||||
homebrew = {
|
||||
enable = true;
|
||||
autoUpdate = true;
|
||||
casks = [ "hammerspoon" "amethyst" "android-platform-tools" "alfred" "ukelele" "homebrew/cask-drivers/zsa-wally" ];
|
||||
masApps = { # Install Mac App Store apps (install them manually and then do `mas list` to get the id)
|
||||
"AdGuard for Safari" = 1440147259;
|
||||
"Xcode" = 497799835;
|
||||
"Home Assistant" = 1099568401;
|
||||
"WireGuard" = 1451685025;
|
||||
"UTM" = 1538878817;
|
||||
"Bitwarden" = 1352778147;
|
||||
"Shareful" = 1522267256;
|
||||
"Tailscale" = 1475387142;
|
||||
};
|
||||
};
|
||||
|
||||
programs.gnupg.agent.enable = true;
|
||||
home-manager.users.ragon = { pkgs, lib, inputs, config, ... }: {
|
||||
home.file.".hammerspoon/init.lua".source = ./hammerspoon.lua;
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
|
|
|
|||
95
hosts/daedalus/hammerspoon.lua
Normal file
95
hosts/daedalus/hammerspoon.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
----------------------------------------------------------------------------------------------------
|
||||
-- Settings
|
||||
----------------------------------------------------------------------------------------------------
|
||||
hs.autoLaunch(true)
|
||||
hs.automaticallyCheckForUpdates(true)
|
||||
hs.consoleOnTop(true)
|
||||
hs.dockIcon(false)
|
||||
hs.menuIcon(false)
|
||||
hs.uploadCrashData(false)
|
||||
|
||||
hs.window.animationDuration = 0
|
||||
|
||||
local log = hs.logger.new('init', 'debug')
|
||||
|
||||
configWatcher = hs.pathwatcher.new(hs.configdir, hs.reload):start()
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Moonlander Detection
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
function isDeviceMoonlander(device)
|
||||
return device.productName == "Moonlander Mark I"
|
||||
end
|
||||
|
||||
function moonlanderDetected(connected)
|
||||
if connected then
|
||||
hs.keycodes.setLayout("EurKEY v1.2")
|
||||
else
|
||||
hs.keycodes.setLayout("Colemak DH ISO copy")
|
||||
end
|
||||
end
|
||||
|
||||
function searchMoonlander()
|
||||
local usbDevices = hs.usb.attachedDevices()
|
||||
local moonlanderConnected = hs.fnutils.find(usbDevices, isDeviceMoonlander) ~= nil
|
||||
|
||||
moonlanderDetected(moonlanderConnected)
|
||||
end
|
||||
|
||||
searchMoonlander()
|
||||
|
||||
usbWatcher = hs.usb.watcher.new(function(event)
|
||||
if event.productName == "Moonlander Mark I" then
|
||||
moonlanderDetected(event.eventType == "added")
|
||||
end
|
||||
end):start()
|
||||
|
||||
caffeinateWatcher = hs.caffeinate.watcher.new(function(event)
|
||||
if event == hs.caffeinate.watcher.systemDidWake then
|
||||
searchMoonlander()
|
||||
end
|
||||
end):start()
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- mount ds9 via tailscale
|
||||
----------------------------------------------------------------------------------------------------
|
||||
function mountDS9()
|
||||
local ssid = hs.wifi.currentNetwork()
|
||||
if ssid ~= nil and ssid ~= 'vim' then -- not at home
|
||||
if os.execute("mount | grep //ragon@ds9._smb._tcp.local/data") == nil then -- check if mounted via mdns
|
||||
os.execute("diskutil umount /Volumes/data") -- umount share if it exists
|
||||
hs.osascript.applescript('mount volume "smb://ragon@ds9.ragon000.github.beta.tailscale.net/data"') -- mount share via tailscale
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mountDS9()
|
||||
|
||||
hs.wifi.watcher.new(function(watcher, message, interface)
|
||||
mountDS9()
|
||||
end):start()
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Scratchpad
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
function showHideBundleId(bundleId)
|
||||
local focusedWindow = hs.window.focusedWindow()
|
||||
if focusedWindow ~= nil and focusedWindow:application():bundleID() == bundleId then -- window is focused
|
||||
focusedWindow:close() -- hide
|
||||
else
|
||||
hs.application.launchOrFocusByBundleID(bundleId)
|
||||
hs.window.focusedWindow():centerOnScreen(hs.mouse.getCurrentScreen())
|
||||
end
|
||||
end
|
||||
|
||||
local hyperModifier = {"cmd", "shift", "ctrl", "alt"}
|
||||
hs.hotkey.bind(hyperModifier, "b", function() showHideBundleId("com.bitwarden.desktop") end)
|
||||
hs.hotkey.bind(hyperModifier, "p", function() showHideBundleId("com.timeular.zei") end)
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Tiling
|
||||
----------------------------------------------------------------------------------------------------
|
||||
Loading…
Add table
Add a link
Reference in a new issue