mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 12:39:35 +02:00
24 lines
748 B
Bash
Executable File
24 lines
748 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Control media playback and show the Omarchy OSD
|
|
# omarchy:args=<next|previous|play-pause|play|pause>
|
|
# omarchy:examples=omarchy audio player next | omarchy audio player play-pause
|
|
|
|
action="${1:-play-pause}"
|
|
|
|
case "$action" in
|
|
next) fallback_message="Next track" ;;
|
|
previous) fallback_message="Previous track" ;;
|
|
play) fallback_message="Playing" ;;
|
|
pause) fallback_message="Paused" ;;
|
|
*) fallback_message="Play/pause" ;;
|
|
esac
|
|
|
|
playerctl "$action" >/dev/null 2>&1 || true
|
|
sleep 0.05
|
|
|
|
message=$(playerctl metadata --format '{{title}}' 2>/dev/null || true)
|
|
[[ -n $message ]] || message=$(playerctl metadata --format '{{playerName}}' 2>/dev/null || true)
|
|
|
|
omarchy-osd -i media -m "${message:-$fallback_message}"
|