├── README.md ├── better-progress.sh └── screenshot └── example.png /README.md: -------------------------------------------------------------------------------- 1 | # Better Music Progress 2 | A script that takes the currently playing song and recolours it to display the percentage of the song completed in Lemonbar. 3 | Resets the colour to Lemonbar's foreground colour. 4 | Outputs "song title - artist name" if tagged correctly, otherwise outputs file name. 5 | To change this edit the string in the `songstr` variable on line 5. See `man mpc` for more formatting options. 6 | Example: ![1](/screenshot/example.png) 7 | 8 | Only dependency is mpc and subsequently MPD. 9 | To use it simply call it in your lemonbar script, for example: 10 | ```bash 11 | echo "%{c}$(better-music.sh)" | lemonbar -p -B "#000" -F "#fff" 12 | ``` 13 | To change the progress completed colour change the value of `$completion_color`. 14 | To change the paused colour change the value of `$paused_color`. 15 | Must be a valid colour in lemonbar. 16 | 17 | ## Todo 18 | 19 | -------------------------------------------------------------------------------- /better-progress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | music_percent() { 4 | 5 | completion_color="#dc1566" 6 | paused_color="#d7d787" 7 | 8 | delimiter=" - " 9 | 10 | song_string=$(mpc current -f "[%title%$delimiter%artist%|%file%] ") 11 | song_status=$(mpc status | awk -F "[][]" 'NR==2{print $2}') 12 | 13 | percentage=$(mpc | grep -o "(.*%)") 14 | percentage=${percentage:1:-2} 15 | 16 | total_length=${#song_string} 17 | n_colored=$(( $(($percentage * $total_length)) / 100 )) 18 | 19 | output="" 20 | 21 | if [[ "$song_status" == "paused" ]] 22 | then 23 | 24 | output="%{F$paused_color}$song_string" 25 | 26 | else 27 | 28 | output="%{F$completion_color}" 29 | 30 | for (( index=0; index<$total_length; index++ )) 31 | do 32 | 33 | if [[ "$index" == "$n_colored" ]] 34 | then 35 | output="${output}%{F-}" 36 | fi 37 | 38 | output="${output}${song_string:$index:1}" 39 | 40 | done 41 | 42 | fi 43 | 44 | echo "$output%{F-}" 45 | 46 | } 47 | 48 | music_percent 49 | -------------------------------------------------------------------------------- /screenshot/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Druanae/better-progress-bar/6eaa1d975774347a7c193c8a7ab4e56ed8fae626/screenshot/example.png --------------------------------------------------------------------------------