diff options
-rwxr-xr-x | polybar/scripts/checkupdates | 117 | ||||
-rwxr-xr-x | polybar/scripts/launcher.sh | 13 | ||||
-rwxr-xr-x | polybar/scripts/powermenu.sh | 94 | ||||
-rw-r--r-- | polybar/scripts/rofi/colors.rasi | 10 | ||||
-rw-r--r-- | polybar/scripts/rofi/confirm.rasi | 24 | ||||
-rw-r--r-- | polybar/scripts/rofi/launcher.rasi | 115 | ||||
-rw-r--r-- | polybar/scripts/rofi/message.rasi | 24 | ||||
-rw-r--r-- | polybar/scripts/rofi/networkmenu.rasi | 123 | ||||
-rw-r--r-- | polybar/scripts/rofi/powermenu.rasi | 123 | ||||
-rw-r--r-- | polybar/scripts/rofi/styles.rasi | 123 | ||||
-rwxr-xr-x | polybar/scripts/style-switch.sh | 15 | ||||
-rwxr-xr-x | polybar/scripts/styles.sh | 76 | ||||
-rwxr-xr-x | polybar/scripts/updates.sh | 45 |
13 files changed, 0 insertions, 902 deletions
diff --git a/polybar/scripts/checkupdates b/polybar/scripts/checkupdates deleted file mode 100755 index 4d8a5e8..0000000 --- a/polybar/scripts/checkupdates +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/bash -# -# checkupdates: Safely print a list of pending updates. -# -# Copyright (c) 2013 Kyle Keen <keenerd@gmail.com> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -declare -r myname='checkupdates' -declare -r myver='1.0.0' - -plain() { - (( QUIET )) && return - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 -} - -msg() { - (( QUIET )) && return - local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 -} - -msg2() { - (( QUIET )) && return - local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 -} - -ask() { - local mesg=$1; shift - printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&1 -} - -warning() { - local mesg=$1; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -error() { - local mesg=$1; shift - printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -# check if messages are to be printed using color -unset ALL_OFF BOLD BLUE GREEN RED YELLOW -if [[ -t 2 && ! $USE_COLOR = "n" ]]; then - # prefer terminal safe colored and bold text when tput is supported - if tput setaf 0 &>/dev/null; then - ALL_OFF="$(tput sgr0)" - BOLD="$(tput bold)" - BLUE="${BOLD}$(tput setaf 4)" - GREEN="${BOLD}$(tput setaf 2)" - RED="${BOLD}$(tput setaf 1)" - YELLOW="${BOLD}$(tput setaf 3)" - else - ALL_OFF="\e[1;0m" - BOLD="\e[1;1m" - BLUE="${BOLD}\e[1;34m" - GREEN="${BOLD}\e[1;32m" - RED="${BOLD}\e[1;31m" - YELLOW="${BOLD}\e[1;33m" - fi -fi -readonly ALL_OFF BOLD BLUE GREEN RED YELLOW - - -if (( $# > 0 )); then - echo "${myname} v${myver}" - echo - echo "Safely print a list of pending updates" - echo - echo "Usage: ${myname}" - echo - echo 'Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.' - exit 0 -fi - -if ! type -P fakeroot >/dev/null; then - error 'Cannot find the fakeroot binary.' - exit 1 -fi - -if [[ -z $CHECKUPDATES_DB ]]; then - CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/" -fi - -trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT - -DBPath="$(pacman-conf DBPath)" -if [[ -z "$DBPath" ]] || [[ ! -d "$DBPath" ]]; then - DBPath="/var/lib/pacman/" -fi - -mkdir -p "$CHECKUPDATES_DB" -ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null -if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then - error 'Cannot fetch updates' - exit 1 -fi -pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]' - -exit 0 - -# vim: set noet: diff --git a/polybar/scripts/launcher.sh b/polybar/scripts/launcher.sh deleted file mode 100755 index b853625..0000000 --- a/polybar/scripts/launcher.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -FILE="$HOME/.config/polybar/forest/scripts/rofi/colors.rasi" - -## random accent color -#COLORS=('#EC7875' '#EC6798' '#BE78D1' '#75A4CD' '#00C7DF' '#00B19F' '#61C766' \ -# '#B9C244' '#EBD369' '#EDB83F' '#E57C46' '#AC8476' '#6C77BB' '#6D8895') -#AC="${COLORS[$(( $RANDOM % 14 ))]}" -#SE="${COLORS[$(( $RANDOM % 14 ))]}" -#sed -i -e "s/ac: .*/ac: ${AC}FF;/g" $FILE -#sed -i -e "s/se: .*/se: ${SE}FF;/g" $FILE - -rofi -no-config -no-lazy-grab -show drun -modi drun -theme ~/.config/polybar/forest/scripts/rofi/launcher.rasi diff --git a/polybar/scripts/powermenu.sh b/polybar/scripts/powermenu.sh deleted file mode 100755 index 84eddf4..0000000 --- a/polybar/scripts/powermenu.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bash - -## Author : Aditya Shakya -## Mail : adi1090x@gmail.com -## Github : @adi1090x -## Twitter : @adi1090x - -dir="~/.config/polybar/forest/scripts/rofi" -uptime=$(uptime -p | sed -e 's/up //g') - -rofi_command="rofi -theme $dir/powermenu.rasi" - -# Options -shutdown=" Shutdown" -reboot=" Restart" -lock=" Lock" -suspend=" Sleep" -logout=" Logout" - -# Confirmation -confirm_exit() { - rofi -dmenu\ - -i\ - -no-fixed-num-lines\ - -p "Are You Sure? : "\ - -theme $dir/confirm.rasi -} - -# Message -msg() { - rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n" -} - -# Variable passed to rofi -options="$lock\n$suspend\n$logout\n$reboot\n$shutdown" - -chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)" -case $chosen in - $shutdown) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - systemctl poweroff - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $reboot) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - systemctl reboot - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $lock) - if [[ -f /usr/bin/i3lock ]]; then - i3lock - elif [[ -f /usr/bin/betterlockscreen ]]; then - betterlockscreen -l - fi - ;; - $suspend) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - mpc -q pause - amixer set Master mute - systemctl suspend - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $logout) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then - openbox --exit - elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then - bspc quit - elif [[ "$DESKTOP_SESSION" == "i3" ]]; then - i3-msg exit - fi - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; -esac diff --git a/polybar/scripts/rofi/colors.rasi b/polybar/scripts/rofi/colors.rasi deleted file mode 100644 index cd1f090..0000000 --- a/polybar/scripts/rofi/colors.rasi +++ /dev/null @@ -1,10 +0,0 @@ -/* colors */ - -* { - al: #00000000; - bg: #212B30FF; - bga: #263035FF; - fg: #C4C7C5FF; - ac: #EC407AFF; - se: #4DD0E1FF; -} diff --git a/polybar/scripts/rofi/confirm.rasi b/polybar/scripts/rofi/confirm.rasi deleted file mode 100644 index 7382580..0000000 --- a/polybar/scripts/rofi/confirm.rasi +++ /dev/null @@ -1,24 +0,0 @@ -/* Confirm Dialog */ - -@import "colors.rasi" - -* { - background-color: @bg; - text-color: @fg; - font: "Terminus 9"; -} - -window { - width: 210px; - padding: 25px; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - location: center; - y-offset: -2em; -} - -entry { - expand: true; - text-color: @ac; -} diff --git a/polybar/scripts/rofi/launcher.rasi b/polybar/scripts/rofi/launcher.rasi deleted file mode 100644 index 8c112cd..0000000 --- a/polybar/scripts/rofi/launcher.rasi +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * Author : Aditya Shakya - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Twitter : @adi1090x - * - */ - -configuration { - font: "Terminus 9"; - show-icons: true; - icon-theme: "Papirus"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - fullscreen: false; - hide-scrollbar: true; - sidebar-mode: false; -} - -@import "colors.rasi" - -window { - transparency: "real"; - background-color: @bg; - text-color: @fg; - border: 0px 0px 0px 0px; - border-color: @ac; - border-radius: 0px; - width: 500px; - location: center; - x-offset: 0; - y-offset: 0; -} - -prompt { - enabled: true; - padding: 0px; - background-color: @bga; - text-color: @ac; - font: "feather 8"; -} - -entry { - background-color: @al; - text-color: @fg; - placeholder-color: @fg; - expand: true; - horizontal-align: 0; - placeholder: "Search..."; - padding: 0px 0px 0px 5px; - blink: true; -} - -inputbar { - children: [ prompt, entry ]; - background-color: @bga; - text-color: @fg; - expand: false; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - margin: 0px; - padding: 10px; -} - -listview { - background-color: @al; - padding: 0px; - columns: 1; - lines: 6; - spacing: 5px; - cycle: true; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @al; - border: 0px; - border-radius: 0px; - border-color: @ac; - children: [ inputbar, listview ]; - spacing: 5px; - padding: 5px; -} - -element { - background-color: @al; - text-color: @fg; - orientation: horizontal; - border-radius: 0px; - padding: 8px; -} - -element-icon { - size: 24px; - border: 0px; -} - -element-text { - expand: true; - horizontal-align: 0; - vertical-align: 0.5; - margin: 0px 2.5px 0px 2.5px; -} - -element selected { - background-color: @se; - text-color: @bg; - border: 0px 0px 0px 0px; - border-radius: 0px; - border-color: @ac; -} diff --git a/polybar/scripts/rofi/message.rasi b/polybar/scripts/rofi/message.rasi deleted file mode 100644 index dcc2093..0000000 --- a/polybar/scripts/rofi/message.rasi +++ /dev/null @@ -1,24 +0,0 @@ -/* Confirm Dialog */ - -@import "colors.rasi" - -* { - background-color: @bg; - text-color: @fg; - font: "Terminus 9"; -} - -window { - width: 320px; - padding: 25px; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - location: center; - y-offset: -2em; -} - -entry { - expand: true; - text-color: @ac; -} diff --git a/polybar/scripts/rofi/networkmenu.rasi b/polybar/scripts/rofi/networkmenu.rasi deleted file mode 100644 index 7935698..0000000 --- a/polybar/scripts/rofi/networkmenu.rasi +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Author : Aditya Shakya - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Twitter : @adi1090x - * - */ - -configuration { - font: "Terminus 9"; - show-icons: true; - icon-theme: "Papirus"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - fullscreen: false; - hide-scrollbar: true; - sidebar-mode: false; -} - -@import "colors.rasi" - -window { - transparency: "real"; - background-color: @bg; - text-color: @fg; - border: 0px 0px 0px 0px; - border-color: @ac; - border-radius: 0px; - width: 400px; - location: center; - x-offset: 0; - y-offset: 0; -} - -prompt { - enabled: true; - padding: 0px 0px 0px 10px; - background-color: @bga; - text-color: @fg; -} - -textbox-prompt-colon { - padding: 0px; - background-color: @bga; - text-color: @ac; - expand: false; - str: ""; - font: "feather 8"; -} - -entry { - background-color: @al; - text-color: @fg; - placeholder-color: @fg; - expand: true; - horizontal-align: 0; - placeholder: "Search..."; - padding: 0px 0px 0px 5px; - blink: true; -} - -inputbar { - children: [ textbox-prompt-colon, prompt ]; - background-color: @bga; - text-color: @fg; - expand: false; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - margin: 0px; - padding: 10px; -} - -listview { - background-color: @al; - padding: 0px; - columns: 1; - lines: 8; - spacing: 5px; - cycle: true; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @al; - border: 0px; - border-radius: 0px; - border-color: @ac; - children: [ inputbar, listview ]; - spacing: 5px; - padding: 5px; -} - -element { - background-color: @al; - text-color: @fg; - orientation: horizontal; - border-radius: 0px; - padding: 8px 8px 8px -15px; -} - -element-icon { - size: 24px; - border: 0px; -} - -element-text { - expand: true; - horizontal-align: 0; - vertical-align: 0.5; - margin: 0px 2.5px 0px 2.5px; -} - -element selected { - background-color: @se; - text-color: @bg; - border: 0px 0px 0px 0px; - border-radius: 0px; - border-color: @ac; -} diff --git a/polybar/scripts/rofi/powermenu.rasi b/polybar/scripts/rofi/powermenu.rasi deleted file mode 100644 index d265945..0000000 --- a/polybar/scripts/rofi/powermenu.rasi +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Author : Aditya Shakya - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Twitter : @adi1090x - * - */ - -configuration { - font: "Terminus 9"; - show-icons: true; - icon-theme: "Papirus"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - fullscreen: false; - hide-scrollbar: true; - sidebar-mode: false; -} - -@import "colors.rasi" - -window { - transparency: "real"; - background-color: @bg; - text-color: @fg; - border: 0px 0px 0px 0px; - border-color: @ac; - border-radius: 0px; - width: 350px; - location: center; - x-offset: 0; - y-offset: 0; -} - -prompt { - enabled: true; - padding: 0px 0px 0px 10px; - background-color: @bga; - text-color: @fg; -} - -textbox-prompt-colon { - padding: 0px; - background-color: @bga; - text-color: @ac; - expand: false; - str: ""; - font: "feather 8"; -} - -entry { - background-color: @al; - text-color: @fg; - placeholder-color: @fg; - expand: true; - horizontal-align: 0; - placeholder: "Search..."; - padding: 0px 0px 0px 5px; - blink: true; -} - -inputbar { - children: [ textbox-prompt-colon, prompt ]; - background-color: @bga; - text-color: @fg; - expand: false; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - margin: 0px; - padding: 10px; -} - -listview { - background-color: @al; - padding: 0px; - columns: 1; - lines: 5; - spacing: 5px; - cycle: true; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @al; - border: 0px; - border-radius: 0px; - border-color: @ac; - children: [ inputbar, listview ]; - spacing: 5px; - padding: 5px; -} - -element { - background-color: @al; - text-color: @fg; - orientation: horizontal; - border-radius: 0px; - padding: 8px 8px 8px -20px; -} - -element-icon { - size: 24px; - border: 0px; -} - -element-text { - expand: true; - horizontal-align: 0; - vertical-align: 0.5; - margin: 0px 2.5px 0px 2.5px; -} - -element selected { - background-color: @se; - text-color: @bg; - border: 0px 0px 0px 0px; - border-radius: 0px; - border-color: @ac; -} diff --git a/polybar/scripts/rofi/styles.rasi b/polybar/scripts/rofi/styles.rasi deleted file mode 100644 index c95983d..0000000 --- a/polybar/scripts/rofi/styles.rasi +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Author : Aditya Shakya - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Twitter : @adi1090x - * - */ - -configuration { - font: "Terminus 9"; - show-icons: true; - icon-theme: "Papirus"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - fullscreen: false; - hide-scrollbar: true; - sidebar-mode: false; -} - -@import "colors.rasi" - -window { - transparency: "real"; - background-color: @bg; - text-color: @fg; - border: 0px 0px 0px 0px; - border-color: @ac; - border-radius: 0px; - width: 350px; - location: center; - x-offset: 0; - y-offset: 0; -} - -prompt { - enabled: true; - padding: 0px 0px 0px 5px; - background-color: @bga; - text-color: @fg; -} - -textbox-prompt-colon { - padding: 0px; - background-color: @bga; - text-color: @ac; - expand: false; - str: ""; - font: "feather 8"; -} - -entry { - background-color: @al; - text-color: @fg; - placeholder-color: @fg; - expand: true; - horizontal-align: 0; - placeholder: "Search..."; - padding: 0px 0px 0px 10px; - blink: true; -} - -inputbar { - children: [ textbox-prompt-colon, entry ]; - background-color: @bga; - text-color: @fg; - expand: false; - border: 0px 0px 1px 0px; - border-radius: 0px; - border-color: @se; - margin: 0px; - padding: 10px; -} - -listview { - background-color: @al; - padding: 0px; - columns: 1; - lines: 5; - spacing: 5px; - cycle: true; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @al; - border: 0px; - border-radius: 0px; - border-color: @ac; - children: [ inputbar, listview ]; - spacing: 5px; - padding: 5px; -} - -element { - background-color: @al; - text-color: @fg; - orientation: horizontal; - border-radius: 0px; - padding: 8px 8px 8px -20px; -} - -element-icon { - size: 24px; - border: 0px; -} - -element-text { - expand: true; - horizontal-align: 0; - vertical-align: 0.5; - margin: 0px 2.5px 0px 2.5px; -} - -element selected { - background-color: @se; - text-color: @bg; - border: 0px 0px 0px 0px; - border-radius: 0px; - border-color: @ac; -} diff --git a/polybar/scripts/style-switch.sh b/polybar/scripts/style-switch.sh deleted file mode 100755 index e0188f3..0000000 --- a/polybar/scripts/style-switch.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -SDIR="$HOME/.config/polybar/forest/scripts" - -# Launch Rofi -MENU="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p '' \ --theme $SDIR/rofi/styles.rasi \ -<<< " Default| Nord| Gruvbox| Dark| Cherry|")" - case "$MENU" in - *Default) "$SDIR"/styles.sh --default ;; - *Nord) "$SDIR"/styles.sh --nord ;; - *Gruvbox) "$SDIR"/styles.sh --gruvbox ;; - *Dark) "$SDIR"/styles.sh --dark ;; - *Cherry) "$SDIR"/styles.sh --cherry ;; - esac diff --git a/polybar/scripts/styles.sh b/polybar/scripts/styles.sh deleted file mode 100755 index 35899a9..0000000 --- a/polybar/scripts/styles.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -# Color files -PFILE="$HOME/.config/polybar/forest/colors.ini" -RFILE="$HOME/.config/polybar/forest/scripts/rofi/colors.rasi" - -# Change colors -change_color() { - # polybar - sed -i -e "s/background = #.*/background = $BG/g" $PFILE - sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE - sed -i -e "s/sep = #.*/sep = $SEP/g" $PFILE - - # rofi - cat > $RFILE <<- EOF - /* colors */ - - * { - al: #00000000; - bg: ${BG}FF; - bga: ${BGA}FF; - fg: ${FG}FF; - ac: ${AC}FF; - se: ${SE}FF; - } - EOF - - polybar-msg cmd restart -} - -if [[ $1 = "--default" ]]; then - BG="#212B30" - FG="#C4C7C5" - BGA="#263035" - SEP="#3F5360" - AC="#EC407A" - SE="#4DD0E1" - change_color -elif [[ $1 = "--nord" ]]; then - BG="#3B4252" - FG="#E5E9F0" - BGA="#454C5C" - SEP="#5B6579" - AC="#BF616A" - SE="#88C0D0" - change_color -elif [[ $1 = "--gruvbox" ]]; then - BG="#282828" - FG="#EBDBB2" - BGA="#313131" - SEP="#505050" - AC="#FB4934" - SE="#8EC07C" - change_color -elif [[ $1 = "--dark" ]]; then - BG="#141C21" - FG="#93A1A1" - BGA="#1E262B" - SEP="#3C4449" - AC="#D12F2C" - SE="#33C5BA" - change_color -elif [[ $1 = "--cherry" ]]; then - BG="#1F1626" - FG="#FFFFFF" - BGA="#292030" - SEP="#473F4E" - AC="#D94084" - SE="#4F5D95" - change_color -else - cat <<- _EOF_ - No option specified, Available options: - --default --nord --gruvbox --dark --cherry - _EOF_ -fi diff --git a/polybar/scripts/updates.sh b/polybar/scripts/updates.sh deleted file mode 100755 index 70edf26..0000000 --- a/polybar/scripts/updates.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -NOTIFY_ICON=/usr/share/icons/Papirus/32x32/apps/system-software-update.svg - -get_total_updates() { UPDATES=$(checkupdates 2>/dev/null | wc -l); } - -while true; do - get_total_updates - - # notify user of updates - if hash notify-send &>/dev/null; then - if (( UPDATES > 50 )); then - notify-send -u critical -i $NOTIFY_ICON \ - "You really need to update!!" "$UPDATES New packages" - elif (( UPDATES > 25 )); then - notify-send -u normal -i $NOTIFY_ICON \ - "You should update soon" "$UPDATES New packages" - elif (( UPDATES > 2 )); then - notify-send -u low -i $NOTIFY_ICON \ - "$UPDATES New packages" - fi - fi - - # when there are updates available - # every 10 seconds another check for updates is done - while (( UPDATES > 0 )); do - if (( UPDATES == 1 )); then - echo "$UPDATES" - elif (( UPDATES > 1 )); then - echo "$UPDATES" - else - echo "None" - fi - sleep 10 - get_total_updates - done - - # when no updates are available, use a longer loop, this saves on CPU - # and network uptime, only checking once every 30 min for new updates - while (( UPDATES == 0 )); do - echo "None" - sleep 1800 - get_total_updates - done -done |