You are not logged in.
just want to make sure i'm following best practices, and wondered why one might be preferred over the other. i have my machine set up so that it just boots to the terminal for login without a display manager. i tried to append exec startxfce4 to the end of ~/.xinitrc but it didn't work - i would just get kicked back to login.
my current solution was to edit ~/.bash_profile:
[[ -f ~/.bashrc ]] && . ~/.bashrc
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
exec startxfce4
fimeanwhile the end of ~/.xinitrc is unchanged and looks like:
# start some nice programs
if [ -d "$xinitdir"/xinitrc.d ] ; then
for f in "$xinitdir/xinitrc.d"/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
"$twm" &
"$xclock" -geometry 50x50-1+1 &
"$xterm" -geometry 80x50+494+51 &
"$xterm" -geometry 80x20+494-0 &
exec "$xterm" -geometry 80x66+0+0 -name loginso again, is one solution preferred/more stable than the other? i have a feeling xinitrc didn't work because i didn't add an ampersand at the end of the line before the exec startxfce4 instruction, but i also wasn't sure if that was the right spot for it in the file to begin with... and my current solution works, but again, just wanted to make sure i'm following best practices.
thanks!
Last edited by magnet helper (2025-05-26 22:01:35)
Offline
Nothing after 'exec "$xterm" -geometry 80x66+0+0 -name login' will ever be reached in that xinitrc, if you appended exec startxfce4 to it but left the other lines uncommented and don't have xterm installed, xinitwill fail to replace itself with xterm and that's all of it.
Please post the actual xinitrc you tried.
As for preferences: startxfce4 will implicitly start X11 on need, but that's specific and the generic approach is to xinit/startx and put whatever you want to run with X11 into your xinitrc.
Offline
well, it sounds like it never would have been reached, then. what i tried was what i posted, the only change being a line break followed by exec startxfce4 at the very end. essentially all i am interested in is starting xfce4 on login without having to type startxfce4 every time; i don't plan on using a different desktop environment anytime soon. and yes, startx kicks out with the end of the message saying, "twm command not found".
should my approach be to start X11 and then tell it to start xfce, or for my purposes is the edited ~/.bash_profile sufficient? could it be simplified further to just feed the command "startxfce4" on login?
thanks!
Last edited by magnet helper (2025-05-25 23:39:19)
Offline
Try this:
[[ -f ~/.bashrc ]] && . ~/.bashrc
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
exec startxfce4
fiI mean, try "-eq" instead of "="
Offline
[ "foo" = "foo" ] && echo bar
[ "foo" = "bar" ] && echo snafuThe "=" is fine, the OP is inquiring preferable approaches, not a failure of the present one.
@magnet helper, it really doesn't matter, but if you wanted to do more stuff ahead of the session start (trigger a session lock, per user keyboard layout etc et pp) using xinitrc is more versatile (because these things require a running X11 server and cannot be done from the bash profile)
If you want to use and still struggle with the xinitrc, post it.
Otherwise and please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline