Prevent wiping waybar configs to reposition

This commit is contained in:
Ryan Hughes
2026-05-11 20:07:18 -04:00
parent aada2a4c9c
commit c0e099fed5
4 changed files with 70 additions and 20 deletions
-16
View File
@@ -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
+23 -4
View File
@@ -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",
+42
View File
@@ -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;
}
+5
View File
@@ -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