44 lines
1.1 KiB
Bash
Executable File
44 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Show the Omarchy Quickshell on-screen display
|
|
# omarchy:args=[-i|--icon <icon>] [-m|--message <text>] [-p|--progress <0-100>] [-d|--duration <ms>] [-f|--fit]
|
|
# omarchy:examples=omarchy osd -i brightness -p 50 | omarchy osd -m "Hello" | omarchy osd -m "Done" --fit
|
|
|
|
set -euo pipefail
|
|
|
|
icon=""
|
|
message=""
|
|
progress=""
|
|
progress_text=""
|
|
max="100"
|
|
duration=""
|
|
fit=0
|
|
|
|
while (($#)); do
|
|
case $1 in
|
|
-i|--icon) icon="${2:-}"; shift 2 ;;
|
|
-m|--message) message="${2:-}"; shift 2 ;;
|
|
-p|--progress) progress="${2:-}"; shift 2 ;;
|
|
-d|--duration) duration="${2:-}"; shift 2 ;;
|
|
-f|--fit) fit=1; shift ;;
|
|
-h|--help) omarchy osd --help; exit 0 ;;
|
|
*) echo "Unknown OSD option: $1" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ -n $progress ]]; then
|
|
progress_text="${progress}%"
|
|
fi
|
|
|
|
payload=$(jq -cn \
|
|
--arg icon "$icon" \
|
|
--arg message "$message" \
|
|
--arg value "$progress" \
|
|
--arg progressText "$progress_text" \
|
|
--arg max "$max" \
|
|
--arg duration "$duration" \
|
|
--argjson fit "$fit" \
|
|
'{icon:$icon,message:$message,value:$value,progressText:$progressText,max:$max,duration:$duration,fit:$fit}')
|
|
|
|
omarchy-shell -q osd show "$payload"
|