summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-10 16:37:48 -0600
committerCraig Jennings <c@cjennings.net>2026-02-10 16:37:48 -0600
commitbeddf4eebafe842bcdb45a3e37396f1c2a415cf7 (patch)
tree7bff967517afb517b5c59561854f74e491bf41bb /dotfiles/hyprland/.local
parentb7d7360c4160a30e1f11cbb0aae2be866f4bb9ac (diff)
feat(waybar): split clock into date + world clock modules
Replace single clock module with custom/date (calendar tooltip) and custom/worldclock (multi-timezone tooltip from worldclock.conf). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/hyprland/.local')
-rwxr-xr-xdotfiles/hyprland/.local/bin/waybar-date19
-rwxr-xr-xdotfiles/hyprland/.local/bin/waybar-worldclock35
2 files changed, 54 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/waybar-date b/dotfiles/hyprland/.local/bin/waybar-date
new file mode 100755
index 0000000..72a0000
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/waybar-date
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Waybar date module with two-month calendar tooltip
+DATE=$(date '+%a, %b %d %Y')
+TODAY=$(date '+%-d')
+MONTH=$(date '+%B %Y')
+
+# Generate current month (with today highlighted) stacked above next month
+NEXT_M=$(date -d 'next month' '+%-m')
+NEXT_Y=$(date -d 'next month' '+%Y')
+CUR=$(cal | sed "s/\b${TODAY}\b/<span color='#daa520'><b><u>${TODAY}<\/u><\/b><\/span>/")
+NEXT=$(cal "$NEXT_M" "$NEXT_Y")
+HIGHLIGHTED=$(printf '%s\n%s' "$CUR" "$NEXT")
+
+TOOLTIP="<tt>${HIGHLIGHTED}</tt>"
+
+# Escape for JSON
+TOOLTIP=$(echo "$TOOLTIP" | sed ':a;N;$!ba;s/\n/\\n/g')
+
+printf '{"text": "%s", "tooltip": "%s"}\n' "$DATE" "$TOOLTIP"
diff --git a/dotfiles/hyprland/.local/bin/waybar-worldclock b/dotfiles/hyprland/.local/bin/waybar-worldclock
new file mode 100755
index 0000000..9801dad
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/waybar-worldclock
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Waybar world clock module with configurable timezone tooltip
+CONF="${HOME}/.config/waybar/worldclock.conf"
+
+# Local time for bar display
+TEXT=$(date '+%I:%M %p %Z')
+LOCAL_TZ=$(readlink /etc/localtime | sed 's|.*/zoneinfo/||')
+
+# Build tooltip from config file
+if [ -f "$CONF" ]; then
+ LINES=""
+ while IFS='|' read -r tz label; do
+ # Skip comments and blank lines
+ case "$tz" in \#*|"") continue ;; esac
+ TIME=$(TZ="$tz" date '+%I:%M %p %Z')
+ LINE=$(printf "%-16s %s" "$label" "$TIME")
+ # Highlight local timezone in gold
+ if [ "$tz" = "$LOCAL_TZ" ]; then
+ LINE="<span color='#daa520'>${LINE}</span>"
+ fi
+ if [ -z "$LINES" ]; then
+ LINES="$LINE"
+ else
+ LINES=$(printf "%s\n%s" "$LINES" "$LINE")
+ fi
+ done < "$CONF"
+ TOOLTIP="<tt>${LINES}</tt>"
+else
+ TOOLTIP="No worldclock.conf found"
+fi
+
+# Escape for JSON
+TOOLTIP=$(echo "$TOOLTIP" | sed ':a;N;$!ba;s/\n/\\n/g')
+
+printf '{"text": "%s", "tooltip": "%s"}\n' "$TEXT" "$TOOLTIP"