diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-02-23 18:47:47 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2026-02-23 18:47:47 -0500 |
| commit | 59e87cbf4482efb6d7c8ff766f80b0286a20732b (patch) | |
| tree | 7b2bdf7ae6c399a54e154896b78dfef9ec0dd2b7 /scripts/lib_apps.sh | |
| parent | c8767dfaa8c9efbeeec0293ffe4287a40c02b34c (diff) | |
| parent | c1ae43efc9196eca55c59cc43dd8f85975d84206 (diff) | |
Merge branch 'development'
Conflicts:
README.md
config/fastfetch/config-compact.jsonc
config/fastfetch/config.jsonc
config/hypr/scripts/Tak0-Per-Window-Switch.sh
i18n/README/README.de.md
i18n/README/README.jp.md
i18n/README/README.ro.md
i18n/README/README.ru.md
i18n/README/README.ua.md
It looks like you may be committing a merge.
If this is not correct, please run
git update-ref -d MERGE_HEAD
and try again.
Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit.
On branch main
Your branch is up to date with 'origin/main'.
All conflicts fixed but you are still merging.
Changes to be committed:
modified: CHANGELOG.md
modified: README.md
renamed: update-dots.sh -> archive/update-dots.sh
new file: assets/waybar-weather.gz
new file: config/fastfetch/config-compact-legacy.jsonc
modified: config/fastfetch/config-compact.jsonc
modified: config/fastfetch/config.jsonc
new file: config/fastfetch/config.legacy.jsonc
modified: config/hypr/UserConfigs/WindowRules.conf
new file: config/hypr/UserScripts/RainbowBorders-low-cpu.sh
modified: config/hypr/configs/ENVariables.conf
modified: config/hypr/configs/Keybinds.conf
modified: config/hypr/configs/Startup_Apps.conf
modified: config/hypr/configs/WindowRules-config-v3.conf
modified: config/hypr/configs/WindowRules.conf
modified: config/hypr/monitors.conf
modified: config/hypr/scripts/Kitty_themes.sh
modified: config/hypr/scripts/Kool_Quick_Settings.sh
new file: config/hypr/scripts/PortalHyprlandUbuntu2604.sh
modified: config/hypr/scripts/Refresh.sh
modified: config/hypr/scripts/Tak0-Per-Window-Switch.sh
new file: config/hypr/scripts/Toggle-Active-Window-Audio.sh
new file: config/hypr/scripts/Toggle-weather-waybar-units.sh
modified: config/hypr/scripts/WallustSwww.sh
modified: config/hypr/scripts/WaybarCava.sh
new file: config/hypr/scripts/dots-tui
new file: config/hypr/scripts/dots-tui-ubuntu-2404
new file: config/hypr/scripts/hyprshot.sh
new file: config/hypr/scripts/install-uv.sh
renamed: config/hypr/v2.3.20 -> config/hypr/v2.3.21
modified: config/hypr/wallpaper_effects/.wallpaper_current
modified: config/kitty/kitty.conf
new file: config/rofi/00-terminal.rasi
modified: config/rofi/config.rasi
modified: config/wallust/templates/colors-waybar.css
new file: config/wallust/wallust-kitty.toml
modified: config/wallust/wallust.toml
new file: config/waybar-weather/cityname.txt
new file: config/waybar-weather/config.toml
new file: config/waybar-weather/geolocation.txt
modified: config/waybar/ModulesCustom
modified: config/waybar/config
renamed: config/waybar/configs/[BOT & Left] SouthWest -> config/waybar/configs/BOT-&-Left-SouthWest
renamed: config/waybar/configs/[BOT & Right] SouthEast -> config/waybar/configs/BOT-&-Right-SouthEast
renamed: config/waybar/configs/[BOT] Camellia -> config/waybar/configs/BOT-Camellia
renamed: config/waybar/configs/[BOT] Chrysanthemum -> config/waybar/configs/BOT-Chrysanthemum
renamed: config/waybar/configs/[BOT] Default -> config/waybar/configs/BOT-Default
renamed: config/waybar/configs/[BOT] Default Laptop -> config/waybar/configs/BOT-Default-Laptop
renamed: config/waybar/configs/[BOT] Gardenia -> config/waybar/configs/BOT-Gardenia
renamed: config/waybar/configs/[BOT] Peony -> config/waybar/configs/BOT-Peony
renamed: config/waybar/configs/[BOT] Simple -> config/waybar/configs/BOT-Simple
renamed: config/waybar/configs/[BOT] Sleek -> config/waybar/configs/BOT-Sleek
renamed: config/waybar/configs/[LEFT] WestWing -> config/waybar/configs/LEFT-WestWing
renamed: config/waybar/configs/[LEFT] WestWing v2 -> config/waybar/configs/LEFT-WestWing-v2
renamed: config/waybar/configs/[RIGHT] EastWing -> config/waybar/configs/RIGHT-EastWing
renamed: config/waybar/configs/[RIGHT] EastWing v2 -> config/waybar/configs/RIGHT-EastWing-v2
renamed: config/waybar/configs/[TOP & BOT] SummitSplit -> config/waybar/configs/TOP-&-BOT-SummitSplit
renamed: config/waybar/configs/[TOP & BOT] SummitSplit-glass -> config/waybar/configs/TOP-&-BOT-SummitSplit-glass
renamed: config/waybar/configs/[TOP & BOT] SummitSplit v2 -> config/waybar/configs/TOP-&-BOT-SummitSplit-v2
new file: config/waybar/configs/TOP-&-BOT-SummitSplit-v3
renamed: config/waybar/configs/[TOP & Left] NorthWest -> config/waybar/configs/TOP-&-Left-NorthWest
renamed: config/waybar/configs/[TOP & Right] NorthEast -> config/waybar/configs/TOP-&-Right-NorthEast
renamed: config/waybar/configs/[TOP] 0-Ja-0 -> config/waybar/configs/TOP-0-Ja-0
renamed: config/waybar/configs/[TOP] Arrow -> config/waybar/configs/TOP-Arrow
renamed: config/waybar/configs/[TOP] Camellia -> config/waybar/configs/TOP-Camellia
renamed: config/waybar/configs/[TOP] Chrysanthemum -> config/waybar/configs/TOP-Chrysanthemum
renamed: config/waybar/configs/[TOP] Default -> config/waybar/configs/TOP-Default
renamed: config/waybar/configs/[TOP] Default Laptop -> config/waybar/configs/TOP-Default-Laptop
renamed: config/waybar/configs/[TOP] Default Laptop-glass -> config/waybar/configs/TOP-Default-Laptop-glass
renamed: config/waybar/configs/[TOP] Default Laptop (old v1) -> config/waybar/configs/TOP-Default-Laptop-old-v1
renamed: config/waybar/configs/[TOP] Default Laptop (old v2) -> config/waybar/configs/TOP-Default-Laptop-old-v2
renamed: config/waybar/configs/[TOP] Default Laptop (old v3) -> config/waybar/configs/TOP-Default-Laptop-old-v3
renamed: config/waybar/configs/[TOP] Default Laptop (old v4) -> config/waybar/configs/TOP-Default-Laptop-old-v4
renamed: config/waybar/configs/[TOP] Default Laptop (old v5) -> config/waybar/configs/TOP-Default-Laptop-old-v5
renamed: config/waybar/configs/[TOP] Default (old v1) -> config/waybar/configs/TOP-Default-old-v1
renamed: config/waybar/configs/[TOP] Default (old v2) -> config/waybar/configs/TOP-Default-old-v2
renamed: config/waybar/configs/[TOP] Default (old v3) -> config/waybar/configs/TOP-Default-old-v3
renamed: config/waybar/configs/[TOP] Default (old v4) -> config/waybar/configs/TOP-Default-old-v4
renamed: config/waybar/configs/[TOP] Everforest -> config/waybar/configs/TOP-Everforest
renamed: config/waybar/configs/[TOP] Everforest-glass -> config/waybar/configs/TOP-Everforest-glass
renamed: config/waybar/configs/[TOP] Gardenia -> config/waybar/configs/TOP-Gardenia
renamed: config/waybar/configs/[TOP] Minimal - Long -> config/waybar/configs/TOP-Minimal-Long
renamed: config/waybar/configs/[TOP] Minimal - Short -> config/waybar/configs/TOP-Minimal-Short
renamed: config/waybar/configs/[TOP] Peony -> config/waybar/configs/TOP-Peony
renamed: config/waybar/configs/[TOP] Simple -> config/waybar/configs/TOP-Simple
renamed: config/waybar/configs/[TOP] Simpliest -> config/waybar/configs/TOP-Simpliest
renamed: config/waybar/configs/[TOP] Sleek -> config/waybar/configs/TOP-Sleek
new file: config/waybar/configs/TOP-ddubs-simple-bar
modified: config/waybar/style.css
renamed: config/waybar/style/[0 VERTICAL] [Catpuccin] Mocha.css -> config/waybar/style/0-VERTICAL-Catpuccin-Mocha.css
renamed: config/waybar/style/[0 VERTICAL] Golden Noir.css -> config/waybar/style/0-VERTICAL-Golden-Noir.css
renamed: config/waybar/style/[0 VERTICAL] Oglo Chicklets.css -> config/waybar/style/0-VERTICAL-Oglo-Chicklets.css
renamed: config/waybar/style/[Black & White] Monochrome.css -> config/waybar/style/Black-&-White-Monochrome.css
renamed: config/waybar/style/[Catppuccin] Frappe.css -> config/waybar/style/Catppuccin-Frappe.css
renamed: config/waybar/style/[Catppuccin] Latte.css -> config/waybar/style/Catppuccin-Latte.css
renamed: config/waybar/style/[Catppuccin] Mocha.css -> config/waybar/style/Catppuccin-Mocha.css
renamed: config/waybar/style/[Colored] Chroma Glow.css -> config/waybar/style/Colored-Chroma-Glow.css
renamed: config/waybar/style/[Colored] Translucent.css -> config/waybar/style/Colored-Translucent.css
renamed: config/waybar/style/[Colorful] Aurora Blossom.css -> config/waybar/style/Colorful-Aurora-Blossom.css
renamed: config/waybar/style/[Colorful] Aurora.css -> config/waybar/style/Colorful-Aurora.css
renamed: config/waybar/style/[Colorful] Oglo Chicklets.css -> config/waybar/style/Colorful-Oglo-Chicklets.css
renamed: config/waybar/style/[Colorful] Rainbow Spectrum.css -> config/waybar/style/Colorful-Rainbow-Spectrum.css
renamed: config/waybar/style/[Colorful] stolen-style.css -> config/waybar/style/Colorful-stolen-style.css
renamed: config/waybar/style/Crystal Clear Glass.css -> config/waybar/style/Crystal-Clear-Glass.css
renamed: config/waybar/style/[Dark] Golden Eclipse.css -> config/waybar/style/Dark-Golden-Eclipse.css
renamed: config/waybar/style/[Dark] Golden Noir.css -> config/waybar/style/Dark-Golden-Noir.css
renamed: config/waybar/style/[Dark] Half-Moon.css -> config/waybar/style/Dark-Half-Moon.css
renamed: config/waybar/style/[Dark] Latte-Wallust combined v2.css -> config/waybar/style/Dark-Latte-Wallust-combined-v2.css
renamed: config/waybar/style/[Dark] Latte-Wallust combined.css -> config/waybar/style/Dark-Latte-Wallust-combined.css
renamed: config/waybar/style/[Dark] Purpl.css -> config/waybar/style/Dark-Purpl.css
renamed: config/waybar/style/[Dark] Wallust Obsidian Edge.css -> config/waybar/style/Dark-Wallust-Obsidian-Edge.css
renamed: config/waybar/style/[Extra] Arrow.css -> config/waybar/style/Extra-Arrow.css
renamed: config/waybar/style/[Extra] Crimson.css -> config/waybar/style/Extra-Crimson.css
renamed: config/waybar/style/[Extra] EverForest.css -> config/waybar/style/Extra-EverForest.css
renamed: config/waybar/style/[Extra] ML4W starter.css -> config/waybar/style/Extra-ML4W-starter.css
renamed: config/waybar/style/[Extra] Mauve.css -> config/waybar/style/Extra-Mauve.css
renamed: config/waybar/style/[Extra] Modern-Combined - Transparent.css -> config/waybar/style/Extra-Modern-Combined-Transparent.css
renamed: config/waybar/style/[Extra] Modern-Combined.css -> config/waybar/style/Extra-Modern-Combined.css
renamed: config/waybar/style/[Extra] Neon Circuit.css -> config/waybar/style/Extra-Neon-Circuit.css
renamed: config/waybar/style/[Extra] Prismatic Glow.css -> config/waybar/style/Extra-Prismatic-Glow.css
renamed: config/waybar/style/[Extra] Rose Pine.css -> config/waybar/style/Extra-Rose-Pine.css
renamed: config/waybar/style/[Extra] Simple Pink.css -> config/waybar/style/Extra-Simple-Pink.css
renamed: config/waybar/style/[Light] Monochrome Contrast.css -> config/waybar/style/Light-Monochrome-Contrast.css
renamed: config/waybar/style/[Light] Obsidian Glow.css -> config/waybar/style/Light-Obsidian-Glow.css
renamed: config/waybar/style/ML4W Glass-3d.css -> config/waybar/style/ML4W-Glass-3d.css
renamed: config/waybar/style/ML4W Glass.css -> config/waybar/style/ML4W-Glass.css
renamed: config/waybar/style/[Rainbow] RGB Bordered.css -> config/waybar/style/Rainbow-RGB-Bordered.css
renamed: config/waybar/style/[Retro] Simple Style.css -> config/waybar/style/Retro-Simple-Style.css
renamed: config/waybar/style/[Transparent] Crystal Clear.css -> config/waybar/style/Transparent-Crystal-Clear.css
renamed: config/waybar/style/[VERTICAL] [Catpuccin] Mocha.css -> config/waybar/style/VERTICAL-Catpuccin-Mocha.css
renamed: config/waybar/style/[Wallust Bordered] Chroma Fusion Edge.css -> config/waybar/style/Wallust-Bordered-Chroma-Fusion-Edge.css
renamed: config/waybar/style/[Wallust Bordered] Chroma Simple.css -> config/waybar/style/Wallust-Bordered-Chroma-Simple.css
renamed: config/waybar/style/[Wallust] Box type.css -> config/waybar/style/Wallust-Box-type.css
renamed: config/waybar/style/[Wallust] Chroma Edge.css -> config/waybar/style/Wallust-Chroma-Edge.css
renamed: config/waybar/style/[Wallust] Chroma Fusion.css -> config/waybar/style/Wallust-Chroma-Fusion.css
renamed: config/waybar/style/[Wallust] Chroma Tally V2.css -> config/waybar/style/Wallust-Chroma-Tally-V2.css
renamed: config/waybar/style/[Wallust] Chroma Tally.css -> config/waybar/style/Wallust-Chroma-Tally.css
renamed: config/waybar/style/[Wallust] Colored.css -> config/waybar/style/Wallust-Colored.css
renamed: config/waybar/style/[WALLUST] ML4W-modern-mixed.css -> config/waybar/style/Wallust-ML4W-modern-mixed.css
renamed: config/waybar/style/[WALLUST] ML4W-modern.css -> config/waybar/style/Wallust-ML4W-modern.css
renamed: config/waybar/style/[Wallust] Simple.css -> config/waybar/style/Wallust-Simple.css
renamed: config/waybar/style/[Wallust Transparent] Crystal Clear.css -> config/waybar/style/Wallust-Transparent-Crystal-Clear.css
modified: config/waybar/wallust/colors-waybar.css
modified: copy.sh
renamed: CODE_OF_CONDUCT.es.md -> i18n/CODE_OF_CONDUCT/CODE_OF_CONDUCT.es.md
new file: i18n/CODE_OF_CONDUCT/CODE_OF_CONDUCT.fr.md
renamed: COMMIT_MESSAGE_GUIDELINES.es.md -> i18n/COMMIT_MESSAGE_GUIDELINES/COMMIT_MESSAGE_GUIDELINES.es.md
new file: i18n/COMMIT_MESSAGE_GUIDELINES/COMMIT_MESSAGE_GUIDELINES.fr.md
renamed: CONTRIBUTING.es.md -> i18n/CONTRIBUTING/CONTRIBUTING.es.md
new file: i18n/CONTRIBUTING/CONTRIBUTING.fr.md
renamed: i18n/README.de.md -> i18n/README/README.de.md
new file: i18n/README/README.fr.md
renamed: i18n/README.jp.md -> i18n/README/README.jp.md
renamed: i18n/README.ro.md -> i18n/README/README.ro.md
renamed: i18n/README.ru.md -> i18n/README/README.ru.md
renamed: i18n/README.ua.md -> i18n/README/README.ua.md
modified: scripts/lib_apps.sh
modified: scripts/lib_copy.sh
modified: scripts/lib_prompts.sh
Diffstat (limited to 'scripts/lib_apps.sh')
| -rw-r--r-- | scripts/lib_apps.sh | 172 |
1 files changed, 160 insertions, 12 deletions
diff --git a/scripts/lib_apps.sh b/scripts/lib_apps.sh index 562e5c5b..f19fd75a 100644 --- a/scripts/lib_apps.sh +++ b/scripts/lib_apps.sh @@ -3,8 +3,9 @@ enable_asusctl() { local log="$1" + local base="${DOTFILES_DIR:-.}" if command -v asusctl >/dev/null 2>&1; then - local OVERLAY_SA="config/hypr/configs/Startup_Apps.conf" + local OVERLAY_SA="$base/config/hypr/configs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = rog-control-center' "$OVERLAY_SA" || echo 'exec-once = rog-control-center' >>"$OVERLAY_SA" @@ -13,8 +14,9 @@ enable_asusctl() { enable_blueman() { local log="$1" + local base="${DOTFILES_DIR:-.}" if command -v blueman-applet >/dev/null 2>&1; then - local OVERLAY_SA="config/hypr/configs/Startup_Apps.conf" + local OVERLAY_SA="$base/config/hypr/configs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = blueman-applet' "$OVERLAY_SA" || echo 'exec-once = blueman-applet' >>"$OVERLAY_SA" @@ -23,33 +25,36 @@ enable_blueman() { enable_ags() { local log="$1" + local base="${DOTFILES_DIR:-.}" if command -v ags >/dev/null 2>&1; then echo "${INFO:-[INFO]} AGS detected - enabling in startup and refresh scripts" 2>&1 | tee -a "$log" - local OVERLAY_SA="config/hypr/configs/Startup_Apps.conf" + local OVERLAY_SA="$base/config/hypr/configs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = ags' "$OVERLAY_SA" || echo 'exec-once = ags' >>"$OVERLAY_SA" - sed -i '/#ags -q && ags &/s/^#//' config/hypr/scripts/RefreshNoWaybar.sh - sed -i '/#ags -q && ags &/s/^#//' config/hypr/scripts/Refresh.sh + sed -i '/#ags -q && ags &/s/^#//' "$base/config/hypr/scripts/RefreshNoWaybar.sh" + sed -i '/#ags -q && ags &/s/^#//' "$base/config/hypr/scripts/Refresh.sh" fi } enable_quickshell() { local log="$1" + local base="${DOTFILES_DIR:-.}" if command -v qs >/dev/null 2>&1; then echo "${INFO:-[INFO]} Quickshell detected - enabling in startup and refresh scripts" 2>&1 | tee -a "$log" - local OVERLAY_SA="config/hypr/configs/Startup_Apps.conf" + local OVERLAY_SA="$base/config/hypr/configs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = qs' "$OVERLAY_SA" || echo 'exec-once = qs' >>"$OVERLAY_SA" - sed -i '/#pkill qs && qs &/s/^#//' config/hypr/scripts/RefreshNoWaybar.sh - sed -i '/#pkill qs && qs &/s/^#//' config/hypr/scripts/Refresh.sh + sed -i '/#pkill qs && qs &/s/^#//' "$base/config/hypr/scripts/RefreshNoWaybar.sh" + sed -i '/#pkill qs && qs &/s/^#//' "$base/config/hypr/scripts/Refresh.sh" fi } ensure_keybinds_init() { local log="$1" - local OVERLAY_SA="config/hypr/configs/Startup_Apps.conf" + local base="${DOTFILES_DIR:-.}" + local OVERLAY_SA="$base/config/hypr/configs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" if ! grep -qx 'exec-once = \$scriptsDir/KeybindsLayoutInit.sh' "$OVERLAY_SA"; then echo 'exec-once = $scriptsDir/KeybindsLayoutInit.sh' >>"$OVERLAY_SA" @@ -59,9 +64,10 @@ ensure_keybinds_init() { install_terminal_configs() { local log="$1" + local base="${DOTFILES_DIR:-.}" # Ghostty - local GHOSTTY_SRC="config/ghostty/ghostty.config" + local GHOSTTY_SRC="$base/config/ghostty/ghostty.config" local GHOSTTY_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty" local GHOSTTY_DEST="$GHOSTTY_DIR/config" if [ -f "$GHOSTTY_SRC" ]; then @@ -75,7 +81,7 @@ install_terminal_configs() { fi # WezTerm - local WEZTERM_SRC="config/wezterm/wezterm.lua" + local WEZTERM_SRC="$base/config/wezterm/wezterm.lua" local WEZTERM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/wezterm" local WEZTERM_DEST="$WEZTERM_DIR/wezterm.lua" if [ -f "$WEZTERM_SRC" ]; then @@ -88,10 +94,11 @@ install_terminal_configs() { choose_default_editor() { local log="$1" + local base="${DOTFILES_DIR:-.}" local editor_set=0 update_editor() { local editor=$1 - sed -i "s/#env = EDITOR,.*/env = EDITOR,$editor #default editor/" config/hypr/UserConfigs/01-UserDefaults.conf + sed -i "s/#env = EDITOR,.*/env = EDITOR,$editor #default editor/" "$base/config/hypr/UserConfigs/01-UserDefaults.conf" echo "${OK:-[OK]} Default editor set to ${MAGENTA:-}$editor${RESET:-}." 2>&1 | tee -a "$log" } if command -v nvim &>/dev/null; then @@ -114,3 +121,144 @@ choose_default_editor() { fi fi } + +# Install waybar-weather on non-NixOS: prefer Arch AUR, otherwise copy prebuilt asset to /usr/bin +install_waybar_weather_binary() { + local log="$1" + local APP_NAME="waybar-weather" + local INSTALL_PATH="/usr/bin/${APP_NAME}" + local ASSET="${SCRIPT_DIR:-.}/assets/${APP_NAME}.gz" + + # Helper: log wrappers may not be defined here; reuse INFO/WARN/ERROR if available + _log() { echo "[${APP_NAME}] $*" 2>&1 | tee -a "$log"; } + _warn() { echo "[${APP_NAME}] WARN: $*" 1>&2 | tee -a "$log"; } + _err() { echo "[${APP_NAME}] ERROR: $*" 1>&2 | tee -a "$log"; } + + # NixOS handled by a separate helper + if grep -qi '^ID=nixos' /etc/os-release 2>/dev/null; then + _warn "NixOS detected. Use install_waybar_weather_nixos instead." + return 0 + fi + + if grep -qi '^ID=arch' /etc/os-release 2>/dev/null; then + if command -v pacman >/dev/null 2>&1 && pacman -Qi weather-waybar >/dev/null 2>&1; then + _log "weather-waybar already installed via pacman." + return 0 + fi + if command -v yay >/dev/null 2>&1; then + _log "Attempting to install AUR package 'weather-waybar' via yay" + if yay -S --noconfirm weather-waybar; then + _log "AUR install succeeded." + return 0 + else + _warn "AUR install failed; will fall back to bundled asset." + fi + else + _warn "yay not found on Arch; falling back to bundled asset." + fi + fi + + # Asset path validation + if [[ ! -f "$ASSET" ]]; then + _err "Asset not found: $ASSET" + return 1 + fi + if ! command -v gzip >/dev/null 2>&1; then + _err "Missing required command: gzip" + return 1 + fi + + # Sudo handling for /usr/bin + local SUDO="" + if [[ $EUID -ne 0 ]]; then + if command -v sudo >/dev/null 2>&1; then + SUDO="sudo" + else + _err "sudo not available; cannot write to ${INSTALL_PATH} as non-root" + return 1 + fi + fi + + _log "Installing prebuilt binary to ${INSTALL_PATH} from ${ASSET}" + if ${SUDO} sh -c "tmp=\$(mktemp '${INSTALL_PATH}.XXXXXX') && gzip -dc '$ASSET' > \"\$tmp\" && chmod 0755 \"\$tmp\" && mv -f \"\$tmp\" '${INSTALL_PATH}'"; then + if "${INSTALL_PATH}" -h >/dev/null 2>&1; then + _log "Installed ${APP_NAME} successfully." + else + _warn "${APP_NAME} installed, but a basic self-check did not run." + fi + else + _err "Failed to install ${APP_NAME} to ${INSTALL_PATH}" + return 1 + fi +} + +# Install waybar-weather on NixOS using Go from the system (no version checks) +install_waybar_weather_nixos() { + local log="$1" + local APP_NAME="waybar-weather" + local DEST="$HOME/.local/bin/${APP_NAME}" + + _log() { echo "[${APP_NAME}] $*" 2>&1 | tee -a "$log"; } + _warn() { echo "[${APP_NAME}] WARN: $*" 1>&2 | tee -a "$log"; } + _err() { echo "[${APP_NAME}] ERROR: $*" 1>&2 | tee -a "$log"; } + + if ! grep -qi '^ID=nixos' /etc/os-release 2>/dev/null; then + _warn "Not NixOS; skipping NixOS-specific build." + return 0 + fi + + if ! command -v go >/dev/null 2>&1; then + _err "Go toolchain not found in PATH. Ensure NixOS-Hyprland provides go, then re-run." + return 1 + fi + if ! command -v git >/dev/null 2>&1; then + _err "git not found; install git and retry." + return 1 + fi + + local tmp + tmp=$(mktemp -d) + trap 'rm -rf "${tmp}"' RETURN + + _log "Cloning waybar-weather source" + if ! git clone --depth 1 https://github.com/wneessen/waybar-weather.git "${tmp}/src" >/dev/null 2>&1; then + _err "git clone failed" + return 1 + fi + + if ! ( + cd "${tmp}/src" || { _err "cd failed"; exit 1; } + _log "Fetching modules" + go mod download >/dev/null 2>&1 || _warn "go mod download returned non-zero; continuing" + _log "Building ${APP_NAME}" + CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o "${APP_NAME}" ./cmd/${APP_NAME} + ); then + _err "go build failed" + return 1 + fi + + mkdir -p "$HOME/.local/bin" + install -m 0755 "${APP_NAME}" "${DEST}" || { _err "install to ${DEST} failed"; return 1; } + + if printf '%s' "$PATH" | grep -q "$HOME/.local/bin"; then + : + else + _warn "~/.local/bin is not in PATH; add it so Waybar can find ${APP_NAME}." + fi + + if "${DEST}" -h >/dev/null 2>&1; then + _log "Installed ${APP_NAME} to ${DEST}" + else + _warn "${APP_NAME} installed, but a basic self-check did not run." + fi +} + +# Wrapper: choose NixOS builder or non-NixOS installer automatically +install_waybar_weather() { + local log="$1" + if grep -qi '^ID=nixos' /etc/os-release 2>/dev/null; then + install_waybar_weather_nixos "$log" + else + install_waybar_weather_binary "$log" + fi +} |
