From 3f17fea0afa2a7d2c49f6a9cbd16e5a7b2324f65 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 15:54:02 +0200 Subject: [PATCH 1/4] Add gh-notify script --- home/packages/cli/scripts/default.nix | 1 + .../packages/cli/scripts/packages/default.nix | 1 + .../scripts/packages/gh-notify/default.nix | 16 + .../scripts/packages/gh-notify/gh-notify.sh | 330 ++++++++++++++++++ home/programs/terminal/tools/git/gh.nix | 2 +- 5 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 home/packages/cli/scripts/packages/gh-notify/default.nix create mode 100644 home/packages/cli/scripts/packages/gh-notify/gh-notify.sh diff --git a/home/packages/cli/scripts/default.nix b/home/packages/cli/scripts/default.nix index 307edbb..1149e67 100644 --- a/home/packages/cli/scripts/default.nix +++ b/home/packages/cli/scripts/default.nix @@ -10,5 +10,6 @@ in { cheatsh colors256 unix + gh-notify ]; } diff --git a/home/packages/cli/scripts/packages/default.nix b/home/packages/cli/scripts/packages/default.nix index 2d9e5d7..d4c4f7f 100644 --- a/home/packages/cli/scripts/packages/default.nix +++ b/home/packages/cli/scripts/packages/default.nix @@ -7,6 +7,7 @@ cheatsh = pkgs.callPackage ./cheatsh {}; colors256 = pkgs.callPackage ./colors256 {}; unix = pkgs.callPackage ./unix {}; + gh-notify = pkgs.callPackage ./gh-notify {}; }; in packages diff --git a/home/packages/cli/scripts/packages/gh-notify/default.nix b/home/packages/cli/scripts/packages/gh-notify/default.nix new file mode 100644 index 0000000..cd35398 --- /dev/null +++ b/home/packages/cli/scripts/packages/gh-notify/default.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: +(pkgs.writeShellApplication { + name = "gh-notify"; + runtimeInputs = with pkgs; [ + coreutils + findutils + gawk + libnotify + gh # we also need gh-notify plugin, this assumes it's installed + ]; + text = '' + ${builtins.readFile ./gh-notify.sh} + ''; +}) + + diff --git a/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh new file mode 100644 index 0000000..206cfc8 --- /dev/null +++ b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh @@ -0,0 +1,330 @@ +#!/bin/sh + +# Parse arguments +# ------------------------------------------------------------------------------------ +ALL=0 +VERBOSE=0 +VERY_VERBOSE=0 +VERY_VERY_VERBOSE=0 +TEMP_SHOW=0 +DRY_RUN=0 +NO_CACHE=0 +NO_DISPLAY=0 +MAX_AMOUNT=0 +URGENCY="normal" +RESET=0 +while [ "${1-}" ]; do + case "$1" in + -h | --help) + cat </dev/null; then + printf "%s\n" "$file_name" >>"$fail_files_file" + fi + else + [ $VERY_VERY_VERBOSE -eq 1 ] && echo "Tempfile removal skipped (dry-run)" + fi + + # Add a new-line separator on very very verbose to group prints from each iteration + [ $VERY_VERY_VERBOSE -eq 1 ] && echo "" + done + + # Recover failed files from the temporary file + failed_files="$(cat "$fail_files_file")" + failed="$(printf "%s" "$fail_files_file" | wc -l)" + rm "$fail_files_file" + + if [ $VERBOSE -eq 1 ]; then + echo "Notification cache was reset." + removed_count="$(("$total" - "$failed"))" + if [ $DRY_RUN -eq 1 ]; then + echo "Removed $removed_count files (dry-run: no files were actually removed)" + else + echo "Removed $removed_count files" + fi + fi + + # If some cache files were'nt removed successfully, inform the user about it + # regardless of verbosity, this shouldn't go silent, even though it may be fine + if [ "$failed" -gt 0 ]; then + echo "WARNING: Failed to remove $failed files." + echo "You probably don't have permission to remove these." + echo "Perhaps these were made by someone else? If so, you can ignore this warning." + if [ $VERBOSE -eq 0 ]; then + echo "Run with --verbose to show exactly which files weren't removed." + else + echo "These are:" + echo "$failed_files" + fi + fi + else + [ $VERBOSE -eq 1 ] && echo "No cache files found, nothing to reset" + fi + exit 0 +fi + +# Helper functins +# ------------------------------------------------------------------------------------ +# This runs notify-send, and if NO_DISPLAY is set and we're running in headless +# mode, this will still try to send the notification by manually setting DISPLAY +# This also has a special handle that checks if dunst is the notification daemon +# in which case instead of using notify-send, we use dunstify to send the +# notification, with which we can also specify some more values. +send_notify() { + if [ $NO_DISPLAY -eq 1 ]; then + XDG_RUNTIME_DIR="/run/user/$(id -u)" \ + DISPLAY=:0 \ + notify-send -i "$HOME/.local/share/icons/hicolor/64x64/apps/github-notification.png" --app-name=github-notification --urgency="$URGENCY" "$1" "$2" + else + notify-send -i "$HOME/.local/share/icons/hicolor/64x64/apps/github-notification.png" --app-name=github-notification --urgency="$URGENCY" "$1" "$2" + fi +} + +# Obtain notifications and show them, if they weren't showed (aren't in cache) already +# ------------------------------------------------------------------------------------ +# Request unread notifications with gh-notify extension for github-cli +[ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT" 2>/dev/null)" || out="$(gh notify -s -n "$MAX_AMOUNT" 2>/dev/null)" + +# When no notifications were found, set output to empty string, to avoid 'All caught up!' line +# being treated as notification +if [ "$out" == "All caught up!" ]; then + out="" +fi + +total="$(printf "%s\n" "$out" | wc -l)" +# Since we always end with a newline (to count the last entry as a line), we always get +# at least 1 as a total here, even if $out is empty. If we didn't use the \n, we'd always +# get 0, even if there was a single line, since it wasn't ended with a newline. To figure +# out whether there really is a line or not when we get a total of 1, we run character +# amount check as well +[ "$total" -eq 1 ] && [ "$(printf "%s" "$out" | wc -c)" -eq 0 ] && total=0 + +# Only run if we actually found some notifications +if [ "$total" -gt 0 ]; then + # Since the loop is running in a pipe, it can't modify variables, but we need to know + # how many notifications were sent, so to ge that information, we store it in a + # temporary file + sent_count_file="$(mktemp)" + printf "0" >"$sent_count_file" + + # Go through each notification, one by one + printf "%s\n" "$out" | while read -r line; do + + [ $VERY_VERY_VERBOSE -eq 1 ] && echo "gh-notify output line: $line" + + # Parse out the data from given output lines + issue_type="$(echo "$line" | awk '{print $4}' | sed 's/\x1b\[[0-9;]*m//g')" + repo_id="$(echo "$line" | awk '{print $3}' | sed 's/\x1b\[[0-9;]*m//g')" + + if [ "$issue_type" == "PullRequest" ]; then + issue_id="$(echo "$line" | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)" + description="$(echo "$line" | awk '{for (i=6; i"$temp_file" + hashsum="$(sum <"$temp_file" | cut -f 1 -d ' ')" + rm "$temp_file" + + tmpname="/tmp/gh-notification-$hashsum" + [ $TEMP_SHOW -eq 1 ] && echo "Tempfile: $tmpname" + + # If the temporary file is already present, this notification was already + # send and we don't want to re-send it + + # Only sent the notification if it wasn't already cached (doesn't have temp file) + # this avoids resending the same notifications + if [ ! -e "$tmpname" ] || [ $NO_CACHE -eq 1 ]; then + if [ $DRY_RUN -eq 1 ]; then + [ $VERY_VERBOSE -eq 1 ] && echo "Sending notification (dry-run, no actual notification was sent)" + else + [ $VERY_VERBOSE -eq 1 ] && echo "Sending notification" + send_notify "$name" "$description <$url>" + # Create the tempfile so that in the next run, we won't resend this notification again + # NOTE: We're storing the name and description into this file to make it easier + # to figure out what notification the tempfile belongs to, with ~@~ separator + printf "%s~@~%s" "$name" "$description" >"$tmpname" + fi + # Keep track of how many notifications were sent (didn't have a cache file) + sent="$(cat "$sent_count_file")" + sent="$(("$sent" + 1))" + printf "%s" "$sent" >"$sent_count_file" + else + [ $VERY_VERBOSE -eq 1 ] && echo "Skipping (cached) - notification already sent" + fi + + # Add a new-line separator on very verbose to group prints from each iteration + [ $VERY_VERBOSE -eq 1 ] && echo "" + done + + # Recover amount of sent notifications from the temporary file + sent="$(cat "$sent_count_file")" + rm "$sent_count_file" + + if [ $VERBOSE -eq 1 ]; then + unsent="$(("$total" - "$sent"))" + if [ "$sent" -eq "$total" ]; then + echo "Found and sent $total new notifications" + elif [ "$unsent" -eq "$total" ]; then + echo "Found $total notifications, all of which were already sent (no new notifications to send)" + else + echo "Found $total notifications, of which $sent were new and sent ($unsent were skipped - cached/already sent)" + fi + fi +else + [ $VERBOSE -eq 1 ] && echo "No new notifications" +fi diff --git a/home/programs/terminal/tools/git/gh.nix b/home/programs/terminal/tools/git/gh.nix index f10dc7f..05e2e69 100644 --- a/home/programs/terminal/tools/git/gh.nix +++ b/home/programs/terminal/tools/git/gh.nix @@ -6,7 +6,7 @@ gh-dash # dashboard with pull requess and issues gh-eco # explore the ecosystem gh-cal # contributions calendar terminal viewer - # TODO: Include meiji163/gh-notify + gh-notify # access and manage github notifications ]; settings = { git_protocol = "ssh"; From 036b1a90641d79d863a2439e93f29832f01b6683 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 15:59:11 +0200 Subject: [PATCH 2/4] Add quick-record script --- .../graphical/wms/hyprland/default.nix | 1 + .../wms/hyprland/packages/default.nix | 1 + .../packages/hyprland-screenshot/default.nix | 7 -- .../packages/quick-record/default.nix | 16 ++++ .../packages/quick-record/quick-record.sh | 96 +++++++++++++++++++ 5 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/quick-record/default.nix create mode 100644 home/programs/graphical/wms/hyprland/packages/quick-record/quick-record.sh diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index fac274d..65bbb1c 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -18,6 +18,7 @@ in { home.packages = [ hyprPkgs.hyprland-move-window hyprPkgs.hyprland-screenshot + hyprPkgs.quick-record pkgs.brightnessctl pkgs.hyprpicker hyprPkgs.brightness diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index c3d2e3a..2a178f7 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -6,6 +6,7 @@ hyprland-move-window = pkgs.callPackage ./hyprland-move-window {}; brightness = pkgs.callPackage ./brightness {}; hyprland-screenshot = pkgs.callPackage ./hyprland-screenshot {}; + quick-record = pkgs.callPackage ./quick-record {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-screenshot/default.nix b/home/programs/graphical/wms/hyprland/packages/hyprland-screenshot/default.nix index 06cfe2e..94f27d4 100644 --- a/home/programs/graphical/wms/hyprland/packages/hyprland-screenshot/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/hyprland-screenshot/default.nix @@ -1,11 +1,4 @@ # - `grim`: screenshot utility for wayland -# - `slurp`: to select an area -# - `hyprctl`: to read properties of current window -# - `wl-copy`: clipboard utility -# - `jq`: json utility to parse hyprctl output -# - `notify-send`: to show notifications -# - `swappy`: for editing the screenshots (only required for --edit) - {pkgs, ...}: pkgs.writeShellApplication { name = "hyprland-screenshot"; diff --git a/home/programs/graphical/wms/hyprland/packages/quick-record/default.nix b/home/programs/graphical/wms/hyprland/packages/quick-record/default.nix new file mode 100644 index 0000000..7d85224 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/quick-record/default.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: +pkgs.writeShellApplication { + name = "quick-record"; + runtimeInputs = with pkgs; [ + slurp + wl-clipboard + libnotify + procps + killall + wf-recorder + ]; + text = '' + ${builtins.readFile ./quick-record.sh} + ''; +} + diff --git a/home/programs/graphical/wms/hyprland/packages/quick-record/quick-record.sh b/home/programs/graphical/wms/hyprland/packages/quick-record/quick-record.sh new file mode 100644 index 0000000..9e4c751 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/quick-record/quick-record.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +EXTENSION="mp4" +NOTIFY=0 + +save_file() { + wl-copy -t text/uri-list "file://${file}" + [ "$NOTIFY" -eq 1 ] && notify-send -a "quick-record" "Recording saved" "$file " + echo "Recording saved: $file" +} + +stop_recording() { + if pidof -s wf-recorder >/dev/null 2>&1; then + [ "$NOTIFY" -eq 1 ] && notify-send -a "quick-record" "Recording stopped" + killall -s SIGINT wf-recorder + else + >&2 echo "No active recording to stop" + return 1 + fi +} + +start_recording() { + # Remove all previous recordings + # No need to clutter /tmp, since this is used for copying the recording + # as a file, it's unlikely that we'll need any of the old recordings + # when a new one is requested + rm "${TMPDIR:-/tmp}"/wf-recorder-video-*."$EXTENSION" 2>/dev/null || true + + file="$(mktemp -t "wf-recorder-video-XXXXX.$EXTENSION")" + geom="$(slurp)" + + [ "$NOTIFY" -eq 1 ] && notify-send "quick-record" "Recording starting" + + trap save_file SIGINT + trap save_file SIGTERM + trap save_file SIGHUP + + # Wee need 'y' stdin to confirm that we want to override the file + # since mktemp creates a blank file there already + echo "y" | wf-recorder -g "$geom" -f "$file" + + # If wf-recorder process ends directly, rather than a trap being hit + # we also want to run the save_file func + save_file +} + +# Parse any CLI flags first, before getting to positional args +# (As long as we have $2, meaning there's at least 2 args, treat + +# $1 arg as CLI flag``) +while [ "${2-}" ]; do + case "$1" in + -h | --help) + cat </dev/null; then + exit 0 + else + start_recording + fi +else + >&2 echo "Error: No argument provided!" + >&2 echo "Expected one of: start, stop, toggle" + exit 1 +fi From 3cb701b0420647d9cd09a9d04cc904d424a1bfc1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 16:13:23 +0200 Subject: [PATCH 3/4] Add toggle-fake-fullscreen script --- .../wms/hyprland/config/keybinds.nix | 1 + .../graphical/wms/hyprland/default.nix | 3 ++- .../wms/hyprland/packages/default.nix | 1 + .../toggle-fake-fullscreen/default.nix | 14 ++++++++++++ .../toggle-fake-fullscreen.sh | 22 +++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index 9b3143f..27a5760 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -20,6 +20,7 @@ "SUPER, F, togglefloating," "SUPER, Space, fullscreen, 0" "SUPER_SHIFT, Space, fullscreen, 1" # maximize + "CTRL_SHIFT, Space, exec, toggle-fake-fullscreen" # fake fullscreen + custom border "SUPER_SHIFT, S, layoutmsg, togglesplit" # diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index 65bbb1c..5ad154e 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -19,9 +19,10 @@ in { hyprPkgs.hyprland-move-window hyprPkgs.hyprland-screenshot hyprPkgs.quick-record + hyprPkgs.toggle-fake-fullscreen + hyprPkgs.brightness pkgs.brightnessctl pkgs.hyprpicker - hyprPkgs.brightness ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 2a178f7..ea0fc72 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -7,6 +7,7 @@ brightness = pkgs.callPackage ./brightness {}; hyprland-screenshot = pkgs.callPackage ./hyprland-screenshot {}; quick-record = pkgs.callPackage ./quick-record {}; + toggle-fake-fullscreen = pkgs.callPackage ./toggle-fake-fullscreen {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix new file mode 100644 index 0000000..27f8303 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: +pkgs.writeShellApplication { + name = "toggle-fake-fullscreen"; + runtimeInputs = with pkgs; [ + coreutils + jq + hyprland + ]; + text = '' + ${builtins.readFile ./toggle-fake-fullscreen.sh} + ''; +} + + diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh new file mode 100644 index 0000000..69f2666 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +#ACTIVE_BORDER_COLOR="0xFF327BD1" +ACTIVE_BORDER_COLOR="0xFFFF6600" +DEFAULT_BORDER_COLOR="0xFFFFA500" + +hyprctl dispatch fakefullscreen "" + +fullscreen_status="$(hyprctl activewindow -j | jq '.fakeFullscreen')" +if [ "$fullscreen_status" = "null" ]; then + echo "Update your hyprland, 'fakeFullscreen' window property not found." + exit 1 +elif [ "$fullscreen_status" = "true" ]; then + window_address="$(hyprctl activewindow -j | jq -r '.address')" + hyprctl setprop "address:$window_address" activebordercolor "$ACTIVE_BORDER_COLOR" lock +elif [ "$fullscreen_status" = "false" ]; then + window_address="$(hyprctl activewindow -j | jq -r '.address')" + hyprctl setprop "address:$window_address" activebordercolor "$DEFAULT_BORDER_COLOR" +else + echo "Unexpected output from 'fakeFullscreen' window property: $fullscreen_status" + exit 1 +fi From b3f457340d01907f09aedd13bbbfed49a50a4549 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 16:19:55 +0200 Subject: [PATCH 4/4] Add toggle-notifications script & notification keybinds --- .../graphical/wms/hyprland/config/keybinds.nix | 7 +++++-- home/programs/graphical/wms/hyprland/default.nix | 1 + .../graphical/wms/hyprland/packages/default.nix | 1 + .../packages/toggle-notifications/default.nix | 15 +++++++++++++++ .../toggle-notifications/toggle-notifications.sh | 10 ++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-notifications/default.nix create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-notifications/toggle-notifications.sh diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index 27a5760..5ae8a89 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -74,8 +74,11 @@ # # Notifications # - # TODO: Requires notification daemon (dunst?) - + "CTRL, grave, exec, dunstctl close" + "CTRL_SHIFT, grave, exec, dunstctl close-all" + "CTRL, period, exec, dunstctl history-pop" + "CTRL_SHIFT, period, exec, dunstctl context" + "SUPER_SHIFT, D, exec, toggle-notifications" # # Window groups diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index 5ad154e..6c31cf0 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -20,6 +20,7 @@ in { hyprPkgs.hyprland-screenshot hyprPkgs.quick-record hyprPkgs.toggle-fake-fullscreen + hyprPkgs.toggle-notifications hyprPkgs.brightness pkgs.brightnessctl pkgs.hyprpicker diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index ea0fc72..2f15f04 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -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 diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-notifications/default.nix b/home/programs/graphical/wms/hyprland/packages/toggle-notifications/default.nix new file mode 100644 index 0000000..bf909f0 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-notifications/default.nix @@ -0,0 +1,15 @@ +{pkgs, ...}: +pkgs.writeShellApplication { + name = "toggle-notifications"; + runtimeInputs = with pkgs; [ + coreutils + libnotify + dunst + ]; + text = '' + ${builtins.readFile ./toggle-notifications.sh} + ''; +} + + + diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-notifications/toggle-notifications.sh b/home/programs/graphical/wms/hyprland/packages/toggle-notifications/toggle-notifications.sh new file mode 100644 index 0000000..b3d3313 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-notifications/toggle-notifications.sh @@ -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