#!/bin/sh

sed -i 's|Exec=.*|Exec=/usr/bin/startkde-biglinux wayland|g' /usr/share/wayland-sessions/plasma.desktop 2> /dev/null
sed -i 's|TryExec=.*|TryExec=/usr/bin/startkde-biglinux|g' /usr/share/wayland-sessions/plasma.desktop 2> /dev/null
sed -i 's|Exec=.*|Exec=/usr/bin/startkde-biglinux|g' /usr/share/xsessions/plasmax11.desktop 2> /dev/null
sed -i 's|TryExec=.*|TryExec=/usr/bin/startkde-biglinux|g' /usr/share/xsessions/plasmax11.desktop 2> /dev/null
# Restore the systemd defaults we used to relax here.
#
# The old values (DefaultRestartSec=1000ms, DefaultStartLimitBurst=10) were meant to
# avoid a race with session startup scripts, but they disabled the restart rate limit
# for every user service on the system: 10 restarts at 1s apiece span ~12.5s, which
# never fits the 10s window, so a service that keeps failing restarts forever instead
# of being stopped. That is what turned the JamesDSP autostart conflict into a loop
# of tens of thousands of restarts.
sed -i 's|^DefaultRestartSec=1000ms|#DefaultRestartSec=100ms|;s|^DefaultStartLimitBurst=10|#DefaultStartLimitBurst=5|' /etc/systemd/user.conf 2> /dev/null
