mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Standardize all notification sending
This commit is contained in:
@@ -11,7 +11,7 @@ OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}"
|
||||
|
||||
if [[ ! -d $OUTPUT_DIR ]]; then
|
||||
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
|
||||
|
||||
pkill slurp && exit 0
|
||||
|
||||
@@ -23,4 +23,4 @@ TEXT=$(grim -g "$SELECTION" - | tesseract stdin stdout --oem 1 --psm 6 -l "${OMA
|
||||
[[ -z $TEXT ]] && exit 1
|
||||
|
||||
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"
|
||||
|
||||
@@ -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" 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"
|
||||
|
||||
@@ -27,4 +27,4 @@ esac
|
||||
sed -i "s/^export EDITOR=.*/export EDITOR=$editor/" ~/.config/uwsm/default
|
||||
|
||||
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"
|
||||
|
||||
@@ -33,4 +33,4 @@ cat >~/.config/xdg-terminals.list <<EOF
|
||||
$desktop_id
|
||||
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"
|
||||
|
||||
@@ -38,11 +38,11 @@ if [[ -n $font_name ]]; then
|
||||
omarchy-restart-shell
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
omarchy-hook font-set "$font_name"
|
||||
|
||||
@@ -10,7 +10,7 @@ if (( $# == 0 )); then
|
||||
mapfile -t cores < <(omarchy-games-retro-cores)
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
@@ -73,4 +73,4 @@ EOF
|
||||
chmod +x "$desktop_file"
|
||||
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"
|
||||
|
||||
@@ -1,35 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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=""
|
||||
DISABLED_NOTIFICATION=""
|
||||
|
||||
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
|
||||
usage() {
|
||||
echo "Usage: omarchy-hyprland-toggle <flag-name> [on|off|toggle]" >&2
|
||||
}
|
||||
|
||||
if (($# < 1)); then
|
||||
echo "Usage: omarchy-hyprland-toggle [--enabled-notification <text>] [--disabled-notification <text>] <flag-name> [on|off|toggle]" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -42,7 +21,6 @@ on() {
|
||||
if [[ -f $FLAG_SOURCE ]]; then
|
||||
mkdir -p "$(dirname "$FLAG_FILE")"
|
||||
cp "$FLAG_SOURCE" "$FLAG_FILE"
|
||||
[[ -n $ENABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$ENABLED_NOTIFICATION"
|
||||
else
|
||||
echo "Flag not found: $FLAG_NAME" >&2
|
||||
exit 1
|
||||
@@ -51,7 +29,6 @@ on() {
|
||||
|
||||
off() {
|
||||
rm -f "$FLAG_FILE"
|
||||
[[ -n $DISABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$DISABLED_NOTIFICATION"
|
||||
}
|
||||
|
||||
toggle() {
|
||||
@@ -69,7 +46,7 @@ case $ACTION in
|
||||
off) off ;;
|
||||
toggle) toggle ;;
|
||||
*)
|
||||
echo "Usage: omarchy-hyprland-toggle [--enabled-notification <text>] [--disabled-notification <text>] <flag-name> [on|off|toggle]" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -12,4 +12,4 @@ esac
|
||||
|
||||
hyprctl eval "hl.workspace_rule({ workspace = \"$ACTIVE_WORKSPACE\", layout = \"$NEW_LAYOUT\" })" >/dev/null 2>&1 || \
|
||||
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"
|
||||
|
||||
@@ -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"
|
||||
;;
|
||||
*)
|
||||
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
|
||||
done
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Send a desktop notification with Omarchy glyph and body spacing
|
||||
# omarchy:args=<headline> [description] [-g <glyph>] [-u <low|normal|critical>] [notify-send options]
|
||||
# omarchy:summary=Send an Omarchy desktop notification
|
||||
# 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
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
headline=""
|
||||
description=""
|
||||
glyph=""
|
||||
glyph=
|
||||
urgency="low"
|
||||
args=()
|
||||
|
||||
@@ -19,7 +19,7 @@ parse_omarchy_option() {
|
||||
echo "Missing value for $1" >&2
|
||||
exit 1
|
||||
fi
|
||||
glyph="$2"
|
||||
glyph=$2
|
||||
return 0
|
||||
;;
|
||||
-u | --urgency)
|
||||
@@ -65,16 +65,13 @@ while (($# > 0)); do
|
||||
fi
|
||||
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.
|
||||
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
|
||||
notify-send "${args[@]}" "$headline" "$description"
|
||||
else
|
||||
|
||||
+8
-16
@@ -1,27 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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=""
|
||||
DISABLED_NOTIFICATION=""
|
||||
|
||||
while [[ $# -gt 1 ]]; do
|
||||
case $1 in
|
||||
--enabled-notification) ENABLED_NOTIFICATION="$2"; shift 2 ;;
|
||||
--disabled-notification) DISABLED_NOTIFICATION="$2"; shift 2 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
if (($# < 1)); then
|
||||
echo "Usage: omarchy-toggle <flag-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FLAG_NAME="$1"
|
||||
FLAG="$HOME/.local/state/omarchy/toggles/$FLAG_NAME"
|
||||
|
||||
if [[ -f $FLAG ]]; then
|
||||
rm $FLAG
|
||||
[[ -n $DISABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$DISABLED_NOTIFICATION"
|
||||
rm -f "$FLAG"
|
||||
else
|
||||
mkdir -p "$(dirname $FLAG)"
|
||||
touch $FLAG
|
||||
[[ -n $ENABLED_NOTIFICATION ]] && notify-send -a omarchy-action -u low "$ENABLED_NOTIFICATION"
|
||||
mkdir -p "$(dirname "$FLAG")"
|
||||
touch "$FLAG"
|
||||
fi
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
if pgrep -x hypridle >/dev/null; then
|
||||
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
|
||||
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
|
||||
|
||||
omarchy-shell-ipc --if-running bar refreshIndicators >/dev/null 2>&1 || true
|
||||
|
||||
@@ -17,8 +17,8 @@ CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+')
|
||||
|
||||
if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then
|
||||
hyprctl hyprsunset temperature $ON_TEMP
|
||||
notify-send -a omarchy-action -u low " Nightlight screen temperature"
|
||||
omarchy-notification-send -g "Nightlight screen temperature"
|
||||
else
|
||||
hyprctl hyprsunset temperature $OFF_TEMP
|
||||
notify-send -a omarchy-action -u low " Daylight screen temperature"
|
||||
omarchy-notification-send -g "Daylight screen temperature"
|
||||
fi
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
# omarchy:summary=Toggle screensaver availability
|
||||
|
||||
omarchy-toggle \
|
||||
--enabled-notification " Screensaver disabled" \
|
||||
--disabled-notification " Screensaver enabled" \
|
||||
screensaver-off
|
||||
if omarchy-toggle-enabled screensaver-off; then
|
||||
omarchy-toggle screensaver-off
|
||||
omarchy-notification-send -g "Screensaver enabled"
|
||||
else
|
||||
omarchy-toggle screensaver-off
|
||||
omarchy-notification-send -g "Screensaver disabled"
|
||||
fi
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
# omarchy:summary=Toggle suspend availability in the system menu
|
||||
|
||||
omarchy-toggle \
|
||||
--enabled-notification " Suspend removed from system menu" \
|
||||
--disabled-notification " Suspend now available in system menu" \
|
||||
suspend-off
|
||||
if omarchy-toggle-enabled suspend-off; then
|
||||
omarchy-toggle suspend-off
|
||||
omarchy-notification-send -g "Suspend now available in system menu"
|
||||
else
|
||||
omarchy-toggle suspend-off
|
||||
omarchy-notification-send -g "Suspend removed from system menu"
|
||||
fi
|
||||
|
||||
@@ -21,5 +21,5 @@ if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then
|
||||
voxtype setup systemd
|
||||
|
||||
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
|
||||
|
||||
@@ -293,7 +293,7 @@ launch_windows() {
|
||||
echo "Starting Windows VM..."
|
||||
|
||||
# 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
|
||||
echo "❌ Failed to start Windows VM!"
|
||||
|
||||
@@ -606,6 +606,7 @@ Item {
|
||||
navStack = []
|
||||
filterText = ""
|
||||
selectedIndex = 0
|
||||
root.evaluateGuards()
|
||||
opened = true
|
||||
rebuildDisplay()
|
||||
loadProviderForMenu(activeMenu)
|
||||
|
||||
@@ -134,8 +134,8 @@ Item {
|
||||
// "Screenshot saved"). The user JUST did something — their feedback
|
||||
// should show.
|
||||
// - urgency=critical AND app_name=notify-send: bare-CLI emergency alerts
|
||||
// (omarchy-battery-monitor uses this for low-battery; install-time
|
||||
// scripts for wifi setup, etc.). Trusted because it's almost always
|
||||
// (omarchy-battery-monitor uses this for low-battery; a few scripts
|
||||
// use it for emergency failures). Trusted because it's almost always
|
||||
// omarchy or system shell scripts — chat apps set app_name to
|
||||
// their brand (Discord/Slack/Vesktop) which falls outside this rule.
|
||||
function shouldBypassDnd(notification) {
|
||||
@@ -366,7 +366,7 @@ Item {
|
||||
// Invoke the libnotify "default" action on the popup's underlying
|
||||
// notification, if it has one, then dismiss. Clients register the default
|
||||
// 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) {
|
||||
if (index < 0 || index >= popupModel.count) return
|
||||
var entry = popupModel.get(index)
|
||||
|
||||
+1
-2
@@ -64,8 +64,7 @@ Rectangle {
|
||||
// `appIcon` (-i flag) still get one.
|
||||
readonly property string smallIconSource: image.length > 0 ? image : appIcon
|
||||
readonly property bool hasGlyph: glyph.length > 0
|
||||
readonly property bool inlineGlyph: summary.match(/^[^\s]+\s{2,}/) !== null
|
||||
readonly property bool hasSmallIcon: !mediaMode && !inlineGlyph && (smallIconSource.length > 0 || hasGlyph)
|
||||
readonly property bool hasSmallIcon: !mediaMode && (smallIconSource.length > 0 || hasGlyph)
|
||||
readonly property bool chromiumDerived: {
|
||||
var source = (app + "\n" + appIcon).toLowerCase()
|
||||
return source.indexOf("chrom") >= 0 || source.indexOf("brave") >= 0 ||
|
||||
|
||||
@@ -6,6 +6,6 @@ set -e
|
||||
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
|
||||
) >/dev/null 2>&1 &
|
||||
|
||||
@@ -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
|
||||
) >/dev/null 2>&1 &
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
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
|
||||
) >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
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
|
||||
) >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user