dotfiles/modules/darwin/hammerspoon.nix

44 lines
1.7 KiB
Nix
Raw Normal View History

2024-04-20 13:42:06 +00:00
{
config,
pkgs,
lib,
...
}:
{
# Hammerspoon - MacOS custom automation scripting
2022-12-21 21:18:03 +00:00
config = lib.mkIf pkgs.stdenv.isDarwin {
home-manager.users.${config.user} = {
xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua;
2024-04-20 13:42:06 +00:00
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = ./hammerspoon/Spoons/ControlEscape.spoon;
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = ./hammerspoon/Spoons/DismissAlerts.spoon;
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
src = ./hammerspoon/Spoons/Launcher.spoon/init.lua;
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
discord = "${pkgs.discord}/Applications/Discord.app";
wezterm = "${pkgs.wezterm}/Applications/WezTerm.app";
2024-04-20 13:42:06 +00:00
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
slack = "${pkgs.slack}/Applications/Slack.app";
};
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./hammerspoon/Spoons/MoveWindow.spoon;
2023-07-26 15:55:58 +00:00
home.activation.reloadHammerspoon =
2024-04-20 13:42:06 +00:00
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ]
''
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
$DRY_RUN_CMD sleep 1
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
'';
2022-12-21 21:18:03 +00:00
};
2022-12-21 21:18:03 +00:00
homebrew.casks = [ "hammerspoon" ];
2022-12-21 21:18:03 +00:00
system.activationScripts.postUserActivation.text = ''
2024-11-11 21:00:41 +00:00
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${config.homePath}/.config/hammerspoon/init.lua"
2023-07-26 15:55:58 +00:00
sudo killall Dock
2022-12-21 21:18:03 +00:00
'';
};
}