Compare commits
No commits in common. "8ddbb238511394239259beb566f0cf0266482488" and "d815e21b1d45badfc49f14f1c236e9118c7c428d" have entirely different histories.
8ddbb23851
...
d815e21b1d
@ -132,7 +132,6 @@ defaults/
|
|||||||
moonarch-waybar-gpustat Waybar module: GPU utilization
|
moonarch-waybar-gpustat Waybar module: GPU utilization
|
||||||
moonarch-waybar-hidpp Waybar module: Logitech HID++ device battery
|
moonarch-waybar-hidpp Waybar module: Logitech HID++ device battery
|
||||||
moonarch-waybar-batsaver Waybar module: battery conservation mode indicator
|
moonarch-waybar-batsaver Waybar module: battery conservation mode indicator
|
||||||
moonarch-waybar-updates Waybar module: package update checker (repo + AUR)
|
|
||||||
moonarch-batsaver-toggle Toggle battery charge limit (80% ↔ 100%)
|
moonarch-batsaver-toggle Toggle battery charge limit (80% ↔ 100%)
|
||||||
|
|
||||||
shell/zshrc Zsh config: prompt, aliases, FZF, completion
|
shell/zshrc Zsh config: prompt, aliases, FZF, completion
|
||||||
|
|||||||
@ -1,68 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
# ABOUTME: Waybar module that checks for available package updates with caching.
|
|
||||||
# ABOUTME: Combines pacman repo updates (checkupdates) and AUR updates (paru -Qua).
|
|
||||||
|
|
||||||
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/moonarch"
|
|
||||||
CACHE_FILE="$CACHE_DIR/waybar-updates"
|
|
||||||
PACMAN_DB="/var/lib/pacman/local"
|
|
||||||
MAX_AGE=3600
|
|
||||||
|
|
||||||
mkdir -p "$CACHE_DIR"
|
|
||||||
|
|
||||||
needs_refresh() {
|
|
||||||
# No cache yet
|
|
||||||
[[ ! -f "$CACHE_FILE" ]] && return 0
|
|
||||||
|
|
||||||
# Pacman DB changed since last check (update was installed)
|
|
||||||
[[ "$PACMAN_DB" -nt "$CACHE_FILE" ]] && return 0
|
|
||||||
|
|
||||||
# Cache older than MAX_AGE
|
|
||||||
local age=$(( $(date +%s) - $(stat -c %Y "$CACHE_FILE") ))
|
|
||||||
[[ "$age" -ge "$MAX_AGE" ]] && return 0
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if needs_refresh; then
|
|
||||||
repo_updates=$(checkupdates 2>/dev/null)
|
|
||||||
repo_count=0
|
|
||||||
if [[ -n "$repo_updates" ]]; then
|
|
||||||
repo_count=$(echo "$repo_updates" | wc -l)
|
|
||||||
fi
|
|
||||||
|
|
||||||
aur_updates=""
|
|
||||||
aur_count=0
|
|
||||||
if command -v paru &>/dev/null; then
|
|
||||||
aur_updates=$(paru -Qua 2>/dev/null)
|
|
||||||
if [[ -n "$aur_updates" ]]; then
|
|
||||||
aur_count=$(echo "$aur_updates" | wc -l)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
total=$((repo_count + aur_count))
|
|
||||||
|
|
||||||
if [[ "$total" -eq 0 ]]; then
|
|
||||||
echo "" > "$CACHE_FILE"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build tooltip with package lists
|
|
||||||
tooltip=""
|
|
||||||
if [[ -n "$repo_updates" ]]; then
|
|
||||||
tooltip+="Repo ($repo_count):"$'\n'"$repo_updates"
|
|
||||||
fi
|
|
||||||
if [[ -n "$aur_updates" ]]; then
|
|
||||||
[[ -n "$tooltip" ]] && tooltip+=$'\n\n'
|
|
||||||
tooltip+="AUR ($aur_count):"$'\n'"$aur_updates"
|
|
||||||
fi
|
|
||||||
|
|
||||||
jq --compact-output -n \
|
|
||||||
--arg text "$total" \
|
|
||||||
--arg alt "has-updates" \
|
|
||||||
--arg tooltip "$tooltip" \
|
|
||||||
--arg class "has-updates" \
|
|
||||||
'{text: $text, alt: $alt, tooltip: $tooltip, class: $class}' > "$CACHE_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Output cached result (empty cache = no updates = module hidden)
|
|
||||||
cat "$CACHE_FILE"
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"__aboutme1": "Moonarch default waybar configuration for Niri.",
|
"__aboutme1": "Moonarch default waybar configuration for Niri.",
|
||||||
"__aboutme2": "Deployed to /etc/xdg/waybar/ by moonarch-git package.",
|
"__aboutme2": "User overrides go in ~/.config/waybar/config",
|
||||||
"layer": "top",
|
"layer": "top",
|
||||||
"margin-top": 0,
|
"margin-top": 0,
|
||||||
"spacing": 5,
|
"spacing": 5,
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"modules": [
|
"modules": [
|
||||||
"custom/cpugov",
|
"custom/cpugov",
|
||||||
"gamemode",
|
"gamemode",
|
||||||
"custom/updates",
|
//"custom/updates",
|
||||||
"idle_inhibitor",
|
"idle_inhibitor",
|
||||||
"custom/notification",
|
"custom/notification",
|
||||||
"privacy"
|
"privacy"
|
||||||
@ -205,9 +205,9 @@
|
|||||||
"has-updates": "",
|
"has-updates": "",
|
||||||
"updated": ""
|
"updated": ""
|
||||||
},
|
},
|
||||||
"exec": "moonarch-waybar-updates",
|
"exec-if": "which waybar-module-pacman-updates",
|
||||||
"interval": 60,
|
"exec": "waybar-module-pacman-updates",
|
||||||
"on-click": "foot paru"
|
"on-click": "alacritty paru"
|
||||||
},
|
},
|
||||||
"custom/notification": {
|
"custom/notification": {
|
||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
|
|||||||
@ -190,8 +190,8 @@ widget widget>* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#taskbar button {
|
#taskbar button {
|
||||||
padding: 3px 4px 0 10px;
|
padding: 0 4px 0 10px;
|
||||||
border-bottom: 3px solid transparent;
|
transition: 100ms border ease-in-out;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,9 +204,7 @@ widget widget>* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#taskbar button.active {
|
#taskbar button.active {
|
||||||
background-color: alpha(@theme_selected_bg_color, 0.1);
|
background-color: alpha(@theme_selected_bg_color, 0.05);
|
||||||
border-bottom: 3px solid @theme_selected_bg_color;
|
|
||||||
padding-bottom: 0px;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user