Only 28 lines to start an X Session from TTY
sx is a replacement for startx
and xinit
which iβm currently using to start XFCE.
sx
is a tiny fraction of the size of startx
and xinit
showing what cutting a few features and edge cases can do for making code easy to read and hack on.
Compare https://github.com/Earnestly/sx -to- https://github.com/freedesktop/xorg-xinit
Installation:
# Set up the init script for sx
mkdir -p ~/.config/sx/
touch ~/.config/sx/sxrc
# sx requires this be executable
chmod 700 ~/.config/sx/sxrc
vim ~/.config/sx/sxrc
# Paste what would normally be in your ~/.xinitrc file
# For example, I need my dunst notifier started along with
# startxfce4 so my ~/.config/sx/sxrc looks like this:
dunst &
startxfce4
# Download script and install to /usr/local/bin/
sudo sh -c "wget -q -O - https://raw.githubusercontent.com/Earnestly/sx/master/sx > /usr/local/bin/sx"
# Confirm against original
cat /usr/local/bin/sx
sudo chmod 755 /usr/local/bin/sx
# sx is now ready! Enter a TTY and launch an X Session using:
sx
Note: I boot to a TTY but If youβre using a Desktop Manager like LightDM youβll need to configure it to use sx
. Alternatively you can switch to a TTY and start an additional X Session using sx
as it uses the TTY youβre in not TTY7.