aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/common
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/common')
-rwxr-xr-xdotfiles/common/.local/bin/notify43
-rw-r--r--dotfiles/common/.local/share/sounds/notify/alarm.oggbin45775 -> 49034 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/alert.oggbin41684 -> 37850 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/bug.oggbin10187 -> 8522 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/fail.oggbin74886 -> 64144 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/info.oggbin31466 -> 29007 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/question.oggbin49846 -> 46024 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/security.oggbin19910 -> 19963 bytes
-rw-r--r--dotfiles/common/.local/share/sounds/notify/success.oggbin39244 -> 34480 bytes
9 files changed, 35 insertions, 8 deletions
diff --git a/dotfiles/common/.local/bin/notify b/dotfiles/common/.local/bin/notify
index a89a3ff..6918e01 100755
--- a/dotfiles/common/.local/bin/notify
+++ b/dotfiles/common/.local/bin/notify
@@ -3,7 +3,7 @@
# notify - Display notifications with icons and sounds
#
# Usage:
-# notify <type> "title" "body" [--persist]
+# notify <type> "title" "body" [--persist] [--silent]
#
# Types:
# success - Green checkmark, pleasant chime
@@ -17,12 +17,17 @@
#
# Options:
# --persist Don't auto-dismiss (stays until manually closed)
+# --silent Show the notification but play no sound
+#
+# Environment:
+# NOTIFY_VOLUME Playback volume for the sound (paplay scale: 65536 = 100%).
+# Lower it to soften every notification without re-encoding
+# the sound files. Default 65536.
#
# Examples:
# notify success "Job Complete" "Download finished in 12 minutes"
# notify fail "Job Failed" "Connection refused" --persist
-# notify alert "Warning" "Network speed reduced"
-# notify question "Input Needed" "Continue or abort?"
+# notify info "Touchpad" "Disabled" --silent
set -euo pipefail
@@ -31,7 +36,7 @@ SOUND_DIR="$HOME/.local/share/sounds/notify"
usage() {
cat <<EOF
-Usage: notify <type> "title" "body" [--persist]
+Usage: notify <type> "title" "body" [--persist] [--silent]
Types:
success Green checkmark, pleasant chime
@@ -45,10 +50,15 @@ Types:
Options:
--persist Don't auto-dismiss notification
+ --silent Show the notification but play no sound
+
+Environment:
+ NOTIFY_VOLUME Sound playback volume (paplay scale: 65536 = 100%)
Examples:
notify success "Job Complete" "Download finished"
notify fail "Build Failed" "Test errors" --persist
+ notify info "Touchpad" "Disabled" --silent
EOF
exit 1
}
@@ -61,7 +71,24 @@ fi
TYPE="$1"
TITLE="$2"
BODY="$3"
-PERSIST="${4:-}"
+shift 3
+
+# Optional flags, in any order
+PERSIST=""
+SILENT=""
+for arg in "$@"; do
+ case "$arg" in
+ --persist) PERSIST="--persist" ;;
+ --silent) SILENT=1 ;;
+ *)
+ echo "Error: Unknown option '$arg'" >&2
+ usage
+ ;;
+ esac
+done
+
+# Master playback volume (paplay scale: 65536 = 100%)
+NOTIFY_VOLUME="${NOTIFY_VOLUME:-65536}"
# Validate type and set icon/sound
case "$TYPE" in
@@ -129,9 +156,9 @@ if [[ -f "$ICON" ]]; then
NOTIFY_ARGS+=(--icon="$ICON")
fi
-# Play sound in background (if it exists)
-if [[ -f "$SOUND" ]]; then
- paplay "$SOUND" &
+# Play sound in background (unless silenced, and if the file exists)
+if [[ -z "$SILENT" && -f "$SOUND" ]]; then
+ paplay --volume="$NOTIFY_VOLUME" "$SOUND" &
fi
# Send notification
diff --git a/dotfiles/common/.local/share/sounds/notify/alarm.ogg b/dotfiles/common/.local/share/sounds/notify/alarm.ogg
index b4dff15..de9b0b7 100644
--- a/dotfiles/common/.local/share/sounds/notify/alarm.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/alarm.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/alert.ogg b/dotfiles/common/.local/share/sounds/notify/alert.ogg
index 217f33a..9001f2a 100644
--- a/dotfiles/common/.local/share/sounds/notify/alert.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/alert.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/bug.ogg b/dotfiles/common/.local/share/sounds/notify/bug.ogg
index 6842082..a1bfb03 100644
--- a/dotfiles/common/.local/share/sounds/notify/bug.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/bug.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/fail.ogg b/dotfiles/common/.local/share/sounds/notify/fail.ogg
index 916d88a..e4f067f 100644
--- a/dotfiles/common/.local/share/sounds/notify/fail.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/fail.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/info.ogg b/dotfiles/common/.local/share/sounds/notify/info.ogg
index 57900b4..0dc8e10 100644
--- a/dotfiles/common/.local/share/sounds/notify/info.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/info.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/question.ogg b/dotfiles/common/.local/share/sounds/notify/question.ogg
index 8e44c55..2a6017e 100644
--- a/dotfiles/common/.local/share/sounds/notify/question.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/question.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/security.ogg b/dotfiles/common/.local/share/sounds/notify/security.ogg
index 301287e..d2ecd20 100644
--- a/dotfiles/common/.local/share/sounds/notify/security.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/security.ogg
Binary files differ
diff --git a/dotfiles/common/.local/share/sounds/notify/success.ogg b/dotfiles/common/.local/share/sounds/notify/success.ogg
index c28da65..6bf93fe 100644
--- a/dotfiles/common/.local/share/sounds/notify/success.ogg
+++ b/dotfiles/common/.local/share/sounds/notify/success.ogg
Binary files differ