diff --git a/home/modules/hyprland/hyprland.nix b/home/modules/hyprland/hyprland.nix index 1d48f8e..c3374f2 100644 --- a/home/modules/hyprland/hyprland.nix +++ b/home/modules/hyprland/hyprland.nix @@ -202,7 +202,6 @@ in source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf - exec-once=bash -c "sleep 10; until ping -c 1 discord.com; do sleep 1; done; discord" exec-once=bash -c "sleep 10; until ping -c 1 google.com; do sleep 1; done; slack" exec-once=bash -c "sleep 10; until ping -c 1 nextcloud.tigor.web.id; do sleep 1; done; nextcloud --background" ''; diff --git a/home/programs/discord.nix b/home/programs/discord.nix index eeb5634..ea8a005 100644 --- a/home/programs/discord.nix +++ b/home/programs/discord.nix @@ -6,47 +6,17 @@ in { config = mkIf cfg.enable { home.packages = with pkgs; [ - discord + vesktop ]; - systemd.user = lib.mkIf cfg.autostart { - services.discord = { - Unit = { - Description = "Automatically start Discord on Login"; - # Only runs on sessions with a graphical target like X11 or Wayland. - Wants = [ "graphical.target" ]; - StartLimitIntervalSec = 300; - StartLimitBurst = 10; - }; - Service = - let - bash = "${pkgs.bash}/bin/bash"; - ping = "${pkgs.unixtools.ping}/bin/ping"; - host = "discord.com"; - sleep = "${pkgs.coreutils}/bin/sleep"; - discord = "${pkgs.discord}/bin/discord"; - exec = ''${bash} -c "until ${ping} -c 1 ${host}; do ${sleep} 1; done; ${discord}"''; - in - { - Type = "simple"; - ExecStartPre = "${sleep} 5"; - ExecStart = exec; - Restart = "on-failure"; - RemainAfterExit = "yes"; - Environment = [ "NIXOS_OZONE_WL=1" ]; - }; - Install = { - WantedBy = [ "default.target" ]; # After user login. - }; + home.file = { + ".config/discord/settings.json".text = builtins.toJSON { + SKIP_HOST_UPDATE = true; }; }; - home.file = { - ".config/discord/settings.json".text = '' - { - "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" + ]; }; } diff --git a/options/programs.nix b/options/programs.nix index 28548d6..aa23622 100644 --- a/options/programs.nix +++ b/options/programs.nix @@ -6,7 +6,7 @@ autostart = lib.mkEnableOption "discord autostart"; window_rule = lib.mkOption { type = lib.types.str; - default = "workspace 7 silent,class:(discord)"; + default = "workspace 7 silent,class:((?=discord|vesktop))"; }; }; diff --git a/profiles/castle.nix b/profiles/castle.nix index b92444d..1350c35 100644 --- a/profiles/castle.nix +++ b/profiles/castle.nix @@ -48,7 +48,10 @@ in suspendTimeout = 7200; }; }; - discord.enable = true; + discord = { + enable = true; + autostart = true; + }; slack.enable = true; whatsapp = { enable = true;