Unix users have long swapped out window managers at the drop of a hat, and the only hard part is figuring out how that's enabled in a given flavor of Linux. Here's how for Ubuntu 22.04. Apologies in advance if this isn't 100% correct, since I apparently cheated and used my ~/.xsessionrc for everything and can't test changing it at the moment (because bash mmap your scripts while it works through them, so if you edit them you affect any running shell reading that script). But this should get you 95% of the way there.
/etc/X11/Xsession uses some files in your$HOME , which gives you control with these:
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors
- Your
~/.xsessionrc is read into the shell setting up your X session by (in Ubuntu 22.04) /etc/X11/Xsession.d/40x11-common_xsessionrc
- This is probably intended to let you set any environment variables you want for your X session
- You could just run whatever you wanted here (like I have, oops), but instead use the part below
- The
/etc/X11/Xsession.d/50x11-common_determine-startup will run, observe that (presumably) $STARTUP is empty, and check to see if your system allows user control of X sessions, so:
- Enable
allow-user-xsession in /etc/X11/Xsession.options so that it will run...
- Your
~/.xsession file should be an executable script (or program) to do the real work
- Your
~/.xsession file should
- start up pulseaudio (if it isn't already available)
- play any cute startup sound you like
- set your background
- set up xcmsdb if you're into that
- set up any font stuff, if you care
- configure you bell and autorepeat details with xset
- modify your keymap with xmodmap
- run the ssh-agent if it's absent, minimally: eval `ssh-agent -s`
- start any default programs you want
- start your window manager
- normally the last thing you run is the window manager or xterm, and killing it will move to the next step
- have some shell code at the end to kill off any of the above you saved process IDs from
- If you want to share code with running
xinit directly, which is great for testing, just stuff all the startup scriptage into ~/.xinitrc and call it from ~/.xsession or just make one a symlink to the other if you're comfortable with symbolic links
|