Patch is too brittle

This commit is contained in:
David Heinemeier Hansson
2026-01-06 13:20:34 +01:00
parent ebc8a9ef62
commit 41c6048758

View File

@@ -1,77 +1,28 @@
echo "Add voxtype to waybar" echo "Add Voxtype to Waybar"
failed=0 STYLE_FILE=~/.config/waybar/style.css
CONFIG_FILE=~/.config/waybar/config.jsonc
if ! patch -N ~/.config/waybar/style.css << 'EOF' # Add voxtype CSS if not present
--- a/waybar/style.css if ! grep -q "#custom-voxtype" "$STYLE_FILE" 2>/dev/null; then
+++ b/waybar/style.css sed -i 's/margin-left: 8\.75px;/margin-left: 5px;/' "$STYLE_FILE"
@@ -74,10 +74,16 @@ tooltip { sed -i '/#custom-screenrecording-indicator {/,/}/ s/font-size: 10px;/font-size: 10px;\n padding-bottom: 1px;/' "$STYLE_FILE"
cat >> "$STYLE_FILE" << 'EOF'
#custom-screenrecording-indicator { #custom-voxtype {
min-width: 12px; min-width: 12px;
- margin-left: 8.75px; margin: 0 0 0 7.5px;
+ margin-left: 5px; }
font-size: 10px;
+ padding-bottom: 1px;
}
#custom-screenrecording-indicator.active {
color: #a55555;
}
+
+#custom-voxtype {
+ min-width: 12px;
+ margin: 0 0 0 7.5px;
+}
EOF EOF
then
failed=1
fi fi
if ! patch -N ~/.config/waybar/config.jsonc << 'EOF' # Add voxtype to modules-center if not present
--- a/waybar/config.jsonc if ! grep -q "custom/voxtype" "$CONFIG_FILE" 2>/dev/null; then
+++ b/waybar/config.jsonc # Add to modules-center array
@@ -5,7 +5,7 @@ sed -i 's/"custom\/screenrecording-indicator"/"custom\/voxtype", "custom\/screenrecording-indicator"/' "$CONFIG_FILE"
"spacing": 0,
"height": 26, # Add voxtype config block before tray config
"modules-left": ["custom/omarchy", "hyprland/workspaces"], sed -i '/"tray": {/i\ "custom/voxtype": {\n "exec": "omarchy-voxtype-status",\n "return-type": "json",\n "format": "{icon}",\n "format-icons": {\n "idle": "",\n "recording": "󰍬",\n "transcribing": "󰔟"\n },\n "tooltip": true,\n "on-click-right": "omarchy-voxtype-config",\n "on-click": "omarchy-voxtype-model"\n },' "$CONFIG_FILE"
- "modules-center": ["clock", "custom/update", "custom/screenrecording-indicator"],
+ "modules-center": ["clock", "custom/update", "custom/voxtype", "custom/screenrecording-indicator"],
"modules-right": [
"group/tray-expander",
"bluetooth",
@@ -140,6 +140,19 @@
"signal": 8,
"return-type": "json"
},
+ "custom/voxtype": {
+ "exec": "omarchy-voxtype-status",
+ "return-type": "json",
+ "format": "{icon}",
+ "format-icons": {
+ "idle": "",
+ "recording": "󰍬",
+ "transcribing": "󰔟"
+ },
+ "tooltip": true,
+ "on-click-right": "omarchy-voxtype-config",
+ "on-click": "omarchy-voxtype-model"
+ },
"tray": {
"icon-size": 12,
"spacing": 17
EOF
then
failed=1
fi fi
if [ $failed -eq 1 ]; then omarchy-restart-waybar
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