discord: moved to vesktop

This commit is contained in:
Tigor Hutasuhut 2024-10-20 11:21:34 +07:00
parent 7b80013e74
commit 3490576ddb
4 changed files with 12 additions and 40 deletions

View file

@ -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"
'';

View file

@ -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"
];
};
}

View file

@ -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))";
};
};

View file

@ -48,7 +48,10 @@ in
suspendTimeout = 7200;
};
};
discord.enable = true;
discord = {
enable = true;
autostart = true;
};
slack.enable = true;
whatsapp = {
enable = true;