Commit a4d80be

Ansari <ping@ansari.wtf>
2026-01-02 06:59:43
Enhance notification system - swaync
1 parent d98a65a
.config/hypr/modules/autostarts.conf
@@ -1,4 +1,5 @@
-exec-once = waybar
+exec-once = waybar &
+exec-once = swaync &
 exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
 exec-once = wl-paste --type text --watch cliphist store
 exec-once = wl-paste --type image --watch cliphist store 
.config/hypr/modules/keybinds.conf
@@ -22,7 +22,7 @@ bind = $mainMod,    T,      exec, $terminal
 bind = CTRLALT,    T,      exec, $terminal
 bind = $mainMod,    E,      exec, $fileManager
 bind = $mainMod,    L,      exec, hyprlock
-bind = $mainMod,    R,		exec, killall -9 waybar && waybar
+bind = $mainMod,    R,		exec, $swaybartoggle
 bind = $mainMod,    V,      exec, $cliphistMenu
 bind = $mainMod,    period, exec, $emojiMenu
 bind = $mainMod     SHIFT,S,exec, $screenshotMenu
.config/hypr/modules/vars.conf
@@ -6,6 +6,7 @@ $emojiMenu = rofimoji -a type copy type-numerical
 
 $screenshotMenu = $HOME/.wraith/scripts/screenshot.sh
 $cycleSpecial = $HOME/.wraith/scripts/cycle-special-workspace.sh
+$swaybartoggle = $HOME/.wraith/scripts/waybar-swaync.sh
 
 env = LIBVA_DRIVER_NAME,nvidia
 env = __GLX_VENDOR_LIBRARY_NAME,nvidia
.config/swaync/central_control.css
@@ -0,0 +1,291 @@
+@define-color text            @fg0;
+@define-color background-alt  @bg1;
+@define-color selected        @fg0;
+@define-color hover           alpha(@fg0, .4);
+@define-color urgent          @red;
+@define-color background      @bg0;
+@define-color background-sec  @bg2;
+
+* {
+  color: @text;
+  all: unset;
+  font-size: 14px;
+  font-family: "JetBrains Mono Nerd Font 10";
+  transition: 200ms;
+}
+
+/* Avoid 'annoying' backgroud */
+.blank-window {
+  background: alpha(@background, 0.4);
+}
+
+/* CONTROL CENTER ------------------------------------------------------------------------ */
+
+.control-center {
+  background: @background;
+  border-radius: 7px;
+  border: 1px solid alpha(@selected, 0.2);
+  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.6);
+  margin: 4px;
+  padding: 12px;
+}
+
+/* Notifications  */
+.control-center .notification-row .notification-background,
+.control-center
+  .notification-row
+  .notification-background
+  .notification.critical {
+  background-color: @background-alt;
+  border-radius: 9px;
+  margin: 4px 0px;
+  padding: 4px;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification.critical {
+  color: @urgent;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification
+  .notification-content {
+  margin: 6px;
+  padding: 8px 6px 2px 2px;
+}
+
+ .control-center .notification-row {
+    margin: 0px; 
+    padding: 0px;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification
+  > *:last-child
+  > * {
+  min-height: 3.4em;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification
+  > *:last-child
+  > *
+  .notification-action {
+  background: alpha(@selected, 0.6);
+  color: @text;
+  border-radius: 12px;
+  margin: 6px;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification
+  > *:last-child
+  > *
+  .notification-action:hover {
+  background: @selected;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .notification
+  > *:last-child
+  > *
+  .notification-action:active {
+  background-color: @selected;
+}
+
+/* Buttons */
+
+.control-center .notification-row .notification-background .close-button {
+  background: transparent;
+  border-radius: 6px;
+  color: @text;
+  margin: 0px;
+  padding: 4px;
+}
+
+.control-center .notification-row .notification-background .close-button:hover {
+  background-color: @background-sec;
+}
+
+.control-center
+  .notification-row
+  .notification-background
+  .close-button:active {
+  background-color: @selected;
+}
+
+
+progressbar,
+trough {
+  background-color: @background;
+  border-radius: 9px;
+  min-height: 10px;
+}
+
+/* filled part (THIS must NOT have a min-width) */
+progress {
+  background-color: @fg0;
+  border-radius: 9px;
+  min-width: 0;
+  min-height: 10px;
+}
+
+/* Notifications expanded-group */
+
+.notification-group {
+  margin: 2px 8px 2px 8px;
+}
+.notification-group-headers {
+  font-weight: bold;
+  font-size: 1.25rem;
+  color: @text;
+  letter-spacing: 2px;
+}
+
+.notification-group-icon {
+  color: @text;
+}
+
+.notification-group-collapse-button,
+.notification-group-close-all-button {
+  background: transparent;
+  color: @text;
+  margin: 4px;
+  border-radius: 6px;
+  padding: 4px;
+}
+
+.notification-group-collapse-button:hover,
+.notification-group-close-all-button:hover {
+  background: @hover;
+}
+
+/* WIDGETS --------------------------------------------------------------------------- */
+
+/* Notification clear button */
+.widget-title {
+  font-size: 1.2em;
+  margin: 6px;
+  /* border: 1px solid red; */
+}
+
+.widget-title button {
+  background: @background-alt;
+  border-radius: 6px;
+  padding: 4px 16px;
+}
+
+.widget-title button:hover {
+  background-color: @hover;
+}
+
+.widget-title button:active {
+  background-color: @selected;
+}
+
+/* Do not disturb */
+.widget-dnd {
+  /* border: 1px solid red; */
+
+  margin: 6px;
+  font-size: 1.2rem;
+}
+
+.widget-dnd > switch {
+  background: @hover;
+  font-size: initial;
+  border-radius: 9px;
+  box-shadow: none;
+  padding: 2px;
+}
+
+.widget-dnd > switch slider {
+  background: @text;
+  border-radius: 6px;
+}
+
+/* Buttons menu */
+
+
+.widget-buttons-grid {
+  font-size: x-large;
+  padding: 6px 2px;
+  border-radius: 7px;
+  background: @background;  
+}
+
+.widget-buttons-grid > flowbox > flowboxchild > button {
+  padding: 6px 0px;
+  background: transparent;
+  border-radius: 7px;
+  min-width: 55px;
+  margin: 5px;
+  border: 1px solid alpha(@selected, 0.1);
+}
+
+.widget-buttons-grid > flowbox > flowboxchild > button:hover {
+  background: @hover;
+}
+
+.widget-buttons-grid > flowbox > flowboxchild > button:checked {
+  /* OnePlus McClaren edition Orange accent */
+  background-color: @hover;
+}
+
+/* Music player */
+.widget-mpris {
+  background: @background-alt;
+  border-radius: 9px;
+  color: @text;
+  margin: 2px 3px;
+}
+
+/* NOTE: Background need *opacity 1* otherwise will turn into the album art blurred  */
+.widget-mpris-player {
+  border-radius: 9px;
+  padding: 6px 14px;
+  margin: 6px;
+}
+
+.widget-mpris > box > button {
+  color: @text;
+  border-radius: 9px;
+}
+
+.widget-mpris button {
+  color: alpha(@text, 0.6);
+}
+
+.widget-mpris button:hover {
+  color: @text;
+}
+
+.widget-mpris-album-art {
+  border-radius: 9px;
+}
+
+.widget-mpris-title {
+  font-weight: 700;
+  font-size: 1rem;
+}
+
+.widget-mpris-subtitle {
+  font-weight: 500;
+  font-size: 0.8rem;
+}
+
+picture.mpris-background {
+  opacity: 0;
+}
.config/swaync/config.json
@@ -0,0 +1,98 @@
+{
+  "$schema": "/etc/xdg/swaync/configSchema.json",
+  "positionX": "right",
+  "positionY": "top",
+  
+	"cssPriority": "user",
+
+  "control-center-width": 360,
+  "control-center-height": 500, 
+  "control-center-margin-top": 0,
+  "control-center-margin-bottom": 0,
+  "control-center-margin-right": 1,
+  "control-center-margin-left": 0,
+
+  "notification-window-width": 360,
+  "notification-window-height": 500,
+  "notification-icon-size": 48,
+  "notification-body-image-height": 160,
+  "notification-body-image-width": 200,
+
+  "timeout": 4,
+  "timeout-low": 2,
+  "timeout-critical": 6,
+  
+  "fit-to-screen": false,
+  "keyboard-shortcuts": true,
+  "image-visibility": "when-available",
+  "transition-time": 200,
+  "hide-on-clear": false,
+  "hide-on-action": true,
+  "script-fail-notify": true,
+  "scripts": {
+    "example-script": {
+      "exec": "echo 'Do something...'",
+      "urgency": "Normal"
+    }
+  },
+  "notification-visibility": {
+    "example-name": {
+      "state": "muted",
+      "urgency": "Low",
+      "app-name": "Spotify"
+    }
+  },
+  "widgets": [
+    "buttons-grid",
+    "mpris",
+    "title",
+    "notifications"
+  ],
+  "widget-config": {
+    "title": {
+      "text": "Notifications",
+      "clear-all-button": true,
+      "button-text": " 󰎟 "
+    },
+    "dnd": {
+      "text": "Do not disturb"
+    },
+    "mpris": {
+      "image-size": 100,
+      "image-radius": 9
+    },
+    "buttons-grid": {
+      "actions": [
+        {
+          "label": "󰂛",
+          "command": "swaync-client -d",
+          "type": "toggle",
+          "active": false,
+          "update-command": "swaync-client -D"
+        },
+        {
+          "label":"󰍭",
+          "command":"pactl set-source-mute @DEFAULT_SOURCE@ toggle",
+          "type":"toggle",
+          "active": false,
+          "update-command":"pactl get-source-mute @DEFAULT_SOURCE@ | grep 'Mute: yes' && echo 'true' || echo 'false'"
+        },
+        {
+          "label": "󰗹",
+          "command": "tailscale status | grep 'stopped' >/dev/null && tailscale up || tailscale down",
+          "type": "toggle",
+          "active": false,
+          "update-command": "tailscale status | grep 'stopped' >/dev/null && echo 'false' || echo 'true'"
+        },
+        {
+          "label": "",
+          "command": "hyprpicker -an"
+        },
+        {
+          "label": "󰏘",
+          "command": "nwg-look"
+        }
+      ]
+    }
+  }
+}
.config/swaync/notifications.css
@@ -0,0 +1,108 @@
+@define-color text            @fg0;
+@define-color background-alt  @bg1;
+@define-color selected        @fg0;
+@define-color hover           @succ;
+@define-color urgent          @errr;
+
+* {
+  color: @text;
+  all: unset;
+  font-size: 14px;
+  font-family: "JetBrains Mono Nerd Font 10";
+  transition: 200ms;
+
+}
+
+.notification-row {
+  outline: none;
+  margin: 0;
+  padding: 0px;
+}
+
+.floating-notifications.background .notification-row .notification-background {
+  background: @background-alt;
+  box-shadow: 0 0 8px 0 rgba(0,0,0,.6);
+  border: 1px solid @selected;
+  border-radius: 9px;
+  margin: 16px;
+  padding: 0;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification {
+  padding: 6px;
+  border-radius: 9px;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification.critical {
+  border: 2px solid @errr;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification .notification-content {
+  margin: 14px;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * {
+  min-height: 3.4em;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action {
+  border-radius: 9px;
+  background-color: @background-alt ;
+  margin: 6px;
+  border: 1px solid transparent;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action:hover {
+  background-color: @hover;
+  border: 1px solid @selected;
+}
+
+.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action:active {
+  background-color: @selected;
+  color: @background;
+}
+
+.image {
+  margin: 10px 20px 10px 0px;
+}
+
+.summary {
+  font-weight: 800;
+  font-size: 1rem;
+}
+
+.body {
+  font-size: 0.8rem;
+}
+
+.floating-notifications.background .notification-row .notification-background .close-button {
+  margin: 6px;
+  padding: 2px;
+  border-radius: 6px;
+  background-color: transparent;
+  border: 1px solid transparent;
+}
+
+.close-button{
+  margin-right: 5px;
+  margin-top: 7px;
+}
+
+.floating-notifications.background .notification-row .notification-background .close-button:hover {
+  background-color: @selected;
+}
+
+.floating-notifications.background .notification-row .notification-background .close-button:active {
+  background-color: @selected;
+  color: @background;
+}
+
+.notification.critical progress {
+  background-color: @selected;
+}
+
+.notification.low progress,
+.notification.normal progress {
+  background-color: @selected;
+}
+
.config/swaync/style.css
@@ -0,0 +1,3 @@
+@import '../../.wraith/theme/colors.css';
+@import 'notifications.css';
+@import 'central_control.css';
\ No newline at end of file
.config/waybar/config.jsonc
@@ -10,6 +10,7 @@
     "custom/special_workspaces",
     "custom/brightness",
     "pulseaudio",
+    "custom/notification",
     "custom/power"
   ],
 
@@ -39,9 +40,9 @@
     "show-special": true,
     "format": "{icon}",
     "format-icons": {
+      "youtube": "",
       "music": "󰎆",
-      "3d": "󰭼",
-      "temp": "󰒋"
+      "3d": "󰭼"
     },
     "ignore-workspaces": ["^([0-9]|10)$"]
   },
@@ -97,6 +98,26 @@
     "on-click": "pactl -- set-sink-mute 0 toggle",
     "tooltip": false
   },
+  "custom/notification": {
+    "tooltip": true,
+    "format": "<span size='16pt'>{icon}</span>",
+    "format-icons": {
+      "notification": "󱅫",
+      "none": "󰂜",
+      "dnd-notification": "󰂠",
+      "dnd-none": "󰪓",
+      "inhibited-notification": "󰂛",
+      "inhibited-none": "󰪑",
+      "dnd-inhibited-notification": "󰂛",
+      "dnd-inhibited-none": "󰪑"
+    },
+    "return-type": "json",
+    "exec-if": "which swaync-client",
+    "exec": "swaync-client -swb",
+    "on-click": "swaync-client -t -sw",
+    "on-click-right": "swaync-client -d -sw",
+    "escape": true
+  },
   "custom/brightness": {
     "interval": 1,
     "exec": "$HOME/.wraith/scripts/brightness.sh get",
.config/waybar/style.css
@@ -33,6 +33,7 @@ menuitem:hover {
 #custom-about,
 #custom-power,
 #custom-brightness,
+#custom-notification,
 #pulseaudio,
 #workspaces.special {
   background-color: #241f31;
@@ -59,6 +60,10 @@ menuitem:hover {
   min-width: 20px;
 }
 
+#custom-notification{
+  margin-right: 5px;
+}
+
 #custom-brightness,
 #pulseaudio {
   min-width: 80px;
.wraith/scripts/waybar-swaync.sh
@@ -0,0 +1,7 @@
+#!/bin/zsh
+
+killall -9 waybar
+killall -9 swaync
+
+waybar &
+swaync &
\ No newline at end of file
.wraith/theme/colors.css
@@ -0,0 +1,12 @@
+@define-color bg0 #1e1e2e;
+@define-color fg0 #b4befe;
+@define-color bg1       #313244; 
+@define-color bg2       #45475a;
+@define-color fg_dim    #bac2de; 
+
+@define-color succ #a6e3a1;
+@define-color errr #e78284;
+@define-color warn #fab387;
+
+@define-color info_blue     #89b4fa;
+@define-color accent_pink   #f5c2e7;