slack: moved autostart script in hyprland
This commit is contained in:
parent
3490576ddb
commit
12199d0b2f
|
@ -201,9 +201,6 @@ in
|
|||
exec-once=pasystray
|
||||
|
||||
source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf
|
||||
|
||||
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"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,56 +1,19 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
cfg = config.profile.slack;
|
||||
script = 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;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [ slack ];
|
||||
|
||||
systemd.user = lib.mkIf cfg.autostart {
|
||||
# Unlike Discord, Slack is only used on office hours,
|
||||
# so we will use a timer to start it on office hours only.
|
||||
timers.slack = {
|
||||
Unit = {
|
||||
Description = "Start Slack Desktop Client on Weekdays on Login";
|
||||
};
|
||||
Timer = {
|
||||
OnCalendar = "Mon..Fri 09..18:*:*";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
services.slack = {
|
||||
Unit = {
|
||||
Description = "Slack Desktop Client";
|
||||
Wants = [ "graphical.target" ];
|
||||
StartLimitIntervalSec = 300;
|
||||
StartLimitBurst = 10;
|
||||
};
|
||||
Service =
|
||||
let
|
||||
bash = "${pkgs.bash}/bin/bash";
|
||||
ping = "${pkgs.unixtools.ping}/bin/ping";
|
||||
host = "google.com"; # slack.com does not respond to ping
|
||||
sleep = "${pkgs.coreutils}/bin/sleep";
|
||||
slack = "${pkgs.slack}/bin/slack";
|
||||
exec = ''${bash} -c "until ${ping} -c 1 ${host}; do ${sleep} 1; done; ${slack}"'';
|
||||
in
|
||||
{
|
||||
Type = "simple";
|
||||
ExecStartPre = "${sleep} 5";
|
||||
ExecStart = exec;
|
||||
Restart = "on-failure";
|
||||
# Prevent Slack from auto-restarting when user closes it.
|
||||
# The timer setup above will trigger this service
|
||||
# if RemaiAfterExit is not set to "yes".
|
||||
#
|
||||
# This will mark the service as still "Active" by systemd
|
||||
# hence the timer will not trigger the service again.
|
||||
RemainAfterExit = "yes";
|
||||
Environment = [ "NIXOS_OZONE_WL=1" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [
|
||||
scriptFile
|
||||
];
|
||||
|
||||
home.file.".config/autostart/slack.sh".source = lib.mkIf cfg.autostart scriptFile;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ in
|
|||
/*bash*/
|
||||
''
|
||||
packfiles() {
|
||||
find $(nix build "nixpkgs#$1" --no-link --print-out-paths)
|
||||
find $(NIXPKGS_ALLOW_UNFREE=1 nix build "nixpkgs#$1" --impure --no-link --print-out-paths)
|
||||
}
|
||||
|
||||
build() {
|
||||
|
|
|
@ -52,7 +52,10 @@ in
|
|||
enable = true;
|
||||
autostart = true;
|
||||
};
|
||||
slack.enable = true;
|
||||
slack = {
|
||||
enable = true;
|
||||
autostart = true;
|
||||
};
|
||||
whatsapp = {
|
||||
enable = true;
|
||||
autostart = true;
|
||||
|
|
Loading…
Reference in a new issue