rearrange hyprland config; change back to old waybar: adjust waybar colors; add btop

This commit is contained in:
2025-11-28 13:20:58 -08:00
parent e1f34cb767
commit 0042568e34
103 changed files with 8055 additions and 2825 deletions

View File

@@ -1,82 +1,107 @@
#!/usr/bin/env bash
#
# Check for available updates and optionally upgrade packages on Arch Linux.
#
# Requirements:
# - checkupdates (pacman-contrib)
# - notify-send (libnotify)
# - optional: an AUR helper (aura, paru, pikaur, trizen, yay)
#
# Author: Jesse Mirabel <sejjymvm@gmail.com>
# Created: August 16, 2025
# License: MIT
# Check release
if [ ! -f /etc/arch-release ]; then
exit 0
fi
GRN='\033[1;32m'
BLU='\033[1;34m'
RST='\033[0m'
TIMEOUT=5
check-updates() {
repo=$(timeout $TIMEOUT checkupdates 2> /dev/null | wc -l)
if [[ -n $helper ]]; then
aur=$(timeout $TIMEOUT "$helper" -Quaq 2> /dev/null | wc -l)
fi
pkg_installed() {
local pkg=$1
if pacman -Qi "${pkg}" &>/dev/null; then
return 0
elif command -v "${pkg}" &>/dev/null; then
return 0
else
return 1
fi
}
update-packages() {
printf '\n%bUpdating pacman packages...%b\n' "$BLU" "$RST"
sudo pacman -Syu
printf '\n%bUpdating AUR packages...%b\n' "$BLU" "$RST"
"$helper" -Syu
# use signal to update the module
pkill -RTMIN+1 waybar
notify-send 'Update Complete' -i 'package-install'
printf '\n%bUpdate Complete!%b\n' "$GRN" "$RST"
read -rs -n 1 -p 'Press any key to exit...'
get_aur_helper() {
if command -v yay &>/dev/null; then
aur_helper="yay"
elif command -v paru &>/dev/null; then
aur_helper="paru"
else
aur_helper=""
fi
}
display-module() {
local tooltip="Official: $repo"
get_aur_helper
if [[ -n $helper ]]; then
tooltip+="\nAUR($helper): $aur"
fi
# Trigger upgrade
if [ "$1" == "up" ]; then
trap 'pkill -RTMIN+20 waybar' EXIT
command="
echo 'Starting system update...'
$0 upgrade
if [ -n '$aur_helper' ]; then
echo 'Running AUR update with $aur_helper...'
$aur_helper -Syu
else
echo 'Running official repository update...'
sudo pacman -Syu
fi
if command -v flatpak &>/dev/null; then
echo 'Running Flatpak update...'
flatpak update -y
fi
echo ''
echo 'Update complete! Press Enter to close...'
read -r
"
ghostty -e bash -c "${command}"
exit 0
fi
local total=$((repo + aur))
# Check for official repository updates with timeout
official_updates=$(
(timeout 10 bash -c 'while pgrep -x checkupdates >/dev/null; do sleep 1; done') 2>/dev/null
checkupdates 2>/dev/null | wc -l
)
official_updates=$((official_updates + 0))
if ((total == 0)); then
echo "{ \"text\": \"󰸟\", \"tooltip\": \"No updates available\" }"
else
echo "{ \"text\": \"\", \"tooltip\": \"$tooltip\" }"
fi
}
# Check for AUR updates with timeout
if [ -n "$aur_helper" ]; then
aur_updates=$(timeout 10 $aur_helper -Qua 2>/dev/null | wc -l)
aur_updates=$((aur_updates + 0))
else
aur_updates=0
fi
main() {
local arg=$1
local helpers=(aura paru pikaur trizen yay)
local bin
# Check for Flatpak updates with timeout
if pkg_installed flatpak; then
flatpak_updates=$(timeout 10 flatpak remote-ls --updates 2>/dev/null | wc -l)
flatpak_updates=$((flatpak_updates + 0))
else
flatpak_updates=0
fi
bin=$(command -v "${helpers[@]}" | head -n 1)
helper=${bin##*/}
repo=0
aur=0
# Calculate total available updates
total_updates=$((official_updates + aur_updates + flatpak_updates))
case $arg in
'module')
check-updates
display-module
;;
*)
printf '%bChecking for updates...%b' "$BLU" "$RST"
check-updates
update-packages
;;
esac
}
# Handle upgrade info display
if [ "${1}" == "upgrade" ]; then
if [ "$aur_helper" == "yay" ]; then
printf "Official: %s\nAUR ($aur_helper): %s\nFlatpak: %s\n\n" "$official_updates" "$aur_updates" "$flatpak_updates"
elif [ "$aur_helper" == "paru" ]; then
printf "Official: %s\nAUR ($aur_helper): %s\nFlatpak: %s\n\n" "$official_updates" "$aur_updates" "$flatpak_updates"
else
printf "Official: %s\nFlatpak: %s\n\n" "$official_updates" "$flatpak_updates"
fi
exit 0
fi
main "$@"
# Create tooltip text
if [ "$aur_helper" == "yay" ]; then
tooltip="Official: $official_updates\nAUR ($aur_helper): $aur_updates\nFlatpak: $flatpak_updates"
elif [ "$aur_helper" == "paru" ]; then
tooltip="Official: $official_updates\nAUR ($aur_helper): $aur_updates\nFlatpak: $flatpak_updates"
else
tooltip="Official: $official_updates\nFlatpak: $flatpak_updates"
fi
# Output compact JSON for Waybar
if [ $total_updates -eq 0 ]; then
echo '{"text":"󰸟","tooltip":"Packages are up to date"}'
else
printf '{"text":" %s","tooltip":"%s"}\n' "$total_updates" "$tooltip"
fi