diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-02-26 20:31:12 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-02-26 20:31:12 +0530 |
commit | 85ae438fbc238fe56bcb1c10a12ec52365053cb6 (patch) | |
tree | 7aa2c802739657f22fd8de735207b27fc6e7e8a9 /modules/archupdates | |
download | dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.gz dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.bz2 dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.zip |
dwmbar dotfiles
Diffstat (limited to 'modules/archupdates')
-rwxr-xr-x | modules/archupdates | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/archupdates b/modules/archupdates new file mode 100755 index 0000000..d4cbc44 --- /dev/null +++ b/modules/archupdates @@ -0,0 +1,27 @@ +#!/bin/bash + +# Prints out the number of pacman updates (Arch Linux) +# Requires an internet connection +# Depends on yay and checkupdates (pacman-contrib) +# Optional: add --devel flag to the yay cmd to check for *-git package updates. + +PREFIX=' Updates: ' + +get_updates() +{ + if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then + updates_arch=0 + fi + + if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then + updates_aur=0 + fi + + updates=$(("$updates_arch" + "$updates_aur")) + + echo "$PREFIX$updates" +} + +if [ $(( 10#$(date '+%M') % 3 )) -eq 0 ] && [ $(( 10#$(date '+%S') )) -eq 5 ]; then + get_updates +fi |