NixOS/home/modules/hyprland/swaync.nix

85 lines
2.9 KiB
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
in
{
config = lib.mkIf cfg.enable {
2024-10-20 15:40:28 +07:00
services.swaync = {
enable = true;
2024-10-23 23:41:45 +07:00
# pkill swaync && GTK_DEBUG=interactive swaync - launch swaync with gtk debugger
2024-10-23 19:54:15 +07:00
style =
let
# Origin: "https://github.com/zDyanTB/HyprNova/blob/5c2b4634a6971aaf995b4fc69cd74f8bbf0b84d0/.config/swaync/themes/nova-dark/notifications.css";
notificationCss = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/zDyanTB/HyprNova/5c2b4634a6971aaf995b4fc69cd74f8bbf0b84d0/.config/swaync/themes/nova-dark/notifications.css";
hash = "sha256-QIM60RX/OedhfkMKngj540d/9wj4E54ncv24nueYlyk=";
};
2024-10-23 23:41:45 +07:00
# Origin: https://github.com/zDyanTB/HyprNova/blob/5c2b4634a6971aaf995b4fc69cd74f8bbf0b84d0/.config/swaync/themes/nova-dark/central_control.css
2024-10-23 19:54:15 +07:00
controlCenterCss = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/zDyanTB/HyprNova/5c2b4634a6971aaf995b4fc69cd74f8bbf0b84d0/.config/swaync/themes/nova-dark/central_control.css";
hash = "sha256-XzFea04G4DCxDUF/XOqUkKei+Xv9bmdnSVU4/Sjtefc=";
};
in
# css
''
@import '${config.home.homeDirectory}/.cache/wallust/swaync_base16.css';
@import '${controlCenterCss}';
@import '${notificationCss}';
2024-10-23 23:41:45 +07:00
.control-center {
background: alpha(@background, 0.9);
}
.floating-notifications.background .notification-row .notification-background {
background: alpha(@background, 0.9);
}
2024-10-23 19:54:15 +07:00
'';
2024-10-20 15:40:28 +07:00
settings = {
positionX = "center";
positionY = "top";
2024-10-23 23:41:45 +07:00
fit-to-screen = false;
2024-10-20 15:40:28 +07:00
control-center-height = 800;
timeout = 7;
timeout-low = 5;
2024-10-23 19:54:15 +07:00
widget-config = {
title = {
text = "Notifications";
clear-all-button = true;
button-text = " 󰎟 ";
};
};
2024-10-20 15:40:28 +07:00
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 = {
2024-10-20 15:40:28 +07:00
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|vesktop).*$";
2024-10-20 15:40:28 +07:00
};
};
};
};
systemd.user.services.swaync.Service.Environment = [ "G_MESSAGES_DEBUG=all" ];
2024-10-23 19:54:15 +07:00
wayland.windowManager.hyprland.settings.layerrule = [
"blur, swaync-notification-window"
"blur, swaync-control-center"
"ignorezero, swaync-notification-window"
"ignorezero, swaync-control-center"
"ignorealpha 0.5, swaync-notification-window"
"ignorealpha 0.5, swaync-control-center"
];
home.packages = with pkgs; [ libnotify ];
};
}