2024-10-21 12:31:30 +07:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-06-12 09:54:11 +07:00
|
|
|
let
|
|
|
|
cfg = config.profile.whatsapp;
|
2024-10-21 21:38:07 +07:00
|
|
|
autostartScript = pkgs.writeShellScriptBin "whatsapp.sh" ''
|
2024-10-21 21:44:24 +07:00
|
|
|
sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 web.whatsapp.com; do sleep 1; done; whatsapp-for-linux
|
2024-10-21 21:38:07 +07:00
|
|
|
'';
|
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
|
|
|
|
2024-10-20 11:03:56 +07:00
|
|
|
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [
|
2024-10-21 21:38:07 +07:00
|
|
|
"${lib.meta.getExe autostartScript}"
|
2024-10-20 11:03:56 +07:00
|
|
|
];
|
2024-10-21 21:38:07 +07:00
|
|
|
|
|
|
|
home.file.".config/autostart/whatsapp.sh" = lib.mkIf cfg.autostart {
|
|
|
|
source = "${lib.meta.getExe autostartScript}";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.swaync.settings.scripts._10-whatsapp =
|
|
|
|
let
|
|
|
|
focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
app-name = "whatsapp-for-linux";
|
|
|
|
exec = "${lib.meta.getExe focusWindowScript}";
|
|
|
|
run-on = "action";
|
|
|
|
};
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
}
|