vidthumb names thumbnails by a hash of path, size and mtime instead of a jq index that broke on quotes in filenames; systemd-tmpfiles removes ones unused for 30 days. discover-overlay-wait now runs from a systemd user unit started by xmonad and logs to the journal.
23 lines
573 B
Bash
Executable File
23 lines
573 B
Bash
Executable File
#!/bin/sh
|
|
# Runs discover-overlay while Discord's RPC port is up and stops it when Discord exits.
|
|
# Run by discover-overlay-wait.service (started from xmonad); output goes to the journal.
|
|
|
|
port_up() {
|
|
ss -ltn | grep -qE '127\.0\.0\.1:64[67][0-9]'
|
|
}
|
|
|
|
while true; do
|
|
while ! port_up; do sleep 2; done
|
|
sleep 5
|
|
port_up || continue # port vanished again, Discord was still restarting
|
|
|
|
discover-overlay &
|
|
pid=$!
|
|
|
|
while port_up && kill -0 "$pid" 2>/dev/null; do sleep 3; done
|
|
|
|
kill "$pid" 2>/dev/null
|
|
wait "$pid" 2>/dev/null
|
|
sleep 2
|
|
done
|