This commit is contained in:
Simon
2020-12-30 18:54:45 +01:00
parent 09f816c294
commit c13b9178f9
5 changed files with 25 additions and 22 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Based on https://github.com/PrayagS/polybar-spotify/
# Set the max text length.
# Default is 10 characters
LENGTH=${1:-20}
# 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="playerctld"
# 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 }}"
# see man zscroll for documentation of the following parameters
zscroll -l "$LENGTH" \
--delay 0.2 \
--scroll-padding " >> " \
--match-command "playerctl -s --player=$PLAYER status 2>/dev/null" \
--match-text "Playing" "--scroll 1" \
--match-text "Paused" "--scroll 0" \
--update-check true "playerctl -s --player=$PLAYER metadata --format '$FORMAT'" &
wait
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
# Dependencies:
# pacman-contrib, yay for AUR updates
ENA_UPDATES=$(command -v checkupdates)
CNT_UPDATES="0"
UPDATES="nA"
if [ "$ENA_UPDATES" ]; then
UPDATES=$(checkupdates 2>/dev/null)
CNT_UPDATES=$(echo "$UPDATES" | wc -l)
fi
ENA_UPDATES_AUR=$(command -v yay)
CNT_UPDATES_AUR="0"
UPDATES_AUR="nA"
if [ "$ENA_UPDATES_AUR" ]; then
UPDATES_AUR=$(yay -Qua)
CNT_UPDATES_AUR=$(echo "$UPDATES_AUR" | wc -l)
fi
CNT_UPDATES_TOTAL=$(("$CNT_UPDATES" + "$CNT_UPDATES_AUR"))
if [ "$1" == "--count" ]; then
echo "Official: $CNT_UPDATES, AUR: $CNT_UPDATES_AUR, Total: $CNT_UPDATES_TOTAL"
fi
if [ "$1" == "--count-short" ]; then
echo "$CNT_UPDATES / $CNT_UPDATES_AUR"
fi
if [ "$1" == "--count-total" ]; then
echo "$CNT_UPDATES_TOTAL"
fi
if [ "$1" == "--count-official" ]; then
echo "$CNT_UPDATES"
fi
if [ "$1" == "--count-aur" ]; then
echo "$CNT_UPDATES"
fi
if [ "$1" == "--update" ]; then
echo "--- Update all packages ($CNT_UPDATES_TOTAL) via yay ---"
echo
yay -Syu --sudoflags "--stdin" --sudoloop
echo
read -rp "Press any key to exit..."
fi
if [ "$1" == "--update-noconfirm" ]; then
echo "--- Update all packages ($CNT_UPDATES_TOTAL) via yay [noconfirm] ---"
echo
yay -Syu --sudoflags "--stdin" --sudoloop --noconfirm
echo
read -rp "Press any key to exit..."
fi
if [ "$1" == "--list" ]; then
echo "--- List of updates ($CNT_UPDATES_TOTAL) ---"
echo
if [ "$ENA_UPDATES" ]; then
echo "-- Official ($CNT_UPDATES):"
echo "$UPDATES"
echo
else
echo "-- Package 'checkupdates' is not installed!"
echo
fi
if [ "$ENA_UPDATES_AUR" ]; then
echo "-- AUR ($CNT_UPDATES_AUR):"
echo "$UPDATES_AUR"
echo
else
echo "-- Package 'yay' is not installed!"
echo
fi
echo
read -rp "Press any key to exit..."
fi
exit