diff options
Diffstat (limited to 'home-config/waybar/modules')
| -rwxr-xr-x | home-config/waybar/modules/check-for-music.sh | 7 | ||||
| -rwxr-xr-x | home-config/waybar/modules/spotify.sh | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/home-config/waybar/modules/check-for-music.sh b/home-config/waybar/modules/check-for-music.sh new file mode 100755 index 0000000..3b735a2 --- /dev/null +++ b/home-config/waybar/modules/check-for-music.sh | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [[ $(playerctl metadata --format '{{lc(status)}}' | grep playing) -eq 0 ]]; then | ||
| 4 | exit 0 | ||
| 5 | else | ||
| 6 | exit 1 | ||
| 7 | fi | ||
diff --git a/home-config/waybar/modules/spotify.sh b/home-config/waybar/modules/spotify.sh index a75136c..3368d88 100755 --- a/home-config/waybar/modules/spotify.sh +++ b/home-config/waybar/modules/spotify.sh | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}') | 3 | class=$(playerctl metadata --format '{{lc(status)}}') |
| 4 | icon="" | 4 | icon="" |
| 5 | 5 | ||
| 6 | if [[ $class == "playing" ]]; then | 6 | if [[ $class == "playing" ]]; then |
| 7 | info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}') | 7 | info=$(playerctl metadata --format '{{artist}} - {{title}}') |
| 8 | if [[ ${#info} > 40 ]]; then | 8 | if [[ ${#info} > 40 ]]; then |
| 9 | info=$(echo $info | cut -c1-40)"..." | 9 | info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..." |
| 10 | fi | 10 | fi |
| 11 | text=$info" "$icon | 11 | text=$info" "$icon |
| 12 | elif [[ $class == "paused" ]]; then | 12 | elif [[ $class == "paused" ]]; then |
