swaync: simplified focus window scripts

This commit is contained in:
Tigor Hutasuhut 2024-10-21 23:17:24 +07:00
parent f88c2e1fe1
commit ef13bf83c8
6 changed files with 22 additions and 50 deletions

View file

@ -24,6 +24,11 @@ in
timeout-low = 3;
scripts = {
_10-hyprland-ytptube = {
app-name = "ytptube";
exec = ''hyprctl dispatch exec "xdg-open https://ytptube.tigor.web.id"'';
run-on = "action";
};
_98-play-notification-sound-normal = {
exec = ''${pkgs.sox}/bin/play --volume 0.5 ${./gran_turismo_menu_sound_effect.mp3}'';
app-name = "^(?!discord|TelegramDesktop|Slack|slack|Signal|Element|whatsapp-for-linux).*$";
@ -32,27 +37,6 @@ in
};
};
systemd.user.services.swaync = {
Unit = {
X-Reload-Triggers = [
(pkgs.writeText "swaync/config.json" (builtins.toJSON config.services.swaync.settings))
config.services.swaync.style
];
};
Service =
let
reloadScript =
pkgs.writeShellScriptBin "swaync-reload.sh" # sh
''
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-config
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-css
'';
in
{
ExecReload = "${lib.meta.getExe reloadScript}";
};
};
home.packages = with pkgs; [ libnotify ];
};
}

View file

@ -67,7 +67,7 @@ in
alpha = 100;
threshold = 1;
palette = "dark";
checkContrast = true;
check_contrast = true;
}
cfg.wallust.settings
]

View file

@ -29,13 +29,9 @@ in
home.file.".config/autostart/discord.sh" = lib.mkIf cfg.autostart { source = autostartScriptFile; };
services.swaync.settings.scripts._10-discord =
let
focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { };
in
{
services.swaync.settings.scripts._10-discord = {
app-name = "(?=discord|vesktop)";
exec = "${getExe focusWindowScript}";
exec = "hyprctl dispatch focuswindow $SWAYNC_APP_NAME";
run-on = "action";
};
};

View file

@ -20,13 +20,9 @@ in
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
{
services.swaync.settings.scripts._10-slack = {
app-name = "[Ss]lack";
exec = "${getExe focusWindowScript}";
exec = "hyprctl dispatch focuswindow $SWAYNC_APP_NAME";
run-on = "action";
};
};

View file

@ -22,13 +22,9 @@ in
source = "${lib.meta.getExe autostartScript}";
};
services.swaync.settings.scripts._10-whatsapp =
let
focusWindowScript = pkgs.callPackage ../../scripts/hyprland/focus-window.nix { };
in
{
services.swaync.settings.scripts._10-whatsapp = {
app-name = "whatsapp-for-linux";
exec = "${lib.meta.getExe focusWindowScript}";
exec = "hyprctl dispatch focuswindow whatsapp-for-linux";
run-on = "action";
};
};

View file

@ -184,7 +184,7 @@ lib.mkMerge [
in
[
{
command = ''${pkgs.libnotify}/bin/notify-send --app-name="YTPTUBE" --icon="${vueIcon}" --category=im.received --urgency=normal "$title" "$message"'';
command = ''${pkgs.libnotify}/bin/notify-send --app-name="ytptube" --icon="${vueIcon}" --category=im.received --urgency=normal "$title" "$message"'';
topic = "ytptube";
}
];