dotfiles
Clone
https://git.tahinli.com/Tahinli/dotfiles.git
0 watching0 forksShellGPL-3.0334.8 KiBb1320e9Tahinli17 days ago105 commits
| 1 | #!/bin/bash |
| 2 | # Media picker (rofi): choose which MPRIS player the waybar music module follows. |
| 3 | # Auto (no pin file) follows the latest player; picking a player writes |
| 4 | # /tmp/playerctl_pin (line 1 bus name, 2 url host, 3 base name, 4 timestamp). |
| 5 | # Bound to middle-click on custom/music. |
| 6 | |
| 7 | PIN=/tmp/playerctl_pin |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | # host of an http(s) url, empty otherwise |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | # --- collect players ---------------------------------------------------------- |
| 21 | |
| 22 | players=() |
| 23 | while ; do |
| 24 | && players+=("") |
| 25 | done |
| 26 | |
| 27 | if ; then |
| 28 | |
| 29 | |
| 30 | fi |
| 31 | |
| 32 | pinned="" |
| 33 | if ; then |
| 34 | pinned= |
| 35 | fi |
| 36 | |
| 37 | # parallel arrays, index-aligned with players[] |
| 38 | titles=() |
| 39 | labels=() |
| 40 | places=() |
| 41 | entries=() |
| 42 | |
| 43 | if ; then |
| 44 | entries+=("📌 Auto (follow latest)") |
| 45 | else |
| 46 | entries+=("Auto (follow latest)") |
| 47 | fi |
| 48 | |
| 49 | for; do |
| 50 | status= |
| 51 | artist= |
| 52 | title= |
| 53 | url= |
| 54 | |
| 55 | case "" in |
| 56 | Playing) icon="▶" ;; |
| 57 | Paused) icon="⏸" ;; |
| 58 | *) icon="⏹" ;; |
| 59 | esac |
| 60 | |
| 61 | if ; then |
| 62 | label=" - " |
| 63 | elif ; then |
| 64 | label= |
| 65 | else |
| 66 | label="(no title)" |
| 67 | fi |
| 68 | |
| 69 | host= |
| 70 | base= |
| 71 | place= |
| 72 | |
| 73 | titles+=("") |
| 74 | labels+=("") |
| 75 | places+=("") |
| 76 | |
| 77 | prefix="" |
| 78 | && prefix="📌 " |
| 79 | entries+=(" — []") |
| 80 | done |
| 81 | |
| 82 | # --- menu ------------------------------------------------------------------- |
| 83 | |
| 84 | idx= |
| 85 | && |
| 86 | || |
| 87 | |
| 88 | if ; then |
| 89 | |
| 90 | |
| 91 | |
| 92 | fi |
| 93 | |
| 94 | || |
| 95 | i= |
| 96 | player= |
| 97 | |
| 98 | tmp= || |
| 99 | host= |
| 100 | |
| 101 | |
| 102 | |
| 103 |