mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2025-02-11 23:14:22 -05:00
27 lines
973 B
Bash
Executable File
27 lines
973 B
Bash
Executable File
#!/usr/bin/env bash
|
|
updates() {
|
|
configFile=$HOME/.config/flexiflow/flexiflow_bar/bar_updates.ini
|
|
|
|
timestamp=$(date +%s)
|
|
icon=" "
|
|
[[ -f $configFile ]] && . $configFile
|
|
if [ -z "$LastUsed" ] || [ -z "$Message" ]; then
|
|
updates=$(checkupdates | wc -l)
|
|
printf "%s%s\n" "%{F#1E222A}%{B#EBD369}$icon %{F-}%{B-}" "%{F#282A36}%{B#C4C7C5}$updates Updates %{F-}%{B-}"
|
|
newtime=$(expr $timestamp + 900)
|
|
echo -e "LastUsed=${newtime}\nMessage='${updates}'" >$configFile
|
|
else
|
|
if [ "$timestamp" -ge "$LastUsed" ]; then
|
|
updates=$(checkupdates | wc -l)
|
|
printf "%s%s\n" "%{F#1E222A}%{B#EBD369}$icon %{F-}%{B-}" "%{F#282A36}%{B#C4C7C5}$updates Updates %{F-}%{B-}"
|
|
newtime=$(expr $timestamp + 900)
|
|
echo -e "LastUsed=${newtime}\nMessage='${updates}'" >$configFile
|
|
else
|
|
updates=" $Message"
|
|
printf "%s%s\n" "%{F#1E222A}%{B#EBD369}$icon %{F-}%{B-}" "%{F#282A36}%{B#C4C7C5}$updates Updates %{F-}%{B-}"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
updates
|