This tutorial will help you to start WMFS with startx, and automatilly run some programs at start.
feh --bg-scale /path/to/my/background # or : nitrogen --restore pcmanfm --desktop # and some other command # ck-launch-session : Start ConsoleKit, will make you able to mount drives without being root # in your file manager (pcmanfm, nautilus, thunar, ...), or halt/reboot your computer without # being root. # dbus-launch : Is used by some desktop applications, maybe useful. exec ck-launch-session dbus-launch wmfs # If you don't need/want that, just use : # exec wmfs
Here, we will start WMFS before applications ! Because some applications need WMFS to be started (for example : your status program/script).
Here is the content of your
$HOME/.xinitrc now :
exec ck-launch-session dbus-launch wmfs & wmpid=$! # Here, we save the PID of wmfs feh --bg-scale /path/to/your/wallpaper pcmanfm --desktop $HOME/.local/bin/status.sh wait $wmpid # Here we are waiting the end of WMFS, when the user will do : wmfs -c quit :(
Here, we will do the following :
startwmwhich will read that configuration and run it.
$HOME/.xinitrc will look like this :
exec ck-launch-session dbus-launch $HOME/.local/bin/startwm # NB: Put your script where you want, just set the absolute path here
$HOME/.config/xorg/session.wm will look like this :
NB: To change your window manager, you will have to change only that file :)
$HOME/.config/xorg/session.env will look like this :
pcmanfm --desktop /home/linkdd/.local/bin/status.sh
NB: This file isn't a script ! Each line describe ONE command
Now, we have to write our script
LOG="$HOME/.config/xorg/session.log" # Check which WM we have to run : WINDOWMANAGER="`cat $HOME/.config/xorg/session.wm`" # Run WM in background and get its PID. # Redirect the standard output to the log file # Redirect the error output to the standard output (so to the log file) $WINDOWMANAGER >> $LOG 2>&1 & wmpid=$! cat $HOME/.config/xorg/session.env | while read cmd do # Run each commands in background $cmd >> $LOG 2>&1 & done # Wait the end of our WM wait $wmpid
At the start of your shell, your profile file is executed, with bash it's
$HOME/.bash_profile, with zsh it's `
Add this into your profile file :
# If the variable DISPLAY is empty (so we're not in a X) # And the return of 'tty' is '/dev/tty1' (first tty, CTRL+ALT+F1) if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]] then # Run startx in background ssh-agent startx > $HOME/.config/xorg/session.log 2>&1 & # And lock the terminal vlock # vlock is the same as slock (or other), but for a terminal # You may need to install it # On debian : apt-get install vlock fi