Standardize all notification sending

This commit is contained in:
David Heinemeier Hansson
2026-05-17 19:51:29 +02:00
parent 682c6406bd
commit 4e2da8480a
24 changed files with 62 additions and 90 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}"
if [[ ! -d $OUTPUT_DIR ]]; then if [[ ! -d $OUTPUT_DIR ]]; then
mkdir -p "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR"
notify-send -a omarchy-action "Created screenshot directory: $OUTPUT_DIR" -u normal -t 2000 omarchy-notification-send "Created screenshot directory: $OUTPUT_DIR" -t 2000
fi fi
pkill slurp && exit 0 pkill slurp && exit 0
+1 -1
View File
@@ -23,4 +23,4 @@ TEXT=$(grim -g "$SELECTION" - | tesseract stdin stdout --oem 1 --psm 6 -l "${OMA
[[ -z $TEXT ]] && exit 1 [[ -z $TEXT ]] && exit 1
printf "%s" "$TEXT" | wl-copy printf "%s" "$TEXT" | wl-copy
notify-send -a omarchy-action "󰴑 Copied text from selection to clipboard" omarchy-notification-send -g 󰴑 "Copied text from selection to clipboard"
+1 -1
View File
@@ -37,4 +37,4 @@ xdg-mime default "$desktop_id" x-scheme-handler/http
xdg-mime default "$desktop_id" x-scheme-handler/https xdg-mime default "$desktop_id" x-scheme-handler/https
xdg-mime default "$desktop_id" text/html xdg-mime default "$desktop_id" text/html
notify-send -a omarchy-action -u low "$glyph $name is now the default browser" omarchy-notification-send -g $glyph "$name is now the default browser"
+1 -1
View File
@@ -27,4 +27,4 @@ esac
sed -i "s/^export EDITOR=.*/export EDITOR=$editor/" ~/.config/uwsm/default sed -i "s/^export EDITOR=.*/export EDITOR=$editor/" ~/.config/uwsm/default
export EDITOR="$editor" export EDITOR="$editor"
notify-send -a omarchy-action -u low "$glyph $name is now the default editor" " Effective after logging out" omarchy-notification-send -g $glyph "$name is now the default editor" "Effective after logging out"
+1 -1
View File
@@ -33,4 +33,4 @@ cat >~/.config/xdg-terminals.list <<EOF
$desktop_id $desktop_id
EOF EOF
notify-send -a omarchy-action -u low "$glyph $name is now the default terminal" omarchy-notification-send -g $glyph "$name is now the default terminal"
+2 -2
View File
@@ -38,11 +38,11 @@ if [[ -n $font_name ]]; then
omarchy-restart-shell omarchy-restart-shell
if pgrep -x ghostty; then if pgrep -x ghostty; then
notify-send -a omarchy-action -u low " You must restart Ghostty to see font change" omarchy-notification-send -g  "You must restart Ghostty to see font change"
fi fi
if pgrep -x foot; then if pgrep -x foot; then
notify-send -a omarchy-action -u low " You must restart Foot to see font change" omarchy-notification-send -g  "You must restart Foot to see font change"
fi fi
omarchy-hook font-set "$font_name" omarchy-hook font-set "$font_name"
+2 -2
View File
@@ -10,7 +10,7 @@ if (( $# == 0 )); then
mapfile -t cores < <(omarchy-games-retro-cores) mapfile -t cores < <(omarchy-games-retro-cores)
if (( ${#cores[@]} == 0 )); then if (( ${#cores[@]} == 0 )); then
omarchy-notification-send -g "󰯉" "No RetroArch cores found" "/usr/lib/libretro" omarchy-notification-send -g 󰯉 "No RetroArch cores found" "/usr/lib/libretro"
exit 1 exit 1
fi fi
@@ -73,4 +73,4 @@ EOF
chmod +x "$desktop_file" chmod +x "$desktop_file"
update-desktop-database "$desktop_dir" &>/dev/null || true update-desktop-database "$desktop_dir" &>/dev/null || true
omarchy-notification-send -g "󰯉" "$game_name installed" "Start it with Super + Space" omarchy-notification-send -g 󰯉 "$game_name installed" "Start it with Super + Space"
+6 -29
View File
@@ -1,35 +1,14 @@
#!/bin/bash #!/bin/bash
# omarchy:summary=Toggle permanent Hyprland flags by copying them into a directory that's sourced entirely. # omarchy:summary=Toggle permanent Hyprland flags by copying them into a directory that's sourced entirely.
# omarchy:args=[--enabled-notification <text>] [--disabled-notification <text>] <flag-name> [on|off|toggle] # omarchy:args=<flag-name> [on|off|toggle]
ENABLED_NOTIFICATION="" usage() {
DISABLED_NOTIFICATION="" echo "Usage: omarchy-hyprland-toggle <flag-name> [on|off|toggle]" >&2
}
while (($# > 0)); do
case $1 in
--enabled-notification)
if (($# < 2)); then
echo "Missing value for $1" >&2
exit 1
fi
ENABLED_NOTIFICATION="$2"
shift 2
;;
--disabled-notification)
if (($# < 2)); then
echo "Missing value for $1" >&2
exit 1
fi
DISABLED_NOTIFICATION="$2"
shift 2
;;
*) break ;;
esac
done
if (($# < 1)); then if (($# < 1)); then
echo "Usage: omarchy-hyprland-toggle [--enabled-notification <text>] [--disabled-notification <text>] <flag-name> [on|off|toggle]" >&2 usage
exit 1 exit 1
fi fi
@@ -42,7 +21,6 @@ on() {
if [[ -f $FLAG_SOURCE ]]; then if [[ -f $FLAG_SOURCE ]]; then
mkdir -p "$(dirname "$FLAG_FILE")" mkdir -p "$(dirname "$FLAG_FILE")"
cp "$FLAG_SOURCE" "$FLAG_FILE" cp "$FLAG_SOURCE" "$FLAG_FILE"
[[ -n $ENABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$ENABLED_NOTIFICATION"
else else
echo "Flag not found: $FLAG_NAME" >&2 echo "Flag not found: $FLAG_NAME" >&2
exit 1 exit 1
@@ -51,7 +29,6 @@ on() {
off() { off() {
rm -f "$FLAG_FILE" rm -f "$FLAG_FILE"
[[ -n $DISABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$DISABLED_NOTIFICATION"
} }
toggle() { toggle() {
@@ -69,7 +46,7 @@ case $ACTION in
off) off ;; off) off ;;
toggle) toggle ;; toggle) toggle ;;
*) *)
echo "Usage: omarchy-hyprland-toggle [--enabled-notification <text>] [--disabled-notification <text>] <flag-name> [on|off|toggle]" >&2 usage
exit 1 exit 1
;; ;;
esac esac
+1 -1
View File
@@ -12,4 +12,4 @@ esac
hyprctl eval "hl.workspace_rule({ workspace = \"$ACTIVE_WORKSPACE\", layout = \"$NEW_LAYOUT\" })" >/dev/null 2>&1 || \ hyprctl eval "hl.workspace_rule({ workspace = \"$ACTIVE_WORKSPACE\", layout = \"$NEW_LAYOUT\" })" >/dev/null 2>&1 || \
hyprctl keyword workspace $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT hyprctl keyword workspace $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT
notify-send -a omarchy-action -u low "󱂬 Workspace layout set to $NEW_LAYOUT" omarchy-notification-send -g 󱂬 "Workspace layout set to $NEW_LAYOUT"
+1 -1
View File
@@ -47,7 +47,7 @@ for m in $(hyprctl monitors -j | jq -r '.[] | .name'); do
hypr_exec "kitty --class=org.omarchy.screensaver --override font_size=18 --override window_padding_width=0 -e omarchy-screensaver" hypr_exec "kitty --class=org.omarchy.screensaver --override font_size=18 --override window_padding_width=0 -e omarchy-screensaver"
;; ;;
*) *)
notify-send -a omarchy-action -u low " Screensaver only runs in Alacritty, Foot, Ghostty, or Kitty" omarchy-notification-send -g "Screensaver only runs in Alacritty, Foot, Ghostty, or Kitty"
;; ;;
esac esac
done done
+8 -11
View File
@@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
# omarchy:summary=Send a desktop notification with Omarchy glyph and body spacing # omarchy:summary=Send an Omarchy desktop notification
# omarchy:args=<headline> [description] [-g <glyph>] [-u <low|normal|critical>] [notify-send options] # omarchy:args=[-g <glyph>] [-u <low|normal|critical>] <headline> [description] [notify-send options]
# omarchy:examples=omarchy notification send "Reminder" "5 minutes are up" -g 󰔛 -u critical # omarchy:examples=omarchy notification send "Reminder" "5 minutes are up" -g 󰔛 -u critical
set -euo pipefail set -euo pipefail
headline="" headline=""
description="" description=""
glyph="" glyph=
urgency="low" urgency="low"
args=() args=()
@@ -19,7 +19,7 @@ parse_omarchy_option() {
echo "Missing value for $1" >&2 echo "Missing value for $1" >&2
exit 1 exit 1
fi fi
glyph="$2" glyph=$2
return 0 return 0
;; ;;
-u | --urgency) -u | --urgency)
@@ -65,16 +65,13 @@ while (($# > 0)); do
fi fi
done done
if [[ -n $glyph ]]; then
args+=(--hint=string:omarchy-glyph:$glyph)
fi
# Tag as a user-action toast so it pops through DND. See dnd-fix-plan.md. # Tag as a user-action toast so it pops through DND. See dnd-fix-plan.md.
args+=("-a" "omarchy-action" "-u" "$urgency") args+=("-a" "omarchy-action" "-u" "$urgency")
# Send the glyph in a summary prefix inline. This keeps the notification
# thin and compact, replicating the old Mako style, because Quickshell won't
# render the 40x40 icon slot if the custom hint isn't present.
if [[ -n $glyph ]]; then
headline="$glyph $headline"
fi
if [[ -n $description ]]; then if [[ -n $description ]]; then
notify-send "${args[@]}" "$headline" "$description" notify-send "${args[@]}" "$headline" "$description"
else else
+8 -16
View File
@@ -1,27 +1,19 @@
#!/bin/bash #!/bin/bash
# omarchy:summary=Toggle Omarchy features between enabled and disabled # omarchy:summary=Toggle Omarchy features between enabled and disabled
# omarchy:args=[--enabled-notification <text>] [--disabled-notification <text>] <flag-name> # omarchy:args=<flag-name>
ENABLED_NOTIFICATION="" if (($# < 1)); then
DISABLED_NOTIFICATION="" echo "Usage: omarchy-toggle <flag-name>" >&2
exit 1
while [[ $# -gt 1 ]]; do fi
case $1 in
--enabled-notification) ENABLED_NOTIFICATION="$2"; shift 2 ;;
--disabled-notification) DISABLED_NOTIFICATION="$2"; shift 2 ;;
*) break ;;
esac
done
FLAG_NAME="$1" FLAG_NAME="$1"
FLAG="$HOME/.local/state/omarchy/toggles/$FLAG_NAME" FLAG="$HOME/.local/state/omarchy/toggles/$FLAG_NAME"
if [[ -f $FLAG ]]; then if [[ -f $FLAG ]]; then
rm $FLAG rm -f "$FLAG"
[[ -n $DISABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$DISABLED_NOTIFICATION"
else else
mkdir -p "$(dirname $FLAG)" mkdir -p "$(dirname "$FLAG")"
touch $FLAG touch "$FLAG"
[[ -n $ENABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$ENABLED_NOTIFICATION"
fi fi
+2 -2
View File
@@ -4,10 +4,10 @@
if pgrep -x hypridle >/dev/null; then if pgrep -x hypridle >/dev/null; then
pkill -x hypridle pkill -x hypridle
notify-send -a omarchy-action -u low "󱫖 Stop locking computer when idle" omarchy-notification-send -g 󱫖 "Stop locking computer when idle"
else else
uwsm-app -- hypridle >/dev/null 2>&1 & uwsm-app -- hypridle >/dev/null 2>&1 &
notify-send -a omarchy-action -u low "󱫖 Now locking computer when idle" omarchy-notification-send -g 󱫖 "Now locking computer when idle"
fi fi
omarchy-shell-ipc --if-running bar refreshIndicators >/dev/null 2>&1 || true omarchy-shell-ipc --if-running bar refreshIndicators >/dev/null 2>&1 || true
+2 -2
View File
@@ -17,8 +17,8 @@ CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+')
if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then
hyprctl hyprsunset temperature $ON_TEMP hyprctl hyprsunset temperature $ON_TEMP
notify-send -a omarchy-action -u low " Nightlight screen temperature" omarchy-notification-send -g "Nightlight screen temperature"
else else
hyprctl hyprsunset temperature $OFF_TEMP hyprctl hyprsunset temperature $OFF_TEMP
notify-send -a omarchy-action -u low " Daylight screen temperature" omarchy-notification-send -g  "Daylight screen temperature"
fi fi
+7 -4
View File
@@ -2,7 +2,10 @@
# omarchy:summary=Toggle screensaver availability # omarchy:summary=Toggle screensaver availability
omarchy-toggle \ if omarchy-toggle-enabled screensaver-off; then
--enabled-notification "󱄄 Screensaver disabled" \ omarchy-toggle screensaver-off
--disabled-notification "󱄄 Screensaver enabled" \ omarchy-notification-send -g 󱄄 "Screensaver enabled"
screensaver-off else
omarchy-toggle screensaver-off
omarchy-notification-send -g 󱄄 "Screensaver disabled"
fi
+7 -4
View File
@@ -2,7 +2,10 @@
# omarchy:summary=Toggle suspend availability in the system menu # omarchy:summary=Toggle suspend availability in the system menu
omarchy-toggle \ if omarchy-toggle-enabled suspend-off; then
--enabled-notification "󰒲 Suspend removed from system menu" \ omarchy-toggle suspend-off
--disabled-notification "󰒲 Suspend now available in system menu" \ omarchy-notification-send -g 󰒲 "Suspend now available in system menu"
suspend-off else
omarchy-toggle suspend-off
omarchy-notification-send -g 󰒲 "Suspend removed from system menu"
fi
+1 -1
View File
@@ -21,5 +21,5 @@ if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then
voxtype setup systemd voxtype setup systemd
omarchy-restart-shell omarchy-restart-shell
notify-send -a omarchy-action " Voxtype Dictation Ready" "Hold F9 to dictate (or toggle with Super + Ctrl + X)." -t 10000 omarchy-notification-send -g  "Voxtype Dictation Ready" "Hold F9 to dictate (or toggle with Super + Ctrl + X)." -t 10000
fi fi
+1 -1
View File
@@ -293,7 +293,7 @@ launch_windows() {
echo "Starting Windows VM..." echo "Starting Windows VM..."
# Send desktop notification # Send desktop notification
notify-send -a omarchy-action " Starting Windows VM" " This can take 15-30 seconds" -t 15000 omarchy-notification-send -g  "Starting Windows VM" "This can take 15-30 seconds" -t 15000
if ! docker-compose -f "$COMPOSE_FILE" up -d 2>&1; then if ! docker-compose -f "$COMPOSE_FILE" up -d 2>&1; then
echo "❌ Failed to start Windows VM!" echo "❌ Failed to start Windows VM!"
@@ -606,6 +606,7 @@ Item {
navStack = [] navStack = []
filterText = "" filterText = ""
selectedIndex = 0 selectedIndex = 0
root.evaluateGuards()
opened = true opened = true
rebuildDisplay() rebuildDisplay()
loadProviderForMenu(activeMenu) loadProviderForMenu(activeMenu)
@@ -134,8 +134,8 @@ Item {
// "Screenshot saved"). The user JUST did something — their feedback // "Screenshot saved"). The user JUST did something — their feedback
// should show. // should show.
// - urgency=critical AND app_name=notify-send: bare-CLI emergency alerts // - urgency=critical AND app_name=notify-send: bare-CLI emergency alerts
// (omarchy-battery-monitor uses this for low-battery; install-time // (omarchy-battery-monitor uses this for low-battery; a few scripts
// scripts for wifi setup, etc.). Trusted because it's almost always // use it for emergency failures). Trusted because it's almost always
// omarchy or system shell scripts — chat apps set app_name to // omarchy or system shell scripts — chat apps set app_name to
// their brand (Discord/Slack/Vesktop) which falls outside this rule. // their brand (Discord/Slack/Vesktop) which falls outside this rule.
function shouldBypassDnd(notification) { function shouldBypassDnd(notification) {
@@ -366,7 +366,7 @@ Item {
// Invoke the libnotify "default" action on the popup's underlying // Invoke the libnotify "default" action on the popup's underlying
// notification, if it has one, then dismiss. Clients register the default // notification, if it has one, then dismiss. Clients register the default
// action with the canonical identifier "default"; e.g. screenshot toasts // action with the canonical identifier "default"; e.g. screenshot toasts
// use `notify-send -A default=Edit` so click-the-card opens the editor. // use `notify-send -A default=Edit ...` so click-the-card opens the editor.
function invokePopupDefault(index) { function invokePopupDefault(index) {
if (index < 0 || index >= popupModel.count) return if (index < 0 || index >= popupModel.count) return
var entry = popupModel.get(index) var entry = popupModel.get(index)
@@ -64,8 +64,7 @@ Rectangle {
// `appIcon` (-i flag) still get one. // `appIcon` (-i flag) still get one.
readonly property string smallIconSource: image.length > 0 ? image : appIcon readonly property string smallIconSource: image.length > 0 ? image : appIcon
readonly property bool hasGlyph: glyph.length > 0 readonly property bool hasGlyph: glyph.length > 0
readonly property bool inlineGlyph: summary.match(/^[^\s]+\s{2,}/) !== null readonly property bool hasSmallIcon: !mediaMode && (smallIconSource.length > 0 || hasGlyph)
readonly property bool hasSmallIcon: !mediaMode && !inlineGlyph && (smallIconSource.length > 0 || hasGlyph)
readonly property bool chromiumDerived: { readonly property bool chromiumDerived: {
var source = (app + "\n" + appIcon).toLowerCase() var source = (app + "\n" + appIcon).toLowerCase()
return source.indexOf("chrom") >= 0 || source.indexOf("brave") >= 0 || return source.indexOf("chrom") >= 0 || source.indexOf("brave") >= 0 ||
+1 -1
View File
@@ -6,6 +6,6 @@ set -e
rm -f "$0" rm -f "$0"
( (
action=$(notify-send " Install Dictation with Voxtype" "Click to install voice dictation for Omarchy." -u critical -A "default=Install") action=$(notify-send -a omarchy-action -u critical --hint=string:omarchy-glyph: "Install Dictation with Voxtype" "Click to install voice dictation for Omarchy." -A "default=Install")
[[ $action == "default" ]] && omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-install [[ $action == "default" ]] && omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-install
) >/dev/null 2>&1 & ) >/dev/null 2>&1 &
+1 -1
View File
@@ -1,4 +1,4 @@
( (
action=$(notify-send " Learn Keybindings" "Super + K for cheatsheet.\nSuper + Space for application launcher.\nSuper + Alt + Space for Omarchy Menu." -u critical -A "default=Open") action=$(notify-send -a omarchy-action -u critical --hint=string:omarchy-glyph: "Learn Keybindings" "Super + K for cheatsheet.\nSuper + Space for application launcher.\nSuper + Alt + Space for Omarchy Menu." -A "default=Open")
[[ $action == "default" ]] && omarchy-menu-keybindings [[ $action == "default" ]] && omarchy-menu-keybindings
) >/dev/null 2>&1 & ) >/dev/null 2>&1 &
+2 -2
View File
@@ -1,13 +1,13 @@
notify_update() { notify_update() {
( (
action=$(notify-send " Update System" "$1" -u critical -A "default=Update") action=$(notify-send -a omarchy-action -u critical --hint=string:omarchy-glyph: "Update System" "$1" -A "default=Update")
[[ $action == "default" ]] && omarchy-launch-floating-terminal-with-presentation omarchy-update [[ $action == "default" ]] && omarchy-launch-floating-terminal-with-presentation omarchy-update
) >/dev/null 2>&1 & ) >/dev/null 2>&1 &
} }
notify_wifi() { notify_wifi() {
( (
action=$(notify-send "󰖩 Click to Setup Wi-Fi" "Tab to navigate, Space to select, ? for help." -u critical -A "default=Setup") action=$(notify-send -a omarchy-action -u critical --hint=string:omarchy-glyph:󰖩 "Click to Setup Wi-Fi" "Tab to navigate, Space to select, ? for help." -A "default=Setup")
[[ $action == "default" ]] && omarchy-launch-wifi [[ $action == "default" ]] && omarchy-launch-wifi
) >/dev/null 2>&1 & ) >/dev/null 2>&1 &
} }