diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-10 16:37:48 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-10 16:37:48 -0600 |
| commit | e6a6dbadaea0b6de4d9ea080885aed3214dbbef4 (patch) | |
| tree | 4cbfc081bdf4198c38bff51e7ae12f9818c921af /dotfiles/hyprland/.local/bin/waybar-date | |
| parent | f0ce9ef3dd4c728bb80afc58fc7e5d28734b61ea (diff) | |
| download | archsetup-e6a6dbadaea0b6de4d9ea080885aed3214dbbef4.tar.gz archsetup-e6a6dbadaea0b6de4d9ea080885aed3214dbbef4.zip | |
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/bin/waybar-date')
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-date | 19 |
1 files changed, 19 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" |
