slack, discord: autostart on fort profile

This commit is contained in:
Tigor Hutasuhut 2024-10-21 10:05:12 +07:00
parent 0bfb7539db
commit 9b5b84ed5a
3 changed files with 42 additions and 13 deletions

View file

@ -3,6 +3,14 @@ let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
cfg = config.profile.discord; 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 in
{ {
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -10,23 +18,25 @@ in
vesktop vesktop
]; ];
home.file = { home.file.".config/discord/settings.json".text = builtins.toJSON {
".config/discord/settings.json".text = builtins.toJSON {
SKIP_HOST_UPDATE = true; SKIP_HOST_UPDATE = true;
}; };
};
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ 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 = services.swaync.settings.scripts._10-discord =
let let
script = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { }; focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { };
in in
{ {
app-name = "(?=discord|vesktop)"; app-name = "(?=discord|vesktop)";
exec = "${getExe script}"; exec = "${getExe focusWindowScript}";
run-on = "action"; run-on = "action";
}; };
}; };

View file

@ -1,19 +1,32 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let let
cfg = config.profile.slack; 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 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 in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ 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";
};
}; };
} }

View file

@ -37,8 +37,14 @@
pyprland.wallpaper-dirs = [ "/home/tigor/Syncthing/Redmage/Laptop-Kerja" ]; pyprland.wallpaper-dirs = [ "/home/tigor/Syncthing/Redmage/Laptop-Kerja" ];
wallust.alpha = 80; wallust.alpha = 80;
}; };
discord.enable = true; discord = {
slack.enable = true; enable = true;
autostart = true;
};
slack = {
enable = true;
autostart = true;
};
whatsapp.enable = true; whatsapp.enable = true;
syncthing.enable = true; syncthing.enable = true;
bluetooth.enable = true; bluetooth.enable = true;