mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 04:29:34 +02:00
29 lines
755 B
Bash
Executable File
29 lines
755 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
|
|
|
|
set -euo pipefail
|
|
|
|
action="${1:-play-pause}"
|
|
|
|
playerctl "$action" >/dev/null 2>&1 || true
|
|
sleep 0.05
|
|
|
|
message=$(playerctl metadata --format '{{title}}' 2>/dev/null || true)
|
|
if [[ -z $message ]]; then
|
|
message=$(playerctl metadata --format '{{playerName}}' 2>/dev/null || true)
|
|
fi
|
|
if [[ -z $message ]]; then
|
|
case "$action" in
|
|
next) message="Next track" ;;
|
|
previous) message="Previous track" ;;
|
|
play) message="Playing" ;;
|
|
pause) message="Paused" ;;
|
|
*) message="Play/pause" ;;
|
|
esac
|
|
fi
|
|
|
|
omarchy-osd -i media -m "$message"
|