You are not logged in.

#1 2012-06-27 17:54:29

Herover
Member
Registered: 2012-06-27
Posts: 4

[SOLVED]Run startx after login?

I have a laptop with multiple users.
Is it possible to have a different setup for each user, stored in their /home/ folder? So, when I log in, all I see is the terminal, but when another user, say a guest user, logs in, LXDE starts up.

Right now, I put this in my .xinitrc file (startlxde in guest, xmonad in my own), but is it possible to set start different programs for different users after login? I would prefer start x on my own from my own user, but my brother who frequently use my laptop don't want to type startx each time he logs in.

Last edited by Herover (2012-06-27 18:41:33)

Offline

#2 2012-06-27 17:58:35

Psykorgasm
Member
Registered: 2011-11-24
Posts: 178

Re: [SOLVED]Run startx after login?

Assuming you set up the right .xinitrc in each users ~/ this (from the wiki) will startx automatically for each user you decide to bless with the additions to their .bash_profile

.bash_profile wrote:
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
startx
fi

Edit: Here is the article.

Last edited by Psykorgasm (2012-06-27 18:00:35)

Offline

#3 2012-06-27 17:59:07

Pres
Member
Registered: 2011-09-12
Posts: 423

Re: [SOLVED]Run startx after login?

https://wiki.archlinux.org/index.php/Start_X_at_boot

The first section "bash_profile" is most likely what you are looking for.

Offline

#4 2012-06-27 18:16:04

Herover
Member
Registered: 2012-06-27
Posts: 4

Re: [SOLVED]Run startx after login?

Thank you, that was exactly what I needed smile

As a addition, I added exit to my script after startx, so it logs completely out.

But it seems like it only works from tty1?

Offline

#5 2012-06-27 18:21:05

Pres
Member
Registered: 2011-09-12
Posts: 423

Re: [SOLVED]Run startx after login?

That's the way the script is designed. If you want different functionality, then just alter it. Specifically this part:

[[ $(tty) = /dev/tty1 ]]

Offline

#6 2012-06-27 18:26:29

Herover
Member
Registered: 2012-06-27
Posts: 4

Re: [SOLVED]Run startx after login?

I hope it isn't a bad thing to make tty1 to tty*

Thank you both of you.

Offline

#7 2012-06-27 18:31:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED]Run startx after login?

If you do that, you may as well just remove that part of the conditional all together, so it would look like

if [[ -z $DISPLAY ]]; then

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2012-06-27 18:35:26

Psykorgasm
Member
Registered: 2011-11-24
Posts: 178

Re: [SOLVED]Run startx after login?

^^ That's the best thing to do, assuming your brother wont want to login to a tty hassle free at some point to do something, which I'm guessing he wont big_smile

Also, don't forget to [SOLVED] if you're happy its's sorted!

Offline

#9 2012-06-27 18:43:53

Herover
Member
Registered: 2012-06-27
Posts: 4

Re: [SOLVED]Run startx after login?

Cool, just wanted to make sure I won't have problems logging in using ssh, but I guess the $DISPLAY part takes care of that. Thanks again smile

Offline

Board footer

Powered by FluxBB