The i3 and laptop READMEs each pointed at the other for 10-asus.conf and 20-g14.conf, so nobody owned them. The module now writes both (adopted paths, so no duplicate binding breaks i3's config check), ships the scripts they call, runs the media keys with notifications again, and brings back the touchpad reset after resume as a unit the sleep services want. zephyrus_keys answers what each custom key runs; the check flags as-user, thd's account and the resume unit. xorg-xinput is the xorg module's.
28 lines
1.1 KiB
Bash
Executable File
28 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# zephyrus-media play-pause | next | previous — the media keys, through MPRIS (playerctl), with a short
|
|
# notification of what happened. Shipped by the mesh's asus-zephyrus-g14 module; edit the catalogue.
|
|
#
|
|
# From the predecessor's media-control, kept: the lock against a double fire (the vendor keys can
|
|
# repeat), and the notification. Dropped: its fallback to a media server's local API, which needed a
|
|
# token from a file of secrets (novox/hq research 027 question 2). A player that speaks MPRIS is
|
|
# reached; one that does not says so.
|
|
set -u
|
|
here=$(dirname "$0")
|
|
action=${1:-play-pause}
|
|
case "$action" in play-pause | next | previous) ;; *) echo "usage: zephyrus-media play-pause | next | previous" >&2; exit 2 ;; esac
|
|
lock="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/zephyrus-media.lock"
|
|
exec 9>"$lock"
|
|
flock -n 9 || exit 0
|
|
if ! playerctl status >/dev/null 2>&1; then
|
|
"$here/zephyrus-notify" 7777 "Media: no player"
|
|
exit 0
|
|
fi
|
|
playerctl "$action" 2>/dev/null
|
|
if [ "$action" = play-pause ]; then
|
|
sleep 0.2
|
|
[ "$(playerctl status 2>/dev/null)" = Playing ] && label=Playing || label=Paused
|
|
else
|
|
label=${action^}
|
|
fi
|
|
"$here/zephyrus-notify" 7777 "Media: $label"
|