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.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";
};
};

View file

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

View file

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