From 7a7334f1ce95ea946506b37193ef4fb71f8f6744 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Thu, 19 Feb 2026 01:01:59 -0500 Subject: Added config files for waybar-weather Added settinmgs to toggle C/F On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: CHANGELOG.md renamed: update-dots.sh -> archive/update-dots.sh modified: config/hypr/scripts/Kool_Quick_Settings.sh new file: config/hypr/scripts/Toggle-weather-waybar-units.sh new file: config/waybar-weather/cityname.txt new file: config/waybar-weather/config.toml new file: config/waybar-weather/geolocation.txt modified: copy.sh --- CHANGELOG.md | 9 +- archive/update-dots.sh | 81 ++++++++++ config/hypr/scripts/Kool_Quick_Settings.sh | 2 + config/hypr/scripts/Toggle-weather-waybar-units.sh | 33 ++++ config/waybar-weather/cityname.txt | 13 ++ config/waybar-weather/config.toml | 176 +++++++++++++++++++++ config/waybar-weather/geolocation.txt | 13 ++ copy.sh | 41 +++++ update-dots.sh | 81 ---------- 9 files changed, 367 insertions(+), 82 deletions(-) create mode 100755 archive/update-dots.sh create mode 100755 config/hypr/scripts/Toggle-weather-waybar-units.sh create mode 100644 config/waybar-weather/cityname.txt create mode 100644 config/waybar-weather/config.toml create mode 100644 config/waybar-weather/geolocation.txt delete mode 100755 update-dots.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a312758..332c6f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,14 @@ ## v2.3.21 -- Update look of `fastfetch` compact config file +- Updated `waybar-weather` + - Created default files in `.config/waybar-weather` + - You can manually override settings or providers + - The defaults should work for most users + - Added question during install to set `metric` or `imperial` Temp units + - Added Menu item is Quick Settings to toggle units + - Note: After changing units click on the weather widget to update units +- Updated look of `fastfetch` compact config file - Fixed no tooltips when `waybar cava` running - Thank you Max Gangel for the fix! - Added check for `rsync` in `copy.sh` diff --git a/archive/update-dots.sh b/archive/update-dots.sh new file mode 100755 index 00000000..84bd7611 --- /dev/null +++ b/archive/update-dots.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +if [[ -t 1 ]]; then + BOLD="$(tput bold || true)" + DIM="$(tput dim || true)" + RED="$(tput setaf 1 || true)" + GREEN="$(tput setaf 2 || true)" + YELLOW="$(tput setaf 3 || true)" + BLUE="$(tput setaf 4 || true)" + RESET="$(tput sgr0 || true)" +else + BOLD=""; DIM=""; RED=""; GREEN=""; YELLOW=""; BLUE=""; RESET="" +fi + +log() { printf "%b\n" "${BLUE}==>${RESET} $*"; } +ok() { printf "%b\n" "${GREEN}✔${RESET} $*"; } +warn() { printf "%b\n" "${YELLOW}⚠${RESET} $*"; } +err() { printf "%b\n" "${RED}✖${RESET} $*"; } + +log "${BOLD}Hyprland-Dots updater${RESET}" + +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + err "Not inside a git repository." + exit 1 +fi + +branch="$(git rev-parse --abbrev-ref HEAD)" +if [[ "$branch" == "HEAD" ]]; then + warn "Detached HEAD state detected." +fi + +log "Fetching remote updates..." +git fetch --tags --quiet + +upstream="" +if git rev-parse --abbrev-ref --symbolic-full-name "@{u}" >/dev/null 2>&1; then + upstream="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}")" +else + if git show-ref --verify --quiet "refs/remotes/origin/${branch}"; then + upstream="origin/${branch}" + fi +fi + +if [[ -z "$upstream" ]]; then + err "No upstream found for branch '${branch}'." + exit 1 +fi + +log "Current branch: ${BOLD}${branch}${RESET}" +log "Upstream: ${BOLD}${upstream}${RESET}" + +behind_count="$(git rev-list --count "HEAD..${upstream}")" +ahead_count="$(git rev-list --count "${upstream}..HEAD")" + +if [[ "$behind_count" -eq 0 ]]; then + ok "Already up to date with ${upstream}." + if [[ "$ahead_count" -gt 0 ]]; then + warn "Local branch is ahead by ${ahead_count} commit(s)." + fi + exit 0 +fi + +warn "Updates available: behind by ${behind_count} commit(s)." +read -r -p "Update now? [y/N] " reply +case "${reply:-}" in + y|Y|yes|YES) + log "Stashing local changes..." + git stash -u + + log "Pulling latest changes from ${upstream}..." + git pull + + ok "Update complete." + printf "%b\n" "${DIM}Next: run ./copy.sh to upgrade the Hyprland dotfiles.${RESET}" + ;; + *) + warn "Update cancelled." + ;; +esac diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index 2e4004c5..5081fe72 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -202,6 +202,7 @@ Choose Hyprland Animations Choose Monitor Profiles Choose Rofi Themes Search for Keybinds +Toggle Waybar Weather units (C/F) Toggle Game Mode Switch Dark-Light Theme Rainbow Borders Mode @@ -263,6 +264,7 @@ main() { "Choose Monitor Profiles") $scriptsDir/MonitorProfiles.sh ;; "Choose Rofi Themes") $scriptsDir/RofiThemeSelector.sh ;; "Search for Keybinds") $scriptsDir/KeyBinds.sh ;; + "Toggle Waybar Weather units (C/F)") $scriptsDir/Toggle-weather-waybar-units.sh ;; "Toggle Game Mode") $scriptsDir/GameMode.sh ;; "Switch Dark-Light Theme") $scriptsDir/DarkLight.sh ;; "Rainbow Borders Mode") rainbow_borders_menu ;; diff --git a/config/hypr/scripts/Toggle-weather-waybar-units.sh b/config/hypr/scripts/Toggle-weather-waybar-units.sh new file mode 100755 index 00000000..4007536c --- /dev/null +++ b/config/hypr/scripts/Toggle-weather-waybar-units.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Toggle waybar-weather units between metric and imperial + +CONFIG_FILE="$HOME/.config/waybar-weather/config.toml" + +if [ ! -f "$CONFIG_FILE" ]; then + notify-send "Weather units" "Config not found: $CONFIG_FILE" + exit 1 +fi + +# Determine current units (default to metric when unset/commented) +current_units="metric" +if grep -qE '^[[:space:]]*units[[:space:]]*=' "$CONFIG_FILE"; then + current_units=$(sed -nE 's/^[[:space:]]*units[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' "$CONFIG_FILE" | head -n1) +fi + +if [ "$current_units" = "imperial" ]; then + new_units="metric" +else + new_units="imperial" +fi + +# Update config: prefer replacing existing units line, otherwise uncomment default, else append +if grep -qE '^[[:space:]]*units[[:space:]]*=' "$CONFIG_FILE"; then + sed -i 's/^[[:space:]]*units[[:space:]]*=.*/units = "'"$new_units"'"/' "$CONFIG_FILE" +elif grep -qE '^[[:space:]]*#\s*units[[:space:]]*=' "$CONFIG_FILE"; then + sed -i 's/^[[:space:]]*#\s*units[[:space:]]*=.*/units = "'"$new_units"'"/' "$CONFIG_FILE" +else + printf '\nunits = "%s"\n' "$new_units" >> "$CONFIG_FILE" +fi + +pkill waybar-weather 2>/dev/null || true +notify-send "Weather units now ${new_units}" "Click on waybar-weather to update units" diff --git a/config/waybar-weather/cityname.txt b/config/waybar-weather/cityname.txt new file mode 100644 index 00000000..c9a67422 --- /dev/null +++ b/config/waybar-weather/cityname.txt @@ -0,0 +1,13 @@ +## SPDX-FileCopyrightText: Winni Neessen +## +## SPDX-License-Identifier: MIT +## +## Example file for the cityname_file geobus provider +## This provider is based on a simple file containing a , pair +## pointing towards the desired location. +## +## The geolocation file must be placed in the waybar-weather config directory: +## ~/.config/waybar-weather/cityname +## +## The following coordinates point towards coordinates: 37.332806,-122.005371 +Apple Park Cupertino, California \ No newline at end of file diff --git a/config/waybar-weather/config.toml b/config/waybar-weather/config.toml new file mode 100644 index 00000000..7a7b9b28 --- /dev/null +++ b/config/waybar-weather/config.toml @@ -0,0 +1,176 @@ +# SPDX-FileCopyrightText: Winni Neessen +# +# SPDX-License-Identifier: MIT + +## ============================================================================= +## General Configuration +## ============================================================================= + +## Measurement system used for weather data. +## Allowed values: "metric", "imperial" +## Default: "metric" +# +# units = "metric" + +## Locale used for geolocation and formatting. +## If unset, the locale may be determined automatically from the environment. +# +# locale = "en-US" + +## Log verbosity level. +## Supported values: +## DEBUG = -4 +## INFO = 0 +## WARN = 4 +## ERROR = 8 +## Default: 0 (INFO) +# +# loglevel = 0 + + +## ============================================================================= +## Weather Configuration +## ============================================================================= +[weather] + +## Weather data provider. +## Supported providers: +## - Open-Meteo => config name: "open-meteo" +## Default: "open-meteo" +# +# provider = "open-meteo" + +## Number of hours ahead to use as forecast values +## Allowed values: 1–24 +## Default: 3 +# +# forecast_hours = 3 + +## Temperature threshold below which conditions are classified as cold. +## Defaults are expressed in degrees Celsius and are based on +## potentially hazardous driving conditions. +## +## If the temperature goes below the configured cold_threshold, waybar-weather +## will output an additional CSS class "cold", that can be used in the waybar style +## config to style waybar-weather differently in these kind of conditions. +## +## Default: 2 +# +# cold_threshold = 2.0 + +## Temperature threshold above which conditions are classified as hot. +## Defaults are expressed in degrees Celsius and are based on +## uncomfortable or potentially dangerous heat levels. +## +## If the temperature goes above the configured hot_threshold, waybar-weather +## will output an additional CSS class "hot", that can be used in the waybar style +## config to style waybar-weather differently in these kind of conditions. +## +## Default: 30 +# +# hot_threshold = 30.0 + + +## ============================================================================= +## Update and Output Intervals +## ============================================================================= +[intervals] + +## Interval at which weather data is refreshed from the provider. +## Default: 15m +# +# weather_update = "15m" + +## Interval at which output data is emitted to waybar. +## Default: 30s +# +# output = "30s" + + +## ============================================================================= +## Output Templates +## ============================================================================= +[templates] + +## waybar-weather providers different templating options, that allow you to customize waybar-weather +## in the way you like. waybar-weather uses the Go templating syntax (reference: https://pkg.go.dev/text/template) +## We provide several variables and functions that represent address or weather data (current or forcasted) +## that can be used to show as output for waybar-weather. +## +## In general there are two different types of output: "text" and "tooltip". "text" is the value that is +## always shown in the waybar and "tooltip" is the text that is shown when hovering over the waybar menu item. +## Additionally, we provide "alt_text" and "alt_tooltip" which can be used as alternative text to be displayed. +## You can toggle between text/tooltip and alt_text/alt_tooltip by clicking the menu item. Be default we use +## this to toggle between current and forecasted weather data. +## +## Please refer to the README for available variables and functions. + +## Primary text template used for output rendering. +# +# text = "" + +## Alternative text template. +# +# alt_text = "" + +## Primary tooltip template. +# +# tooltip = "" + +## Alternative tooltip template. +# +# alt_tooltip = "" + +## Use CSS-based icons instead of rendering icons directly in the template. +## When enabled, waybar-weather will emit appropriate CSS classes +## that can be styled in the waybar stylesheet. +## +## Default: false +# +# use_css_icon = false + + +## ============================================================================= +## Geolocation Configuration +## ============================================================================= +[geolocation] + +## Path to a static geolocation file for the geolocation_file provider. +## If set, this file is used with the highest accuracy. +# +# geolocation_file = "" + +## Path to a static city name file. +## If set, this file is used to resolve human-readable location names. +# +# cityname_file = "" + +## Disable individual geolocation providers. +## All providers are enabled by default - they might not provide data, though (e. g. if no gpsd is running, +## the gpsd provider will not be able to provide location data). +## +## For details on the different geolocation providers, please refer the README. +# +# disable_geoip = false +# disable_geoapi = false +# disable_geolocation_file = false +# disable_cityname_file = false +# disable_ichnaea = false +# disable_gpsd = false + + +## ============================================================================= +## Geocoder Configuration +## ============================================================================= +[geocoder] + +## For details on the different geocoder providers, please refer the README. + +## Reverse geocoding provider used to resolve human-readable locations. +## Default: "nominatim" +# +# provider = "nominatim" + +## API key for the selected geocoding provider, if required. +# +# apikey = "" diff --git a/config/waybar-weather/geolocation.txt b/config/waybar-weather/geolocation.txt new file mode 100644 index 00000000..498d6ac2 --- /dev/null +++ b/config/waybar-weather/geolocation.txt @@ -0,0 +1,13 @@ +## SPDX-FileCopyrightText: Winni Neessen +## +## SPDX-License-Identifier: MIT +## +## Example file for the geolocation_file geobus provider +## This provider is based on a simple file containing a , pair +## pointing towards the desired location. +## +## The geolocation file must be placed in the waybar-weather config directory: +## ~/.config/waybar-weather/geolocation +## +## The following coordinates point towards Apple Park in Cupertino, CA +37.332806,-122.005371 \ No newline at end of file diff --git a/copy.sh b/copy.sh index ea582fca..8d04ef4e 100755 --- a/copy.sh +++ b/copy.sh @@ -415,6 +415,47 @@ printf "\n%.0s" {1..1} printf "${INFO} - Copying dotfiles ${SKY_BLUE}second${RESET} part\n" copy_phase2 "$LOG" printf "\\n%.0s" {1..1} +# Non-express upgrades: copy waybar-weather config and optionally set units +if [ "$UPGRADE_MODE" -eq 1 ] && [ "$EXPRESS_MODE" -eq 0 ]; then + WAYBAR_WEATHER_SRC="$DOTFILES_DIR/config/waybar-weather" + WAYBAR_WEATHER_DEST="$HOME/.config/waybar-weather" + if [ -d "$WAYBAR_WEATHER_SRC" ]; then + echo "${INFO} - Copying waybar-weather config for upgrade" 2>&1 | tee -a "$LOG" + mkdir -p "$WAYBAR_WEATHER_DEST" + cp -r "$WAYBAR_WEATHER_SRC/." "$WAYBAR_WEATHER_DEST/" 2>&1 | tee -a "$LOG" + else + echo "${WARN} - waybar-weather config not found at $WAYBAR_WEATHER_SRC" 2>&1 | tee -a "$LOG" + fi + + while true; do + read -r -p "${CAT} Use Fahrenheit (F) or Celsius (C)? [C]: " WEATHER_UNITS + WEATHER_UNITS=$(echo "${WEATHER_UNITS}" | tr '[:upper:]' '[:lower:]') + case "$WEATHER_UNITS" in + f|fahrenheit) + WEATHER_CFG="$WAYBAR_WEATHER_DEST/config.toml" + if [ -f "$WEATHER_CFG" ]; then + if grep -qE '^[[:space:]]*units[[:space:]]*=' "$WEATHER_CFG"; then + sed -i 's/^[[:space:]]*units[[:space:]]*=.*/units = "imperial"/' "$WEATHER_CFG" + elif grep -qE '^[[:space:]]*#\s*units[[:space:]]*=' "$WEATHER_CFG"; then + sed -i 's/^[[:space:]]*#\s*units[[:space:]]*=.*/units = "imperial"/' "$WEATHER_CFG" + else + printf '\nunits = "imperial"\n' >> "$WEATHER_CFG" + fi + echo "${OK} - Set waybar-weather units to imperial" 2>&1 | tee -a "$LOG" + else + echo "${WARN} - waybar-weather config not found at $WEATHER_CFG" 2>&1 | tee -a "$LOG" + fi + break + ;; + c|celsius|"") + # Default config already uses metric; no change needed + break + ;; + *) + echo "${WARN} Please enter 'F' or 'C'." ;; + esac + done +fi # ags config # Check if ags is installed diff --git a/update-dots.sh b/update-dots.sh deleted file mode 100755 index 84bd7611..00000000 --- a/update-dots.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -IFS=$'\n\t' - -if [[ -t 1 ]]; then - BOLD="$(tput bold || true)" - DIM="$(tput dim || true)" - RED="$(tput setaf 1 || true)" - GREEN="$(tput setaf 2 || true)" - YELLOW="$(tput setaf 3 || true)" - BLUE="$(tput setaf 4 || true)" - RESET="$(tput sgr0 || true)" -else - BOLD=""; DIM=""; RED=""; GREEN=""; YELLOW=""; BLUE=""; RESET="" -fi - -log() { printf "%b\n" "${BLUE}==>${RESET} $*"; } -ok() { printf "%b\n" "${GREEN}✔${RESET} $*"; } -warn() { printf "%b\n" "${YELLOW}⚠${RESET} $*"; } -err() { printf "%b\n" "${RED}✖${RESET} $*"; } - -log "${BOLD}Hyprland-Dots updater${RESET}" - -if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - err "Not inside a git repository." - exit 1 -fi - -branch="$(git rev-parse --abbrev-ref HEAD)" -if [[ "$branch" == "HEAD" ]]; then - warn "Detached HEAD state detected." -fi - -log "Fetching remote updates..." -git fetch --tags --quiet - -upstream="" -if git rev-parse --abbrev-ref --symbolic-full-name "@{u}" >/dev/null 2>&1; then - upstream="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}")" -else - if git show-ref --verify --quiet "refs/remotes/origin/${branch}"; then - upstream="origin/${branch}" - fi -fi - -if [[ -z "$upstream" ]]; then - err "No upstream found for branch '${branch}'." - exit 1 -fi - -log "Current branch: ${BOLD}${branch}${RESET}" -log "Upstream: ${BOLD}${upstream}${RESET}" - -behind_count="$(git rev-list --count "HEAD..${upstream}")" -ahead_count="$(git rev-list --count "${upstream}..HEAD")" - -if [[ "$behind_count" -eq 0 ]]; then - ok "Already up to date with ${upstream}." - if [[ "$ahead_count" -gt 0 ]]; then - warn "Local branch is ahead by ${ahead_count} commit(s)." - fi - exit 0 -fi - -warn "Updates available: behind by ${behind_count} commit(s)." -read -r -p "Update now? [y/N] " reply -case "${reply:-}" in - y|Y|yes|YES) - log "Stashing local changes..." - git stash -u - - log "Pulling latest changes from ${upstream}..." - git pull - - ok "Update complete." - printf "%b\n" "${DIM}Next: run ./copy.sh to upgrade the Hyprland dotfiles.${RESET}" - ;; - *) - warn "Update cancelled." - ;; -esac -- cgit v1.2.3