power menu, redshift, polybar

This commit is contained in:
azpsen
2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
# Script: player-cmus
A script that displays information about the current track (artist, title, position, duration).
![player-cmus](screenshots/1.png)
## Module
```ini
[module/player-cmus]
type = custom/script
exec = ~/polybar-scripts/player-cmus.sh
interval = 5
click-left = cmus-remote -n &
click-right = cmus-remote -r &
click-middle = cmus-remote -u &
```

View File

@@ -0,0 +1,42 @@
#!/bin/sh
if info=$(cmus-remote -Q 2> /dev/null); then
status=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "status " | cut -d ' ' -f 2)
if [ "$status" = "playing" ] || [ "$status" = "paused" ] || [ "$status" = "stopped" ]; then
title=$(echo "$info" | grep -v 'set ' | grep " title " | cut -d ' ' -f 3-)
artist=$(echo "$info" | grep -v 'set ' | grep " artist " | cut -d ' ' -f 3-)
position=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "position " | cut -d ' ' -f 2)
duration=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "duration " | cut -d ' ' -f 2)
if [ "$artist" ] || [ "$title" ]; then
if [ "$duration" -ge 0 ]; then
pos_minutes=$(printf "%02d" $((position / 60)))
pos_seconds=$(printf "%02d" $((position % 60)))
dur_minutes=$(printf "%02d" $((duration / 60)))
dur_seconds=$(printf "%02d" $((duration % 60)))
info_string="| $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
fi
info_string="$artist - $title $info_string"
if [ "$status" = "playing" ]; then
echo "#1 $info_string"
elif [ "$status" = "paused" ]; then
echo "#2 $info_string"
elif [ "$status" = "stopped" ]; then
echo "#3 $info_string"
else
echo ""
fi
else
echo ""
fi
else
echo ""
fi
else
echo ""
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB