diff options
| -rwxr-xr-x | archsetup | 1 | ||||
| -rw-r--r-- | assets/outbox/2026-02-10-waybar-date-worldclock.txt | 59 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/aix | 23 | ||||
| -rw-r--r-- | dotfiles/hyprland/.config/waybar/config | 21 | ||||
| -rw-r--r-- | dotfiles/hyprland/.config/waybar/style.css | 15 | ||||
| -rw-r--r-- | dotfiles/hyprland/.config/waybar/worldclock.conf | 18 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-date | 19 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-worldclock | 35 |
8 files changed, 170 insertions, 21 deletions
@@ -1807,6 +1807,7 @@ developer_workstation() { aur_install proselint # grammar checker aur_install gist # command-line gist poster pacman_install aspell # spell check system + pacman_install ditaa # ASCII art to bitmap diagrams (org-babel) pacman_install aspell-en # spell check english files pacman_install fd # a faster find for dired/dirvish pacman_install ffmpegthumbnailer # video previews in dired/dirvish diff --git a/assets/outbox/2026-02-10-waybar-date-worldclock.txt b/assets/outbox/2026-02-10-waybar-date-worldclock.txt new file mode 100644 index 0000000..4cd4668 --- /dev/null +++ b/assets/outbox/2026-02-10-waybar-date-worldclock.txt @@ -0,0 +1,59 @@ +Waybar: Split clock into separate date and world clock modules +============================================================== + +Split the single Waybar clock module into two custom modules so that +each has its own tooltip: date shows a calendar, time shows a world clock. + +What changed +------------ + +Replaced the built-in "clock" module with two custom modules: + +- custom/date: Shows "Tue, Feb 10 2026" on the bar. Tooltip displays the + current month stacked above the next month, with today highlighted in + dupre gold (#daa520). + +- custom/worldclock: Shows "04:36 PM CST" on the bar. Tooltip lists all + configured timezones with their current times. The local timezone is + highlighted in dupre gold. Reads from ~/.config/waybar/worldclock.conf + so timezones can be added/removed without touching any scripts. + +Files added +----------- + +- dotfiles/hyprland/.local/bin/waybar-date + Shell script outputting JSON. Generates the two-month stacked calendar + using cal, highlights today via Pango markup. + +- dotfiles/hyprland/.local/bin/waybar-worldclock + Shell script outputting JSON. Reads worldclock.conf, detects local + timezone via /etc/localtime, highlights it in gold. + +- dotfiles/hyprland/.config/waybar/worldclock.conf + Timezone list sorted earliest to latest: + Honolulu, Anchorage, Berkeley, New Orleans, New York, London, Paris, + Athens, Istanbul, Yerevan, Delhi, Shanghai, Tokyo, Sydney, Wellington. + +Files modified +-------------- + +- dotfiles/hyprland/.config/waybar/config + Replaced "clock" in modules-right with "custom/date" and + "custom/worldclock". Removed the clock block, added the two new + module definitions (interval 60s for date, 30s for worldclock). + +- dotfiles/hyprland/.config/waybar/style.css + Replaced #clock with #custom-date and #custom-worldclock in the shared + selector. Added overrides to tighten spacing: the two modules sit close + together (0.2rem padding between them, zero margin), and the date + module's left side is flush against the tray. + +Deployment +---------- + +Scripts are deployed via stow (stow -R hyprland -t $HOME from the +dotfiles directory). After any changes, reload with: + killall waybar && waybar & + +To customize timezones, edit ~/.config/waybar/worldclock.conf. Changes +appear within 30 seconds. diff --git a/dotfiles/common/.local/bin/aix b/dotfiles/common/.local/bin/aix index a421139..ecbb24c 100755 --- a/dotfiles/common/.local/bin/aix +++ b/dotfiles/common/.local/bin/aix @@ -12,16 +12,6 @@ attach_session() { fi } -# Attach directly to existing session -if [ "$1" = "--attach" ]; then - if ! tmux has-session -t "$SESSION" 2>/dev/null; then - echo "No $SESSION session to attach to." >&2 - exit 1 - fi - attach_session - exit 0 -fi - # Dependency checks for cmd in fzf tmux claude; do if ! command -v "$cmd" &>/dev/null; then @@ -100,6 +90,17 @@ sort_windows() { fi } +# Attach directly to existing session +if [ "$1" = "--attach" ]; then + if ! tmux has-session -t "$SESSION" 2>/dev/null; then + echo "No $SESSION session to attach to." >&2 + exit 1 + fi + sort_windows + attach_session + exit 0 +fi + # If session exists, add new windows to it if tmux has-session -t "$SESSION" 2>/dev/null; then # Get existing window names to filter duplicates @@ -132,11 +133,11 @@ if tmux has-session -t "$SESSION" 2>/dev/null; then [ -z "$first_wid" ] && first_wid="$wid" done - sort_windows tmux select-window -t "$first_wid" fi fi + sort_windows attach_session exit 0 fi diff --git a/dotfiles/hyprland/.config/waybar/config b/dotfiles/hyprland/.config/waybar/config index 5582dc6..c8723d3 100644 --- a/dotfiles/hyprland/.config/waybar/config +++ b/dotfiles/hyprland/.config/waybar/config @@ -19,7 +19,8 @@ "pulseaudio", "idle_inhibitor", "tray", - "clock" + "custom/date", + "custom/worldclock" ], "group/sysmonitor": { @@ -116,14 +117,16 @@ "spacing": 4 }, - "clock": { - "format": "{:%a, %b %d %Y %I:%M %p %Z}", - "tooltip-format": "<small>{calendar}</small>", - "calendar": { - "format": { - "today": "<span color='#daa520'><b><u>{}</u></b></span>" - } - } + "custom/date": { + "exec": "waybar-date", + "return-type": "json", + "interval": 60 + }, + + "custom/worldclock": { + "exec": "waybar-worldclock", + "return-type": "json", + "interval": 30 }, "pulseaudio": { diff --git a/dotfiles/hyprland/.config/waybar/style.css b/dotfiles/hyprland/.config/waybar/style.css index 4551de9..3f7814b 100644 --- a/dotfiles/hyprland/.config/waybar/style.css +++ b/dotfiles/hyprland/.config/waybar/style.css @@ -73,7 +73,8 @@ window#waybar { #pulseaudio, #idle_inhibitor, #tray, -#clock, +#custom-date, +#custom-worldclock, #custom-layout, #window { padding: 0.45rem; @@ -129,6 +130,18 @@ window#waybar { color: #d47c59; } +#custom-date { + margin-left: 0; + padding-left: 0; + margin-right: 0; + padding-right: 0.2rem; +} + +#custom-worldclock { + margin-left: 0; + padding-left: 0.2rem; +} + #tray > .passive { -gtk-icon-effect: dim; } diff --git a/dotfiles/hyprland/.config/waybar/worldclock.conf b/dotfiles/hyprland/.config/waybar/worldclock.conf new file mode 100644 index 0000000..3790cfc --- /dev/null +++ b/dotfiles/hyprland/.config/waybar/worldclock.conf @@ -0,0 +1,18 @@ +# World Clock Timezones — one per line, earliest to latest +# Format: Timezone|Label +# Lines starting with # are ignored +Pacific/Honolulu|Honolulu +America/Anchorage|Anchorage +America/Los_Angeles|Berkeley +America/Chicago|New Orleans +America/New_York|New York +Europe/London|London +Europe/Paris|Paris +Europe/Athens|Athens +Europe/Istanbul|Istanbul +Asia/Yerevan|Yerevan +Asia/Kolkata|Delhi +Asia/Shanghai|Shanghai +Asia/Tokyo|Tokyo +Australia/Sydney|Sydney +Pacific/Auckland|Wellington 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" |
