From ebc8a9ef621b9a8cf40e97a6cd7c7542c115c002 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 6 Jan 2026 13:09:51 +0100 Subject: [PATCH] Make patching more resilient --- migrations/1767685679.sh | 47 +++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/migrations/1767685679.sh b/migrations/1767685679.sh index 36f5b6ce..80658006 100644 --- a/migrations/1767685679.sh +++ b/migrations/1767685679.sh @@ -1,6 +1,8 @@ echo "Add voxtype to waybar" -patch -N ~/.config/waybar/style.css << 'EOF' +failed=0 + +if ! patch -N ~/.config/waybar/style.css << 'EOF' --- a/waybar/style.css +++ b/waybar/style.css @@ -74,10 +74,16 @@ tooltip { @@ -22,23 +24,26 @@ patch -N ~/.config/waybar/style.css << 'EOF' + margin: 0 0 0 7.5px; +} EOF +then + failed=1 +fi -patch -N ~/.config/waybar/config.jsonc << 'EOF' +if ! patch -N ~/.config/waybar/config.jsonc << 'EOF' --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -5,7 +5,7 @@ - "spacing": 0, - "height": 26, - "modules-left": ["custom/omarchy", "hyprland/workspaces"], + "spacing": 0, + "height": 26, + "modules-left": ["custom/omarchy", "hyprland/workspaces"], - "modules-center": ["clock", "custom/update", "custom/screenrecording-indicator"], + "modules-center": ["clock", "custom/update", "custom/voxtype", "custom/screenrecording-indicator"], - "modules-right": [ - "group/tray-expander", - "bluetooth", + "modules-right": [ + "group/tray-expander", + "bluetooth", @@ -140,6 +140,19 @@ - "signal": 8, - "return-type": "json" - }, + "signal": 8, + "return-type": "json" + }, + "custom/voxtype": { + "exec": "omarchy-voxtype-status", + "return-type": "json", @@ -52,9 +57,21 @@ patch -N ~/.config/waybar/config.jsonc << 'EOF' + "on-click-right": "omarchy-voxtype-config", + "on-click": "omarchy-voxtype-model" + }, - "tray": { - "icon-size": 12, - "spacing": 17 + "tray": { + "icon-size": 12, + "spacing": 17 EOF +then + failed=1 +fi -omarchy-restart-waybar +if [ $failed -eq 1 ]; then + echo -e "\033[31mUnable to update Waybar config automatically.\033[0m" + echo + + if gum confirm "Reset waybar config to default to get Voxtype dictation integration?"; then + omarchy-refresh-waybar + fi +else + omarchy-restart-waybar +fi