NixOS/home/programs/slack.nix

33 lines
845 B
Nix
Raw Normal View History

{
pkgs,
lib,
config,
...
}:
2024-06-12 09:54:11 +07:00
let
cfg = config.profile.slack;
autostartScript = pkgs.writeShellScriptBin "slack.sh" ''
2024-11-09 15:35:09 +07:00
# do not autostart on weekend
if [ "$(date +%u)" -gt 5 ]; then exit 0; fi
sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 1.1.1.1; do sleep 1; done; slack
'';
inherit (lib.meta) getExe;
autostartScriptFile = getExe autostartScript;
2024-06-12 09:54:11 +07:00
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ slack ];
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ autostartScriptFile ];
home.file.".config/autostart/slack.sh" = lib.mkIf cfg.autostart { source = autostartScriptFile; };
services.swaync.settings.scripts._10-slack = {
app-name = "[Ss]lack";
2024-10-23 15:45:18 +07:00
exec = "hyprctl dispatch focuswindow Slack";
run-on = "action";
};
2024-06-12 09:54:11 +07:00
};
}