mirror of https://github.com/E-Almqvist/dotfiles
parent
cc6d22b14e
commit
8a7ff7e7a1
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
#source https://github.com/x70b1/polybar-scripts |
|
||||||
|
|
||||||
|
|
||||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then |
|
||||||
updates_arch=0 |
|
||||||
fi |
|
||||||
|
|
||||||
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then |
|
||||||
if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then |
|
||||||
updates_aur=0 |
|
||||||
fi |
|
||||||
|
|
||||||
updates=$(("$updates_arch" + "$updates_aur")) |
|
||||||
|
|
||||||
if [ "$updates" -gt 0 ]; then |
|
||||||
echo " $updates" |
|
||||||
else |
|
||||||
echo "0" |
|
||||||
fi |
|
@ -1,20 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
|
|
||||||
prepend_zero () { |
|
||||||
seq -f "%02g" $1 $1 |
|
||||||
} |
|
||||||
|
|
||||||
artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-)) |
|
||||||
|
|
||||||
if [[ $artist = *[!\ ]* ]]; then |
|
||||||
song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-)) |
|
||||||
position=$(cmus-remote -C status | grep position | cut -c 10-) |
|
||||||
minutes1=$(prepend_zero $(($position / 60))) |
|
||||||
seconds1=$(prepend_zero $(($position % 60))) |
|
||||||
duration=$(cmus-remote -C status | grep duration | cut -c 10-) |
|
||||||
minutes2=$(prepend_zero $(($duration / 60))) |
|
||||||
seconds2=$(prepend_zero $(($duration % 60))) |
|
||||||
echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]" |
|
||||||
else |
|
||||||
echo |
|
||||||
fi |
|
@ -1,50 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
|
|
||||||
# The name of polybar bar which houses the main spotify module and the control modules. |
|
||||||
PARENT_BAR="now-playing" |
|
||||||
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) |
|
||||||
|
|
||||||
# Set the source audio player here. |
|
||||||
# Players supporting the MPRIS spec are supported. |
|
||||||
# Examples: spotify, vlc, chrome, mpv and others. |
|
||||||
# Use `playerctld` to always detect the latest player. |
|
||||||
# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control |
|
||||||
PLAYER="spotify" |
|
||||||
|
|
||||||
# Format of the information displayed |
|
||||||
# Eg. {{ artist }} - {{ album }} - {{ title }} |
|
||||||
# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata |
|
||||||
FORMAT="{{ title }} - {{ artist }}" |
|
||||||
|
|
||||||
# Sends $2 as message to all polybar PIDs that are part of $1 |
|
||||||
update_hooks() { |
|
||||||
while IFS= read -r id |
|
||||||
do |
|
||||||
polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1 |
|
||||||
done < <(echo "$1") |
|
||||||
} |
|
||||||
|
|
||||||
PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) |
|
||||||
EXIT_CODE=$? |
|
||||||
|
|
||||||
if [ $EXIT_CODE -eq 0 ]; then |
|
||||||
STATUS=$PLAYERCTL_STATUS |
|
||||||
else |
|
||||||
STATUS="No player is running" |
|
||||||
fi |
|
||||||
|
|
||||||
if [ "$1" == "--status" ]; then |
|
||||||
echo "$STATUS" |
|
||||||
else |
|
||||||
if [ "$STATUS" = "Stopped" ]; then |
|
||||||
echo "No music is playing" |
|
||||||
elif [ "$STATUS" = "Paused" ]; then |
|
||||||
update_hooks "$PARENT_BAR_PID" 2 |
|
||||||
playerctl --player=$PLAYER metadata --format "$FORMAT" |
|
||||||
elif [ "$STATUS" = "No player is running" ]; then |
|
||||||
echo "$STATUS" |
|
||||||
else |
|
||||||
update_hooks "$PARENT_BAR_PID" 1 |
|
||||||
playerctl --player=$PLAYER metadata --format "$FORMAT" |
|
||||||
fi |
|
||||||
fi |
|
@ -1,2 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') |
|
@ -1,2 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1 |
|
@ -1,20 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
#source https://github.com/x70b1/polybar-scripts |
|
||||||
|
|
||||||
|
|
||||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then |
|
||||||
updates_arch=0 |
|
||||||
fi |
|
||||||
|
|
||||||
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then |
|
||||||
if ! updates_aur=$(yay -Su --aur --quiet | wc -l); then |
|
||||||
updates_aur=0 |
|
||||||
fi |
|
||||||
|
|
||||||
updates=$(("$updates_arch" + "$updates_aur")) |
|
||||||
|
|
||||||
if [ "$updates" -gt 0 ]; then |
|
||||||
echo " $updates" |
|
||||||
else |
|
||||||
echo "0" |
|
||||||
fi |
|
Loading…
Reference in new issue