From 411e3504820989b3858d0311e96dc8993269007a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Schr=C3=B6ter?= Date: Mon, 2 Mar 2026 18:52:24 +0100 Subject: [PATCH] notifications --- configuration.nix | 11 ----- home/programs/default.nix | 1 + home/programs/dunst.nix | 49 +++++++++++++++++++ home/programs/eww/src/bar.yuck | 22 ++++----- home/programs/eww/src/scripts/battery.sh | 10 ++++ home/programs/river/default.nix | 26 +++++----- .../river/src/screenshot-active-clipboard.sh | 1 + .../river/src/screenshot-active-file.sh | 1 + .../src/screenshot-selection-clipboard.sh | 1 + .../river/src/screenshot-selection-file.sh | 1 + .../river/src/screenshot-whole-clipboard.sh | 1 + .../river/src/screenshot-whole-file.sh | 1 + home/programs/swww/default.nix | 2 +- machines/configuration-desktop.nix | 8 ++- machines/configuration-laptop.nix | 12 +++++ 15 files changed, 112 insertions(+), 35 deletions(-) create mode 100644 home/programs/dunst.nix create mode 100755 home/programs/river/src/screenshot-active-clipboard.sh create mode 100755 home/programs/river/src/screenshot-active-file.sh create mode 100755 home/programs/river/src/screenshot-selection-clipboard.sh create mode 100755 home/programs/river/src/screenshot-selection-file.sh create mode 100755 home/programs/river/src/screenshot-whole-clipboard.sh create mode 100755 home/programs/river/src/screenshot-whole-file.sh diff --git a/configuration.nix b/configuration.nix index e5b4a88..df6b4cf 100644 --- a/configuration.nix +++ b/configuration.nix @@ -136,17 +136,6 @@ XDG_STATE_HOME = "$HOME/.local/state"; }; - # Hyprlock - security.pam.services.hyprlock = { - text = '' - auth sufficient pam_fprint.so - auth include login - ''; - }; - - # Fingerprint SDDM - services.fprintd.enable = true; - # Enabling the Keyring. security.pam.services.login.enableGnomeKeyring = true; security.pam.services.sddm.enableGnomeKeyring = true; diff --git a/home/programs/default.nix b/home/programs/default.nix index 61eaf89..c4ecb07 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -6,6 +6,7 @@ ./calibre.nix ./digikam.nix ./dolphin.nix + ./dunst.nix ./eww ./git.nix ./hyprlock.nix diff --git a/home/programs/dunst.nix b/home/programs/dunst.nix new file mode 100644 index 0000000..7e83aef --- /dev/null +++ b/home/programs/dunst.nix @@ -0,0 +1,49 @@ +{ ... }: + +{ + services.dunst = { + enable = true; + settings = { + global = { + # Your exact styling - unchanged + monitor = 1; + origin = "top-right"; + offset = "15x25"; + width = 300; + height = 100; + gap_size = 5; + notification_limit = 5; + # font removed as requested + frame_width = 1; + separator_color = "frame"; + corner_radius = 12; + corners = "top-left,bottom"; + progress_bar_corner_radius = 8; + progress_bar_corners = "top-left,bottom-right"; + timeout = 5; + idle_threshold = 120; + max_icon_size = 64; + enable_recursive_icon_lookup = true; + show_indicators = true; + sticky_history = true; + history_length = 20; + mouse_left_click = "close_current"; + mouse_right_click = "close_all"; + mouse_middle_click = "context_all"; + format = "%a\\n%s\\n%b"; + }; + + urgency_low = { + timeout = 3; + }; + + urgency_normal = { + timeout = 5; + }; + + urgency_critical = { + timeout = 0; + }; + }; + }; +} diff --git a/home/programs/eww/src/bar.yuck b/home/programs/eww/src/bar.yuck index 7ba3c37..13782f3 100644 --- a/home/programs/eww/src/bar.yuck +++ b/home/programs/eww/src/bar.yuck @@ -1,4 +1,4 @@ -;; /-- Bar --> +;; ── Bar ───────────────────────────────────────────────────────────── (defwindow bar [] :geometry (geometry @@ -42,14 +42,14 @@ ) ) -;; /-- Widget Separator --> +;; ── Widget Separator ──────────────────────────────────────────────── (defwidget widSep [] (label :class "text separator" :text "|")) -;; /-- Idle Inhibitor --> +;; ── Idle Inhibitor ────────────────────────────────────────────────── (deflisten idle_inhibitor "journalctl --output=cat --output-fields=JOB_TYPE --user --follow --unit=idle-inhibitor") @@ -61,7 +61,7 @@ :onclick "systemctl is-active idle-inhibitor.service && systemctl stop idle-inhibitor.service || systemctl start idle-inhibitor.service" (label :text "${idle_inhibitor == 'start' ? '󰈈' : '󰛐' }")))) -;; /-- Audio --> +;; ── Audio ─────────────────────────────────────────────────────────── (defvar micClass "micOff") (defvar micIcon "󰍭") @@ -85,7 +85,7 @@ :class micClass :text "${micIcon}"))) -;; /-- Backlight --> +;; ── Backlight ─────────────────────────────────────────────────────── (defpoll backlight :interval "1s" @@ -102,7 +102,7 @@ :class "text" :text "${backlight}%"))) -;; /-- CPU --> +;; ── CPU ───────────────────────────────────────────────────────────── (defpoll cpu :interval "1s" @@ -119,7 +119,7 @@ :class "text" :text "${cpu}%"))) -;; /-- Memory --> +;; ── Memory ────────────────────────────────────────────────────────── (defpoll memory :interval "1s" @@ -136,7 +136,7 @@ :class "text" :text "${memory}%"))) -;; /-- Battery --> +;; ── Battery ───────────────────────────────────────────────────────── (defvar batteryClass "speakerOff") (defvar batteryIcon "") @@ -155,7 +155,7 @@ :class "text" :text "${batteryVolume}%"))) -;; /-- Network --> +;; ── Network ───────────────────────────────────────────────────────── (defvar networkDown "0") (defpoll networkUp @@ -179,7 +179,7 @@ :class "text" :text "${networkUp}"))) -;; /-- Time --> +;; ── Time ──────────────────────────────────────────────────────────── (defpoll date :interval "1s" @@ -196,7 +196,7 @@ :class "text" :text "${date}"))) -;; /-- River State --> +;; ── River State ───────────────────────────────────────────────────── (defvar ws1 "ws-empty") (defvar ws2 "ws-empty") diff --git a/home/programs/eww/src/scripts/battery.sh b/home/programs/eww/src/scripts/battery.sh index 2be0b2d..e1d17a3 100755 --- a/home/programs/eww/src/scripts/battery.sh +++ b/home/programs/eww/src/scripts/battery.sh @@ -1,6 +1,15 @@ bat=$(cat /sys/class/power_supply/BAT0/capacity) stat=$(cat /sys/class/power_supply/AC/online) +if [[ $bat -le 20 ]]; then + if [[ ! -f /tmp/battery_warning_send ]]; then + dunstify -u "critical" "Battery warning!" "Battery is at ${bat}% - please attach charger!" + touch /tmp/battery_warning_send + fi +else + rm -f /tmp/battery_warning_send +fi + if [ ! -d "/sys/class/power_supply/BAT0" ]; then bat="100" eww update batteryClass="batteryFull" @@ -8,6 +17,7 @@ if [ ! -d "/sys/class/power_supply/BAT0" ]; then elif [[ $stat == 1 ]]; then eww update batteryClass="batteryCharging" eww update batteryIcon="" + eww update batterOver="true" elif [[ $bat -le 10 ]]; then eww update batteryClass="batteryEmpty" eww update batteryIcon="" diff --git a/home/programs/river/default.nix b/home/programs/river/default.nix index 95a50be..e0af7f4 100644 --- a/home/programs/river/default.nix +++ b/home/programs/river/default.nix @@ -1,9 +1,13 @@ -{ pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { home.packages = with pkgs; [ wlr-randr - yad slurp grim wl-clipboard @@ -39,7 +43,7 @@ extraConfig = "rivertile -view-padding 0 -outer-padding 0 &"; settings = { spawn = [ - "/home/elias/.config/helperscripts/startEww.sh" + "/home/${config.home.username}/.config/helperscripts/startEww.sh" # "nextcloud" ]; spawn-tagmask = "${all_but_scratch_tag}"; @@ -66,23 +70,23 @@ normal = { "Super+Shift Return" = "spawn alacritty"; # Messages - "Control+Super W" = "spawn 'yad --text=\"Hello from Wayland!\" --button=OK'"; + "Control+Super W" = "spawn 'printf \"Hello from Wayland!\" | dunstify -'"; # System "Super P" = "spawn 'rofi -show drun'"; "Super+Shift C" = "close"; # Screenshots "None Print" = - "spawn 'grim ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Whole Screen to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Whole Screen to File + "spawn 'grim ~/Pictures/screenhot_$(date +%F_%H-%M-%S).png;/home/${config.home.username}/.config/helperscripts/screenshot-whole-file.sh'"; # Whole Screen to File "Super Print" = - "spawn 'grim -g \"$(slurp)\" ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Selection to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Selection to File + "spawn 'grim -g \"$(slurp)\" ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png;/home/${config.home.username}/.config/helperscripts/screenshot-selection-file.sh'"; # Selection to File "Shift Print" = - "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" ~/Pictures/active_window_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Active Window to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Active Window to File + "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" ~/Pictures/active_window_$(date +%F_%H-%M-%S).png;/home/${config.home.username}/.config/helperscripts/screenshot-active-window.sh'"; # Active Window to File "Control Print" = - "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Whole Screen to Clipboard\"'"; # Whole Screen to Clipboard + "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png;/home/${config.home.username}/.config/helperscripts/screenshot-whole-clipboard.sh'"; # Whole Screen to Clipboard "Control+Super Print" = - "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Selection to Clipboard\"'"; # Selection to Clipboard + "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png;/home/${config.home.username}/.config/helperscripts/screenshot-selection-clipboard.sh'"; # Selection to Clipboard "Control+Shift Print" = - "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" - | wl-copy --type image/png; yad --text=\"Screenshot - Active Window to Clipboard\"'"; # Active Window to Clipboard + "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" - | wl-copy --type image/png;/home/${config.home.username}/.config/helperscripts/screenshot-active-clipboard.sh'"; # Active Window to Clipboard # Window Control "Super J" = "focus-view next"; "Super K" = "focus-view previous"; @@ -132,7 +136,7 @@ # Program "Super C" = "spawn 'firefox'"; "Super Y" = "spawn 'signal-desktop'"; - "Super X" = "spawn 'telegram-desktop'"; + "Super X" = "spawn 'Telegram'"; "Super V" = "spawn 'thunderbird'"; } // genTagMappings (i: "Super ${i}") (i: "set-focused-tags ${tags i}") diff --git a/home/programs/river/src/screenshot-active-clipboard.sh b/home/programs/river/src/screenshot-active-clipboard.sh new file mode 100755 index 0000000..30a1d7c --- /dev/null +++ b/home/programs/river/src/screenshot-active-clipboard.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Active Window Screen to Clipboard" diff --git a/home/programs/river/src/screenshot-active-file.sh b/home/programs/river/src/screenshot-active-file.sh new file mode 100755 index 0000000..d335539 --- /dev/null +++ b/home/programs/river/src/screenshot-active-file.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Active Window to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))" diff --git a/home/programs/river/src/screenshot-selection-clipboard.sh b/home/programs/river/src/screenshot-selection-clipboard.sh new file mode 100755 index 0000000..93d565e --- /dev/null +++ b/home/programs/river/src/screenshot-selection-clipboard.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Selection to Clipboard" diff --git a/home/programs/river/src/screenshot-selection-file.sh b/home/programs/river/src/screenshot-selection-file.sh new file mode 100755 index 0000000..b1671ae --- /dev/null +++ b/home/programs/river/src/screenshot-selection-file.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Selection to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))" diff --git a/home/programs/river/src/screenshot-whole-clipboard.sh b/home/programs/river/src/screenshot-whole-clipboard.sh new file mode 100755 index 0000000..c0aa236 --- /dev/null +++ b/home/programs/river/src/screenshot-whole-clipboard.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Whole Screen to Clipboard" diff --git a/home/programs/river/src/screenshot-whole-file.sh b/home/programs/river/src/screenshot-whole-file.sh new file mode 100755 index 0000000..9ac6e5c --- /dev/null +++ b/home/programs/river/src/screenshot-whole-file.sh @@ -0,0 +1 @@ +dunstify "Screenshot" "Whole Screen to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))" diff --git a/home/programs/swww/default.nix b/home/programs/swww/default.nix index e531258..1348738 100644 --- a/home/programs/swww/default.nix +++ b/home/programs/swww/default.nix @@ -6,6 +6,6 @@ ]; xsession.initExtra = '' swww-daemon - swww img "/etc/nixos/home/programs/wallpaper/background_temp.jpeg" fill + swww img "/etc/nixos/home/programs/swww/background_temp.jpeg" fill ''; } diff --git a/machines/configuration-desktop.nix b/machines/configuration-desktop.nix index 51b2ee4..a3a3cf4 100644 --- a/machines/configuration-desktop.nix +++ b/machines/configuration-desktop.nix @@ -1,13 +1,19 @@ { pkgs, ... }: { - imports = [ ./hardware-configuration-desktop.nix ./../configuration.nix ]; + imports = [ + ./hardware-configuration-desktop.nix + ./../configuration.nix + ]; networking.hostName = "eliasDesktop"; services.blueman.enable = true; hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; + # Hyprlock + security.pam.services.hyprlock = { }; + environment.systemPackages = with pkgs; [ networkmanager-vpnc networkmanagerapplet diff --git a/machines/configuration-laptop.nix b/machines/configuration-laptop.nix index a883eaf..0b1eaf9 100644 --- a/machines/configuration-laptop.nix +++ b/machines/configuration-laptop.nix @@ -17,6 +17,18 @@ }; }; + # Hyprlock + security.pam.services = { + hyprlock = { + text = '' + auth sufficient pam_fprint.so + auth include login + ''; + }; + sudo.fprintAuth = true; + login.fprintAuth = true; + }; + # ── Bluetooth ───────────────────────────────────────────────────────── services.blueman.enable = true; hardware.bluetooth = {