nocoder/uninstall.sh
Gavin Nugent 7d66dcac87 install/uninstall: write windowrules to hyprland.conf
Walker would launch NO-CODER fullscreen instead of floating because the
windowrules block was written to ~/.config/hypr/windows.conf — a file
Hyprland never sources. Omarchy's hyprland.conf only sources the *system*
windows.conf under ~/.local/share/omarchy/default/hypr/, so any rules in a
user-level windows.conf were silently ignored.

Point HYPR_CONF at ~/.config/hypr/hyprland.conf instead. The marker-block
append/strip logic stays the same and remains idempotent across re-runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 13:52:55 +01:00

61 lines
2.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# uninstall.sh — reverse what install.sh did.
# Leaves pacman packages alone (they may be needed by other apps).
set -euo pipefail
APP_ID="dev.nocoder.NoCoder"
LAUNCHER_NAME="nocoder"
BIN_DIR="$HOME/.local/bin"
DESKTOP_DIR="$HOME/.local/share/applications"
HICOLOR_DIR="$HOME/.local/share/icons/hicolor"
INSTALL_DIR="$HOME/.local/share/nocoder"
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nocoder"
HYPR_CONF="$HOME/.config/hypr/hyprland.conf"
MARK_BEGIN="# >>> nocoder windowrules begin"
MARK_END="# <<< nocoder windowrules end"
GREEN=$'\e[32m'; DIM=$'\e[2m'; RESET=$'\e[0m'
say() { printf '%s==>%s %s\n' "$GREEN" "$RESET" "$*"; }
say "Removing installed app tree, launcher, desktop entry, icons, config"
rm -rf "$INSTALL_DIR"
rm -rf "$CONFIG_DIR"
rm -f "$BIN_DIR/$LAUNCHER_NAME"
rm -f "$DESKTOP_DIR/$APP_ID.desktop"
# Old SVG location (pre-2026-04-21 rebrand) and current multi-size PNGs.
rm -f "$HICOLOR_DIR/scalable/apps/$APP_ID.svg"
for sz in 48 64 96 128 256 512; do
rm -f "$HICOLOR_DIR/${sz}x${sz}/apps/$APP_ID.png"
done
command -v update-desktop-database >/dev/null 2>&1 && \
update-desktop-database -q "$DESKTOP_DIR" || true
command -v gtk-update-icon-cache >/dev/null 2>&1 && \
gtk-update-icon-cache -q -t "$HICOLOR_DIR" || true
if [[ -f "$HYPR_CONF" ]]; then
# Only strip if both markers are present (closed block). An unclosed BEGIN
# would otherwise make awk eat everything to EOF, including user edits.
if grep -qxF "$MARK_BEGIN" "$HYPR_CONF" && ! grep -qxF "$MARK_END" "$HYPR_CONF"; then
echo "!! unclosed '$MARK_BEGIN' block in $HYPR_CONF — not touching it."
elif grep -qxF "$MARK_BEGIN" "$HYPR_CONF"; then
say "Stripping Hyprland windowrules block"
tmp="$(mktemp)"
awk -v b="$MARK_BEGIN" -v e="$MARK_END" '
$0 == b { skip = 1; next }
skip && $0 == e { skip = 0; next }
!skip { print }
' "$HYPR_CONF" > "$tmp"
mv "$tmp" "$HYPR_CONF"
fi
if command -v hyprctl >/dev/null 2>&1 && [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
hyprctl reload >/dev/null
fi
fi
echo "${DIM}Pacman packages left in place. Remove manually if desired.${RESET}"
echo "Done."