diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-27 12:05:27 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-27 12:06:31 +0900 |
| commit | 48e4428bfa5cb99d4e0a9aab055b24a9f1520d70 (patch) | |
| tree | 4726c5b286ef779c4a12f10d70ca610c2317f8e8 /config | |
| parent | e0da3f87a115040e693cec563d6d47a0f551f9df (diff) | |
added support for other distros on waybar update button. NOTE: untested still on
Diffstat (limited to 'config')
| -rwxr-xr-x | config/hypr/scripts/Distro_update.sh | 40 | ||||
| -rw-r--r-- | config/waybar/ModulesCustom | 9 |
2 files changed, 45 insertions, 4 deletions
diff --git a/config/hypr/scripts/Distro_update.sh b/config/hypr/scripts/Distro_update.sh new file mode 100755 index 00000000..c687ba0c --- /dev/null +++ b/config/hypr/scripts/Distro_update.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Simple bash script to check and will try to update your system + +# Local Paths +iDIR="$HOME/.config/swaync/images/ja.png" + +# Check for required tools (kitty) +if ! command -v kitty &> /dev/null; then + notify-send -i $iDIR "Need Kitty:" "Kitty terminal not found. Please install Kitty terminal." + exit 1 +fi + +# Detect distribution and update accordingly +if command -v paru &> /dev/null || command -v yay &> /dev/null; then + # Arch-based + if command -v paru &> /dev/null; then + kitty -T update paru -Syu + notify-send -i $iDIR -u low 'Arch-based system' 'has been updated.' + else + kitty -T update yay -Syu + notify-send -i $iDIR -u low 'Arch-based system' 'has been updated.' + fi +elif command -v dnf &> /dev/null; then + # Fedora-based + kitty -T update sudo dnf update --refresh -y + notify-send -i $iDIR -u low 'Fedora system' 'has been updated.' +elif command -v apt &> /dev/null; then + # Debian-based (Debian, Ubuntu, etc.) + kitty -T update sudo apt update && sudo apt upgrade -y + notify-send -i $iDIR -u low 'Debian/Ubuntu system' 'has been updated.' +elif command -v zypper &> /dev/null; then + # openSUSE-based + kitty -T update sudo zypper dup -y + notify-send -i $iDIR -u low 'openSUSE system' 'has been updated.' +else + # Unsupported distro + notify-send -i $iDIR -u critical "Unsupported system" "This script does not support your distribution." + exit 1 +fi diff --git a/config/waybar/ModulesCustom b/config/waybar/ModulesCustom index 9237af27..fc26cfed 100644 --- a/config/waybar/ModulesCustom +++ b/config/waybar/ModulesCustom @@ -161,15 +161,16 @@ "on-click-right": "swaync-client -d -sw", "escape": true, }, -// NOTE:! This is only for Arch and Arch Based Distros depend: pacman-contrib +// NOTE:! This is mainly for Arch and Arch Based Distros depend: pacman-contrib +// Other Distro dont have notifications but can use to check for update for any other distro "custom/updater": { "format": " {}", "exec": "checkupdates | wc -l", "exec-if": "[[ $(checkupdates | wc -l) ]]", - "interval": 15, - "on-click": "if command -v paru &> /dev/null; then kitty -T update paru -Syu; else kitty -T update yay -Syu; fi && notify-send 'The system has been updated'", + "interval": 43200, // (Arch Linux will try to check 12 hrs interval only + "on-click": "$HOME/.config/hypr/scripts/Distro_update.sh", "tooltip": true, - "tooltip-format": "Left Click: Update System\nArch Linux Only", + "tooltip-format": "Left Click: Update System\nArch (w/ notification)\nFedora, OpenSuse, Debian/Ubuntu click to update", }, // Separators "custom/separator#dot": { |
