From 247a2df0cc93e4be7e0aa314ec9d974e8a935cc4 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Wed, 23 Oct 2024 19:54:15 +0700 Subject: [PATCH] swaync: update config --- home/modules/hyprland/pyprland.nix | 4 ++ home/modules/hyprland/swaync.nix | 58 +++++++++++++++++++++-- home/modules/hyprland/wallust/default.nix | 1 + home/modules/hyprland/wallust/swaync.nix | 43 +++++++++++++++++ system/services/ntfy-sh.nix | 2 + 5 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 home/modules/hyprland/wallust/swaync.nix diff --git a/home/modules/hyprland/pyprland.nix b/home/modules/hyprland/pyprland.nix index d0ac437..62a31cd 100644 --- a/home/modules/hyprland/pyprland.nix +++ b/home/modules/hyprland/pyprland.nix @@ -24,6 +24,10 @@ let ${unstable.wallust}/bin/wallust run "$target" ${pkgs.graphicsmagick}/bin/gm convert -resize 75% -blur 50x30 "$target" "$blur_target" ${pkgs.imagemagick}/bin/magick "$target" -resize 25% -gravity Center -extent 1:1 "$square_target" + + if [ `pidof swaync` ]; then + swaync-client --reload-css + fi ''; in { diff --git a/home/modules/hyprland/swaync.nix b/home/modules/hyprland/swaync.nix index 56d0b93..004cbce 100644 --- a/home/modules/hyprland/swaync.nix +++ b/home/modules/hyprland/swaync.nix @@ -12,17 +12,56 @@ in services.poweralertd.enable = true; services.swaync = { enable = true; - style = pkgs.fetchurl { - url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/mocha.css"; - hash = "sha256-Hie/vDt15nGCy4XWERGy1tUIecROw17GOoasT97kIfc="; - }; + 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="; + }; + 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 + # Origin: https://github.com/zDyanTB/HyprNova/blob/5c2b4634a6971aaf995b4fc69cd74f8bbf0b84d0/.config/swaync/themes/nova-dark/central_control.css + # css + '' + @import '${config.home.homeDirectory}/.cache/wallust/swaync_base16.css'; + @import '${controlCenterCss}'; + @import '${notificationCss}'; + ''; settings = { positionX = "center"; positionY = "top"; - fit-to-screen = false; + fit-to-screen = true; control-center-height = 800; timeout = 7; timeout-low = 5; + widgets = [ + # "label" + # "buttons-grid" + "mpris" + # "volume" + "title" + "dnd" + "notifications" + ]; + widget-config = { + title = { + text = "Notifications"; + clear-all-button = true; + button-text = " 󰎟 "; + }; + label = { + max-lines = 1; + text = " "; + }; + mpris = { + image-size = 96; + image-radius = 12; + }; + }; scripts = { _10-hyprland-ytptube = { @@ -38,6 +77,15 @@ in }; }; + 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 ]; }; } diff --git a/home/modules/hyprland/wallust/default.nix b/home/modules/hyprland/wallust/default.nix index dfefab1..d13e94c 100644 --- a/home/modules/hyprland/wallust/default.nix +++ b/home/modules/hyprland/wallust/default.nix @@ -44,6 +44,7 @@ in ./hyprland.nix ./kitty.nix ./rofi.nix + ./swaync.nix ./waybar.nix ./wlogout.nix ]; diff --git a/home/modules/hyprland/wallust/swaync.nix b/home/modules/hyprland/wallust/swaync.nix new file mode 100644 index 0000000..8744ea1 --- /dev/null +++ b/home/modules/hyprland/wallust/swaync.nix @@ -0,0 +1,43 @@ +{ config, lib, ... }: +let + inherit (lib) mkIf; +in +{ + config = mkIf config.services.swaync.enable { + home.file.".config/wallust/templates/swaync_base16.css".text = + #css + '' + @define-color foreground {{foreground}}; + @define-color background {{background}}; + @define-color cursor {{cursor}}; + + @define-color color0 {{color0}}; + @define-color color1 {{color1}}; + @define-color color2 {{color2}}; + @define-color color3 {{color3}}; + @define-color color4 {{color4}}; + @define-color color5 {{color5}}; + @define-color color6 {{color6}}; + @define-color color7 {{color7}}; + @define-color color8 {{color8}}; + @define-color color9 {{color9}}; + @define-color color10 {{color10}}; + @define-color color11 {{color11}}; + @define-color color12 {{color12}}; + @define-color color13 {{color13}}; + @define-color color14 {{color14}}; + @define-color color15 {{color15}}; + ''; + + profile.hyprland.wallust.settings.templates = + let + out = config.home.homeDirectory + "/.cache/wallust"; + in + { + swaync = { + template = "swaync_base16.css"; + target = "${out}/swaync_base16.css"; + }; + }; + }; +} diff --git a/system/services/ntfy-sh.nix b/system/services/ntfy-sh.nix index 15202cd..bdb86e9 100644 --- a/system/services/ntfy-sh.nix +++ b/system/services/ntfy-sh.nix @@ -81,6 +81,8 @@ lib.mkMerge [ }; }; + profile.services.ntfy-sh.client.settings.subscribe = [ { topic = "all"; } ]; + sops = { secrets = let