NixOS/home/programs/whatsapp.nix

32 lines
803 B
Nix
Raw Normal View History

{
lib,
config,
pkgs,
...
}:
2024-06-12 09:54:11 +07:00
let
cfg = config.profile.whatsapp;
autostartScript = pkgs.writeShellScriptBin "whatsapp.sh" ''
sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 web.whatsapp.com; do sleep 1; done; whatsapp-for-linux
'';
2024-06-12 09:54:11 +07:00
in
{
config = lib.mkIf cfg.enable {
2024-07-10 09:32:51 +07:00
home.packages = [ pkgs.whatsapp-for-linux ];
2024-06-12 09:54:11 +07:00
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [
"${lib.meta.getExe autostartScript}"
];
home.file.".config/autostart/whatsapp.sh" = lib.mkIf cfg.autostart {
source = "${lib.meta.getExe autostartScript}";
};
services.swaync.settings.scripts._10-whatsapp = {
app-name = "whatsapp-for-linux";
exec = "hyprctl dispatch focuswindow whatsapp-for-linux";
run-on = "action";
};
2024-06-12 09:54:11 +07:00
};
}