Files
infra/scripts/cleanup-sway.sh
Fabio Scotto di Santolo d535c9ffd2 sway: screenshots, polkit floating, flatpak dark theme
Screenshots
- Swap xfce4-screenshooter for flameshot + grim/slurp/jq; xfce4 used
  the X11 selection so clipboard didn't round-trip to Wayland clients.
  Print invokes flameshot's editor; Shift/Alt+Print are quick
  grim-based captures via a small wrapper script. Flameshot is now
  autostarted so the first capture isn't slow.

Polkit
- Add for_window rules so the xfce-polkit dialog (and any other polkit
  agent) always opens floating.

Flatpak dark theme
- Write /etc/flatpak/overrides/global with GTK_THEME=Yaru-Blue-dark for
  legacy GTK apps, plus a sway-portals.conf so the Settings portal is
  served by xdg-desktop-portal-gtk (wlr doesn't implement it). That
  lets libadwaita apps see color-scheme=prefer-dark.

cleanup-sway: track the new package set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:26:45 +02:00

102 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env sh
# Remove sway session artifacts: exclusive packages, dotfiles, runtime state
# and the emptty wayland-sessions entry. Shared resources with i3 (dunst,
# rofi, alacritty, xfce4-screenshooter) are left untouched.
set -eu
SWAY_PACKAGES="
cliphist
flameshot
grim
jq
kanshi
slurp
swayfx
swaybg
swayidle
swaylock
SwayOSD
Waybar
wl-clipboard
xdg-desktop-portal-wlr
xorg-server-xwayland
"
SWAY_DOTFILES="
$HOME/.config/sway
$HOME/.config/waybar
$HOME/.cache/cliphist
"
SWAY_SYSTEM_FILES="
/etc/emptty/wayland-sessions/sway.desktop
/usr/local/bin/start-sway
"
confirm() {
printf '%s [y/N] ' "$1"
read -r answer
case "$answer" in
y|Y|yes|YES) return 0 ;;
*) return 1 ;;
esac
}
filter_installed() {
for p in $1; do
if xbps-query -p pkgver "$p" >/dev/null 2>&1; then
printf '%s\n' "$p"
fi
done
}
if ! command -v xbps-remove >/dev/null 2>&1; then
printf 'Error: xbps-remove not found (not a Void host?)\n' >&2
exit 1
fi
installed=$(filter_installed "$SWAY_PACKAGES" | tr '\n' ' ' | sed 's/ *$//')
printf '== sway cleanup ==\n\n'
printf 'Packages to remove (installed only):\n'
if [ -n "$installed" ]; then
printf ' %s\n' $installed
else
printf ' (none)\n'
fi
printf '\nDotfiles / state to remove:\n'
for d in $SWAY_DOTFILES; do
if [ -e "$d" ] || [ -L "$d" ]; then
printf ' %s\n' "$d"
fi
done
printf '\nSystem files to remove:\n'
for f in $SWAY_SYSTEM_FILES; do
if [ -e "$f" ] || [ -L "$f" ]; then
printf ' %s\n' "$f"
fi
done
printf '\nShared (NOT removed): dunst, rofi, alacritty, xfce4-screenshooter and their configs.\n\n'
confirm 'Proceed?' || { printf 'Aborted.\n'; exit 0; }
if [ -n "$installed" ]; then
# shellcheck disable=SC2086
sudo xbps-remove -Ry $installed
fi
for d in $SWAY_DOTFILES; do
if [ -e "$d" ] || [ -L "$d" ]; then
rm -rf -- "$d"
fi
done
for f in $SWAY_SYSTEM_FILES; do
if [ -e "$f" ] || [ -L "$f" ]; then
sudo rm -f -- "$f"
fi
done
printf '\nDone.\n'