added update logic and styles, added update script
This commit is contained in:
@@ -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-center": ["hyprland/workspaces"],
|
||||||
"modules-right": ["network", "bluetooth", "pulseaudio", "custom/power"],
|
"modules-right": ["network", "bluetooth", "pulseaudio", "custom/power"],
|
||||||
|
|
||||||
@@ -136,14 +136,13 @@
|
|||||||
},
|
},
|
||||||
"sort-by-number": true
|
"sort-by-number": true
|
||||||
},
|
},
|
||||||
"custom/updatespacman": {
|
"custom/updater": {
|
||||||
"format": "{}{icon}",
|
"format": " {}",
|
||||||
"return-type": "json",
|
"exec": "checkupdates | wc -l",
|
||||||
"format-icons": {
|
"exec-if": "[[ $(checkupdates | wc -l) ]]",
|
||||||
"has-updates": " ",
|
"interval": 5,
|
||||||
"updated": ""
|
"on-click": "$HOME/.config/waybar/scripts/update-distro.sh",
|
||||||
},
|
"tooltip": true,
|
||||||
"exec-if": "which waybar-module-pacman-updates",
|
"tooltip-format": "Left Click: Update System\nArch (w/ notification)\nFedora, OpenSuse, Debian/Ubuntu click to update"
|
||||||
"exec": "waybar-module-pacman-updates --no-zero-output"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
dotfiles/.config/waybar/scripts/update-distro.sh
Executable file
40
dotfiles/.config/waybar/scripts/update-distro.sh
Executable file
@@ -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
|
||||||
@@ -17,24 +17,14 @@ window#waybar {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updated Update Module Styling */
|
#custom-updater {
|
||||||
#custom-updates {
|
font-size: 13px;
|
||||||
padding: 5px 15px;
|
background-color: rgba(0,43,51,0.85);
|
||||||
background-color: rgba(0, 43, 51, 0.85); /* Matches your other modules */
|
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
padding: 5px 8px;
|
||||||
margin: 5px 3px;
|
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 {
|
.modules-left {
|
||||||
margin: 2px 0 0 5px;
|
margin: 2px 0 0 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user