Add toggle-notifications script & notification keybinds

This commit is contained in:
ItsDrike 2024-06-21 16:19:55 +02:00
parent 3cb701b042
commit b3f457340d
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
5 changed files with 32 additions and 2 deletions

View file

@ -8,6 +8,7 @@
hyprland-screenshot = pkgs.callPackage ./hyprland-screenshot {};
quick-record = pkgs.callPackage ./quick-record {};
toggle-fake-fullscreen = pkgs.callPackage ./toggle-fake-fullscreen {};
toggle-notifications = pkgs.callPackage ./toggle-notifications {};
};
in
packages

View file

@ -0,0 +1,15 @@
{pkgs, ...}:
pkgs.writeShellApplication {
name = "toggle-notifications";
runtimeInputs = with pkgs; [
coreutils
libnotify
dunst
];
text = ''
${builtins.readFile ./toggle-notifications.sh}
'';
}

View file

@ -0,0 +1,10 @@
#!/bin/sh
if [ "$(dunstctl is-paused)" = "false" ]; then
notify-send "Notifications" "Pausing notifications..." -h string:x-canonical-private-synchronous:notif-pause
sleep 2
dunstctl set-paused true
else
dunstctl set-paused false
notify-send "Notifications" "Notifications enabled" -h string:x-canonical-private-synchronous:notif-pause
fi