How to prevent xscreensaver from starting in Lubuntu (or more precisely, how to kill it right away)

LXSession has system-wide configuration in /usr/share/lxsession/<Profile name>/ and optional per-user configuration in ~/.config/lxsession/<Profile Name>/. Unfortunately for autostart, according to documentation, “If both files are present, all the entries in both files will be executed.” This means there’s no clean way to prevent autostarting applications defined system-wide from starting per-user; you have to change the system-wide configuration or resort to hacks.

Here’s one example.

jani@kingugidora:~$ mkdir -p ~/.config/lxsession/Lubuntu
jani@kingugidora:~$ mkdir -p ~/bin
jani@kingugidora:~$ cat > ~/bin/kill-xscreensaver
#!/bin/sh
killall xscreensaver
jani@kingugidora:~$ cat > ~/.config/lxsession/Lubuntu/autostart
@/home/jani/bin/kill-xscreensaver

For now the order seems to work, in that the user-defined autostart lines are ran after system-wide ones.