Skip to content

Instantly share code, notes, and snippets.

@AndeAndreas31415
Last active July 31, 2021 12:07
Show Gist options
  • Save AndeAndreas31415/faab181a494bfd896cf8146cc3fbfb4e to your computer and use it in GitHub Desktop.
Save AndeAndreas31415/faab181a494bfd896cf8146cc3fbfb4e to your computer and use it in GitHub Desktop.
xfce4 genmon script
#!/usr/bin/env bash
# list all outdated packages
readonly FLAT=$(flatpak remote-ls --updates -a |wc -l)
readonly AUR=$(yay -Qua | wc -l)
readonly OFFICIAL=$(cat /tmp/pacup | wc -l)
#Pacman
echo -e "\e[5;1mPacman "$OFFICIAL"\e[25;0m"
if [[ $OFFICIAL -eq 0 ]]
then
echo "Updotade :-)"
else
cat /tmp/pacup
fi
echo ""
#Aur
echo -e "\e[5;1mAur "$AUR"\e[25;0m"
if [[ $AUR -eq 0 ]]
then
echo "Updotade :-)"
else
yay -Qua
fi
echo ""
#Flatpak
echo -e "\e[5;1mFlatpak "$FLAT"\e[25;0m"
if [[ $FLAT -eq 0 ]]
then
echo "Updotade :-)"
else
flatpak remote-ls --updates -a --columns=application,version|head
fi
echo ""
read -n 1 -s -r -p "Press any key to quit this window"
#!/usr/bin/env bash
# Dependencies: bash>=3.2, coreutils, file, grep, iputils, pacman, yaourt
# Makes the script more portable
readonly DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Wincli="xfce4-terminal -x "${DIR}"/pac-gui"
# Optional icon to display before the text
# Insert the absolute path of the icon
# Recommended size is 24x24 px
readonly ICON="${DIR}/pacman.png"
#tmp files
checkupdates > /tmp/pacup
# Calculate updates
#readonly AUR=$(yay -Qua|grep "^aur/"|tee /tmp/aurupdates|wc -l)
readonly FLAT=$(flatpak remote-ls --updates -a |wc -l)
readonly AUR=$(yay -Qua|wc -l)
readonly OFFICIAL=$(cat /tmp/pacup|wc -l)
readonly ALL=$(( AUR + OFFICIAL + FLAT))
#If important updates
im_ar=()
im_ar+=($(cat /tmp/pacup | grep -o linux|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o jack|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o pulseaudio|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o systemd|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o nvidia|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o xorg|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o xfce4|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o sudo|head -n 1|xargs -I \# echo \#" "))
im_ar+=($(cat /tmp/pacup | grep -o mkinitcpio|head -n 1|xargs -I \# echo \#" "))
# Panel
if [[ $(file -b "${ICON}") =~ PNG|SVG ]]; then
INFO="<img>${ICON}</img>"
INFO+="<txt>"
else
INFO="<txt>"
INFO+="Icon is missing!"
fi
INFO+="${ALL}"
INFO+="</txt>"
# add a click event to txt
#INFO+="<txtclick>$Wincli</txtclick>"
# add a click event to img
INFO+="<click>$Wincli</click>"
# Tooltip
MORE_INFO="<tool>"
MORE_INFO+="┌ Outdated packages\n"
MORE_INFO+="├─ Pacman: ${OFFICIAL}\n"
i=0
len=${#im_ar[@]}
lt=$(( len - 1 ))
while [ $i -lt $len ];
do
if [[ $i -ne $lt ]]; then
MORE_INFO+="│  ├─ ${im_ar[$i]}\n"
let i++
else
MORE_INFO+="│  └─ ${im_ar[$i]}\n"
let i++
fi
done
MORE_INFO+="├─ Aur: ${AUR}\n"
MORE_INFO+="└─ Flatpak: ${FLAT}"
MORE_INFO+="</tool>"
# Panel Print
echo -e "${INFO}"
# Tooltip Print
echo -e "${MORE_INFO}"
@AndeAndreas31415
Copy link
Author

my script for xfce4 genomn plugin for visible my outaded package

@AndeAndreas31415
Copy link
Author

remove all useless if statements in update.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment