From c0e099fed520c5d7f1efbe459bbdadf5fde293e0 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Mon, 11 May 2026 20:07:18 -0400 Subject: [PATCH] Prevent wiping waybar configs to reposition --- bin/omarchy-style-waybar-position | 16 ------------ config/waybar/config.jsonc | 27 +++++++++++++++++--- config/waybar/style.css | 42 +++++++++++++++++++++++++++++++ migrations/1778539119.sh | 5 ++++ 4 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 migrations/1778539119.sh diff --git a/bin/omarchy-style-waybar-position b/bin/omarchy-style-waybar-position index 55ad7c5f..4146d60c 100755 --- a/bin/omarchy-style-waybar-position +++ b/bin/omarchy-style-waybar-position @@ -15,31 +15,15 @@ if [[ ! $position =~ ^(top|bottom|left|right)$ ]]; then exit 1 fi -# Reset config and styles before making adjustments -omarchy-refresh-config waybar/config.jsonc -omarchy-refresh-config waybar/style.css - if [[ $position == "left" || $position == "right" ]]; then height=0 width=28 - horizontal=false else height=26 width=0 - horizontal=true fi -# Change position sed -i -E "s/(\"position\"[[:space:]]*:[[:space:]]*\")[a-z]+(\")/\\1${position}\\2/" "$WAYBAR_CONFIG" - -# Change height/width sed -i -E "s/(\"height\"[[:space:]]*:[[:space:]]*)[0-9]+/\\1${height}/; s/(\"width\"[[:space:]]*:[[:space:]]*)[0-9]+/\\1${width}/" "$WAYBAR_CONFIG" -# Change the clock format -if [[ $horizontal == true ]]; then - sed -i -E '/"clock"[[:space:]]*:[[:space:]]*\{/,/\}/ s/"format"[[:space:]]*:[[:space:]]*"[^"]*"/"format": "{:L%A %H:%M}"/' "$WAYBAR_CONFIG" -else - sed -i -E '/"clock"[[:space:]]*:[[:space:]]*\{/,/\}/ s/"format"[[:space:]]*:[[:space:]]*"[^"]*"/"format": "{:%H\\n  —\\n%M}"/' "$WAYBAR_CONFIG" -fi - omarchy-restart-waybar diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc index 039a06ed..ab6026df 100644 --- a/config/waybar/config.jsonc +++ b/config/waybar/config.jsonc @@ -6,7 +6,7 @@ "height": 26, "width": 0, "modules-left": ["custom/omarchy", "hyprland/workspaces"], - "modules-center": ["clock", "custom/weather", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], + "modules-center": ["clock#horizontal", "clock#vertical", "custom/weather", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], "modules-right": [ "group/tray-expander", "bluetooth", @@ -61,12 +61,18 @@ "on-click": "omarchy-launch-or-focus-tui btop", "on-click-right": "alacritty" }, - "clock": { + "clock#horizontal": { "format": "{:L%A %H:%M}", "format-alt": "{:L%d %B W%V %Y}", "tooltip": false, "on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select" }, + "clock#vertical": { + "format": "{:%H\n  —\n%M}", + "format-alt": "{:L%d %B W%V %Y}", + "tooltip": false, + "on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select" + }, "custom/weather": { "exec": "$OMARCHY_PATH/default/waybar/weather.sh", "return-type": "json", @@ -135,9 +141,13 @@ "transition-duration": 600, "children-class": "tray-group-item" }, - "modules": ["custom/expand-icon", "tray"] + "modules": ["group/expand-icons", "tray"] }, - "custom/expand-icon": { + "group/expand-icons": { + "orientation": "inherit", + "modules": ["custom/expand-icon#horizontal", "custom/expand-icon#vertical"] + }, + "custom/expand-icon#horizontal": { "format": "", "tooltip": false, "on-scroll-up": "", @@ -145,6 +155,15 @@ "on-scroll-left": "", "on-scroll-right": "" }, + "custom/expand-icon#vertical": { + "format": "", + "rotate": 270, + "tooltip": false, + "on-scroll-up": "", + "on-scroll-down": "", + "on-scroll-left": "", + "on-scroll-right": "" + }, "custom/screenrecording-indicator": { "on-click": "omarchy-capture-screenrecording", "exec": "$OMARCHY_PATH/default/waybar/indicators/screen-recording.sh", diff --git a/config/waybar/style.css b/config/waybar/style.css index a490551d..64bf240f 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -110,6 +110,7 @@ tooltip { #custom-voxtype.recording { color: #a55555; } + .left .modules-left, .right .modules-left { margin: 8px 0 0 0; } .left .modules-right, .right .modules-right { margin: 0 0 8px 0; } @@ -145,3 +146,44 @@ tooltip { } .left #custom-voxtype, .right #custom-voxtype { margin: 7.5px 0 0 0; min-width: 0; min-height: 12px; } + +#custom-expand-icon.vertical, +.left #custom-expand-icon.horizontal, +.right #custom-expand-icon.horizontal { + opacity: 0; + font-size: 0; + min-width: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +.left #custom-expand-icon.vertical, +.right #custom-expand-icon.vertical { + opacity: 1; + font-size: inherit; + min-width: 0; + min-height: 12px; + margin: 1.5px 0; + padding: 6px 0; +} + +#clock.vertical, +.left #clock.horizontal, +.right #clock.horizontal { + opacity: 0; + font-size: 0; + min-width: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +.left #clock.vertical, +.right #clock.vertical { + opacity: 1; + font-size: inherit; + min-width: 0; + min-height: 12px; + margin: 8.75px 0 0 0; +} diff --git a/migrations/1778539119.sh b/migrations/1778539119.sh new file mode 100644 index 00000000..42f38268 --- /dev/null +++ b/migrations/1778539119.sh @@ -0,0 +1,5 @@ +echo "Refresh Waybar config and style for position support" + +if gum confirm "Replace current Waybar config and style (backups will be made)?"; then + omarchy-refresh-waybar +fi