dotfiles
Clone
https://git.tahinli.com/Tahinli/dotfiles.git
0 watching0 forksShellGPL-3.0334.8 KiBb1320e9Tahinli16 days ago105 commits
| 1 | #!/bin/bash |
| 2 | # Forward playerctl commands to the player the bar is showing, so clicks hit |
| 3 | # what song_detail_writer.sh displays instead of the first in `playerctl -l`. |
| 4 | # Target order: |
| 5 | # 1. /tmp/song_detail_player (the writer's current player), if still listed |
| 6 | # 2. pin file line 1 (/tmp/playerctl_pin), if still listed |
| 7 | # 3. Playing player with the most recent start (/tmp/playerctl_started_*) |
| 8 | # 4. Paused player with the latest activity (/tmp/playerctl_activity_*) |
| 9 | # |
| 10 | # Usage: playerctl_active.sh play-pause|stop|next|previous|status|metadata ... |
| 11 | |
| 12 | ACTIVITY_PREFIX="/tmp/playerctl_activity_" |
| 13 | STARTED_PREFIX="/tmp/playerctl_started_" |
| 14 | CHOSEN_FILE="/tmp/song_detail_player" |
| 15 | PIN_FILE="/tmp/playerctl_pin" |
| 16 | |
| 17 | |
| 18 | list= |
| 19 | |
| 20 | |
| 21 | chosen="" |
| 22 | if ; then |
| 23 | cand= |
| 24 | && && chosen="" |
| 25 | fi |
| 26 | if ; then |
| 27 | cand= |
| 28 | && && chosen="" |
| 29 | fi |
| 30 | |
| 31 | if ; then |
| 32 | best_playing="" |
| 33 | best_playing_ts=-1 |
| 34 | fallback="" |
| 35 | fallback_ts=0 |
| 36 | while ; do |
| 37 | && continue |
| 38 | status= || continue |
| 39 | if ; then |
| 40 | started= |
| 41 | || started=0 |
| 42 | if ; then |
| 43 | best_playing_ts="" |
| 44 | best_playing="" |
| 45 | fi |
| 46 | elif ; then |
| 47 | ts=0 |
| 48 | act_file="" |
| 49 | && ts= && && ts=0 |
| 50 | if ; then |
| 51 | fallback_ts="" |
| 52 | fallback="" |
| 53 | fi |
| 54 | fi |
| 55 | done |
| 56 | chosen="" |
| 57 | fi |
| 58 | |
| 59 | && |
| 60 | |
| 61 |