Interact with this post using Mastodon or
Specific WM for a given TTY
Published on
Today’s tweak is about auto launching a given windows manager (WM) based on the TTY you’re login from.
You may have good reasons to use different windows managers on your machine or you just like to switch from one to the other depending on your mood. Whatever your reason is, you may sometimes run both at the same time and in such situations it can be boring to have to tell your machine which WM you want to use, and it can even be more frustrating when you forget to do it and launch the same WM twice in different sessions. To help with that, you can simply link a WM to a TTY. This will allow you to have a defined WM automatically launched when you login from a specific TTY.
Let’s see how that work in the real world.
Try to add this code to your .zprofile
:
if [[ -z $DISPLAY && $XDG_VTNR -eq 4 ]]; then
exec dwl -s 'sh ~/.dwl_startup.sh'
else
exec startx
fi
Also, add this add the end of your .xinitrc
:
if [ "${XDG_VTNR}" -eq 1 ]; then
exec bspwm
elif [ "${XDG_VTNR}" -eq 2 ]; then
while :; do
ssh-agent dwm
done
exec dwm
elif [ "${XDG_VTNR}" -eq 3 ]; then
exec i3
fi
fi
In this specific example (to be adjusted to your needs):
.zprofile
will launch thedwl
wayland WM if you login from a TTY less than 4 and launchstartx
otherwise- if
startx
is called, then.xinitrc
will be read and:
bspwm
will be launched if you login from TTY1dwm
will be launched if you login from TTY2i3
will be launched if you login from TTY3.
Thanks for your read. Hope it's been useful to you.
✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈
More food for thoughts? Check other posts about: #System