diff --git a/home/programs/discord.nix b/home/programs/discord.nix index f897272..e9b2719 100644 --- a/home/programs/discord.nix +++ b/home/programs/discord.nix @@ -3,6 +3,14 @@ let inherit (lib) mkIf; inherit (lib.meta) getExe; cfg = config.profile.discord; + autostartScript = pkgs.writeShellScriptBin "discord.sh" /*sh*/ '' + sleep 10; + until ${pkgs.unixtools.ping}/bin/ping -c 1 discord.com; + do sleep 1; + done; + vesktop + ''; + autostartScriptFile = getExe autostartScript; in { config = mkIf cfg.enable { @@ -10,23 +18,25 @@ in vesktop ]; - home.file = { - ".config/discord/settings.json".text = builtins.toJSON { - SKIP_HOST_UPDATE = true; - }; + home.file.".config/discord/settings.json".text = builtins.toJSON { + SKIP_HOST_UPDATE = true; }; wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ - "sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 discord.com; do sleep 1; done; vesktop" + autostartScriptFile ]; + home.file.".config/autostart/discord.sh" = lib.mkIf cfg.autostart { + source = autostartScriptFile; + }; + services.swaync.settings.scripts._10-discord = let - script = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { }; + focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { }; in { app-name = "(?=discord|vesktop)"; - exec = "${getExe script}"; + exec = "${getExe focusWindowScript}"; run-on = "action"; }; }; diff --git a/home/programs/slack.nix b/home/programs/slack.nix index 3b815ea..604e2fa 100644 --- a/home/programs/slack.nix +++ b/home/programs/slack.nix @@ -1,19 +1,32 @@ { pkgs, lib, config, ... }: let cfg = config.profile.slack; - script = pkgs.writeShellScriptBin "slack.sh" '' + autostartScript = pkgs.writeShellScriptBin "slack.sh" '' sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 1.1.1.1; do sleep 1; done; slack ''; - scriptFile = lib.meta.getExe script; + inherit (lib.meta) getExe; + autostartScriptFile = getExe autostartScript; in { config = lib.mkIf cfg.enable { home.packages = with pkgs; [ slack ]; wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ - scriptFile + autostartScriptFile ]; - home.file.".config/autostart/slack.sh".source = lib.mkIf cfg.autostart scriptFile; + home.file.".config/autostart/slack.sh" = lib.mkIf cfg.autostart { + source = autostartScriptFile; + }; + + services.swaync.settings.scripts._10-slack = + let + focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { }; + in + { + app-name = "[Ss]lack"; + exec = "${getExe focusWindowScript}"; + run-on = "action"; + }; }; } diff --git a/profiles/fort.nix b/profiles/fort.nix index 5a70cb9..4b48cea 100644 --- a/profiles/fort.nix +++ b/profiles/fort.nix @@ -37,8 +37,14 @@ pyprland.wallpaper-dirs = [ "/home/tigor/Syncthing/Redmage/Laptop-Kerja" ]; wallust.alpha = 80; }; - discord.enable = true; - slack.enable = true; + discord = { + enable = true; + autostart = true; + }; + slack = { + enable = true; + autostart = true; + }; whatsapp.enable = true; syncthing.enable = true; bluetooth.enable = true;