LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Fast User Switching or Multiple X login screens - How? (https://www.linuxquestions.org/questions/slackware-14/fast-user-switching-or-multiple-x-login-screens-how-212883/)

suslik 08-03-2004 07:51 AM

Fast User Switching or Multiple X login screens - How?
 
I was trying to achieve Windows XP style "Fast User Switching" using multiple Xwindows screens, similar to what Xandros does.

I am satisfied with what I achieved (bellow), but would like to perfect it further (further bellow).

Rules:
1. I run strictly GUI, no tty logins followed by startx -- :1 would satisfy.
2. My preferred stream is KDM > KDE.

What I achieved:
As suggested on this excellent site I put the following 2 lines into my /opt/kde/share/conf/kdm/Xservers file
Code:

:0 local /usr/bin/X11/X :0 vt7
:1 local /usr/bin/X11/X :1 vt8

Now 2 KDMs start, one on vt7 (CTRL+ALT+F7), the other on vt8 (CTRL+ALT+F8). This way i can work as normal user on default vt7, and have my wife or me with root log in on vt8 without logging out off on vt7.

The "HOW DO I...?" portion
1. Xandros somehow allows switching vt's using a menu or a button or something... Any one knows where to get it? I skimmed Freshmeat and Sourceforge without luck.

2. This present set up is wasteful and unflexible.
a. It runs an extra KDM which is good to have, but unneeded most of the time.
b. only allows for 2 logins. More logins require hand tweaking and more mostly unused KDM.

I imagine a system where KDM starts on vt4 for example, and instead of exiting and replacing itself with KDE session I would prefer it to stay on vt4 and open a new X session on vt5. If I want more users, I would CTRL+ALT+F4 and log in one more user, who would go to next available vt. This way I would get, no wasteful KDMs sitting for no reason, and numerous log in flexibility. Any ideas on how to approach this?

320mb 08-03-2004 08:52 AM

Quote:

My current system:
RedHat 6.1
XFree86 3.3.5-3

gdm 2.0beta2-13
that is an old help file...........as you can see this just another
Idea that started in UNIX/Linux first and was stolen by M$
and used in XP==but I digress..........
You'll just have to experiment with your system until you get it
working to how you like it, Linux is a true multi-user platform and
the ability to start different Xsessions shows the true power of Linux.....

you can just open a konsole window and type

startx -- :2
startx -- :3
etc........and start new Xsession when you need them.......
take out the extra line in that conf/kdm/Xservers file

<edit/> you can make a shell script, with a desktop conf file pointing to it----
if you want to start new sessions........then you would just click on the desktop icon and wa la.......

320mb 08-03-2004 09:06 AM

your shell script would look like this...........
Code:

#!/bin/bash

startx -- :4

put it in /usr/local/?? so normal users have access to it.........
and right click on desktop and select new link to application
right click on the new icon and click the execute tab and point it
to the shell script..........

theYinYeti 08-03-2004 09:19 AM

Switching to a given vt is done with the swithto command, in the open package (at least in Mandrake).
I agree with you about the limitations of running exactly 2 kdm. You could make a script whose job would be to sudo(NOPASSWD) start a new kdm on a dynamically found display number. Here's some bash:
Code:

function nextAvailableDisplay() {
  disp=0
  while [ -e "/tmp/.X${disp}-lock" ]; do disp=$(( $disp + 1 )); done
  echo $disp
}

You'll have to check how the lock files are named. If I remember correctly, they are in /tmp, and named .X0-lock, .X1-lock...

Yves.

suslik 08-03-2004 12:00 PM

Quote:

Originally posted by 320mb
your shell script would look like this...........
Code:

#!/bin/bash

startx -- :4

put it in /usr/local/?? so normal users have access to it.........
and right click on desktop and select new link to application
right click on the new icon and click the execute tab and point it
to the shell script..........

There is one tincy problem with this way... I don't get a log in screen. What I get this way is another screen for a user who is already logged in. In my case, I need a log in prompt on. Thx for suggestion anyway.


theYinYeti, checking for lock files is a great idea. I was wandering how I can check which vt is taken.

What the show stopper is - if any of the *dm managers allow to redirect the log in to a different screen. I am not sure what is ran by *dm on successful log in. I am going to go over kdm and gdm docs to see if I can keep them around after log on, see if -daemon makes any diff.

on switchto: Endless thx on switchto suggestion.

switchto will change the current VT to the vt specified. Useful to
change VTs when the hotkey sequence is unavailable for some reason, or
from within scripts.

Exactly what I was looking for. In fact, while poking around for it, I found some more scripts for detecting running vt's on a ... Quake howto. :)

theYinYeti 08-04-2004 04:22 AM

Thanks a LOT for the tip from quake! I've always wanted a tool to tell me how many vc were oppened :D

Yves.

arete 08-30-2004 01:30 PM

possible partial solution for Fast User Switching
 
I haven't tried this yet, so bear with me.

1) You have enough information to create a script which generates a new X session regardless of how many currently exist.

2) You expect to have to switch vts to get to the login prompt.




My suggestion is to set up a script that runs whenever someone logs in - that script generates a new X session which has a new vt and which will have it's own login window. That way you'll always have a login screen, no matter how many people log in.


For bonus points, you create a mechanism that knows whether a vt is still logged in (the simplest would be to add your own lock file somewhere on login and remove it on logout) Then you can only generate a new X session if you don't already have at least one other free one.

Similarly, if you're keeping track like that you could create a shortcut script that would go to the vt that is a gui but isn't locked.

Hope that helps -

Arete

suslik 08-30-2004 03:27 PM

It turns out this functionality is built into KDE since 3.1.x

You have to put in (uncomment) the following in /opt/kde/share/config/kdm/Xservers

:0 local@tty1 /usr/X11R6/bin/X -nolisten tcp
:1 local@tty2 reserve /usr/X11R6/bin/X -nolisten tcp :1

You get a "Start New Session" in Start menu.

There are some issues with conflicting sound, but otherwise works great.

the who 08-30-2004 05:08 PM

According to the KDE 3.4 feature list, fast-user switching is planned for 3.4.

suslik 08-31-2004 12:23 AM

Quote:

Originally posted by the who
According to the KDE 3.4 feature list, fast-user switching is planned for 3.4.
Well, I've been using this "planned" feature in 3.2.3 and 3.3. :) Twilight Zone!

They should probably replace "planned" with "further enhance" cause I'm still looking for a gui way to switch between open consoles. Too lazy to press CTRL+ALT+F# :)

the who 08-31-2004 07:50 AM

Quote:

Originally posted by suslik
They should probably replace "planned" with "further enhance"
Yeah, probably.

The exact wording is "Proper session-on-demand implementation including fast user switching."


All times are GMT -5. The time now is 09:07 PM.