fix: kanshi-Profile mergen + Hotplug-Watcher mit OSD

This commit is contained in:
humocs-man committed 2026-10-07 19:20:04 +02:00
1 parent 76c914db54
commit 84b037ec73
5 files changed
+238 -4

No files matched your search

+18
View File
@@ -46,6 +46,24 @@ if [[ -f "${AUTOSTART}" ]] && grep -q 'swayidle' "${AUTOSTART}"; then
echo "migriert: swayidle-Block aus ${AUTOSTART} entfernt (Backup .bak)"
fi
# Migration: kanshi-Watcher statt blossem `kanshi &` (Hotplug mitten in
# der Session + OSD bei Profilwechsel). Greift nur, wenn noch kein
# --watch laeuft und eine blosse kanshi-Zeile existiert. Mit Backup.
if [[ -f "${AUTOSTART}" ]] && ! grep -q 'kanshi-autoconfig --watch' "${AUTOSTART}" \
&& grep -Eq '^[[:space:]]*kanshi([[:space:]]|$)' "${AUTOSTART}"; then
cp -n "${AUTOSTART}" "${AUTOSTART}.bak" 2>/dev/null || true
read -r -d '' KANSHI_BLOCK <<'EOF' || true
# Watcher-Daemon: erkennt Docking mitten in der Session (Hotplug),
# schreibt bei neuem Output-Set neu (Merge: fremde Profile bleiben),
# startet kanshi bei Bedarf (neu) und meldet Profilwechsel per OSD
# (notify-send). Ersetzt das blosse `kanshi &` von frueher.
kanshi-autoconfig --watch >/dev/null 2>&1 &
EOF
awk -v block="${KANSHI_BLOCK}" '{ if (!done && $0 ~ /^[[:space:]]*kanshi([[:space:]]|$)/) { print block; done=1; next } print }' "${AUTOSTART}" > "${AUTOSTART}.new" \
&& mv "${AUTOSTART}.new" "${AUTOSTART}"
echo "migriert: kanshi-Watcher in ${AUTOSTART} (Backup .bak)"
fi
# Migration: Session-Integration (graphical-session.target + Portal-Units).
# Bestandnutzer haben eine Autostart ohne den Block (skel greift nur bei
# Neuanlage). Der Block wird aus /etc/skel gelesen, damit er nur an einer