diff --git a/dotfiles/.config/waybar/config b/dotfiles/.config/waybar/config index a2c511b..fb402b9 100644 --- a/dotfiles/.config/waybar/config +++ b/dotfiles/.config/waybar/config @@ -1,5 +1,5 @@ { - "modules-left": ["battery", "clock#date", "clock","custom/updates", "custom/launcher"], + "modules-left": ["battery", "clock#date", "clock","custom/updater", "custom/launcher"], "modules-center": ["hyprland/workspaces"], "modules-right": ["network", "bluetooth", "pulseaudio", "custom/power"], @@ -136,14 +136,13 @@ }, "sort-by-number": true }, - "custom/updatespacman": { - "format": "{}{icon}", - "return-type": "json", - "format-icons": { - "has-updates": " 󰏖", - "updated": "" - }, - "exec-if": "which waybar-module-pacman-updates", - "exec": "waybar-module-pacman-updates --no-zero-output" + "custom/updater": { + "format": "󰏖 {}", + "exec": "checkupdates | wc -l", + "exec-if": "[[ $(checkupdates | wc -l) ]]", + "interval": 5, + "on-click": "$HOME/.config/waybar/scripts/update-distro.sh", + "tooltip": true, + "tooltip-format": "Left Click: Update System\nArch (w/ notification)\nFedora, OpenSuse, Debian/Ubuntu click to update" } } diff --git a/dotfiles/.config/waybar/scripts/update-distro.sh b/dotfiles/.config/waybar/scripts/update-distro.sh new file mode 100755 index 0000000..afd1df6 --- /dev/null +++ b/dotfiles/.config/waybar/scripts/update-distro.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# HyprFlux — https://github.com/ahmad9059/HyprFlux +# Simple bash script to check and will try to update your system + +# Local Paths +iDIR="$HOME/.config/swaync/images" + +# Check for required tools (kitty) +if ! command -v kitty &> /dev/null; then + notify-send -i "$iDIR/error.png" "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/ja.png" -u low 'Arch-based system' 'has been updated.' + else + kitty -T update yay -Syu + notify-send -i "$iDIR/ja.png" -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/ja.png" -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/ja.png" -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/ja.png" -u low 'openSUSE system' 'has been updated.' +else + # Unsupported distro + notify-send -i "$iDIR/error.png" -u critical "Unsupported system" "This script does not support your distribution." + exit 1 +fi diff --git a/dotfiles/.config/waybar/style.css b/dotfiles/.config/waybar/style.css index 8dad178..9511098 100644 --- a/dotfiles/.config/waybar/style.css +++ b/dotfiles/.config/waybar/style.css @@ -17,24 +17,14 @@ window#waybar { } -/* Updated Update Module Styling */ -#custom-updates { - padding: 5px 15px; - background-color: rgba(0, 43, 51, 0.85); /* Matches your other modules */ +#custom-updater { + font-size: 13px; + background-color: rgba(0,43,51,0.85); border-radius: 20px; + padding: 5px 8px; margin: 5px 3px; } -#custom-updates.yellow { - background-color: #ffcc66; /* A nice yellow/orange */ - color: #000000; -} - -#custom-updates.red { - background-color: #cc3436; /* Your existing red color */ - color: #ffffff; -} - .modules-left { margin: 2px 0 0 5px; }