Solved Two window managers, each with own user sessions, on same computer

How can I have two window managers on the same computer, with different login accounts, which I could switch between using a Ctrl-Alt F# key? Would I have to have 2 X sessions, and would it necessarily use a lot of CPU/GPU resources? Does it largely depend on window manager over the server?

The purpose would be, bc I want to use a full screen window manager for an X terminal emulators on one virtual terminal with its own user. Then, I want to switch to my traditional window manager. For instance, to play background music with a music user, and use hotkeys with the visual volume control. Then, switch to my regular desktop. Flipping volume without hotkeys, or having to switch to my desktop to change volume is inconvenient. I play music, but I lack the hotkeys and the less necessary visual show of volume. I intend to use x11-wm/fswm for the replacement of the virtual terminal console.
 
I don't know much about Xnest, but is it used in that way?
I've only used it for a little testing.
Code:
Xnest :1 -geometry 1024x768+0+0&
env DISPLAY=:1 twm &
env DISPLAY=:1 xterm &
env DISPLAY=:1 xsetroot -solid \#3A6EA5&
 
I do it every time I want to play steam, from my main desktop (which is sway, but any other compositor/desktop environment will do), I switch back to ttyv0, then to ttyv2 login into my steam account, run another desktop (sway in my case).
 
why cannot you run your usual GUIs in your tilling wm? i use i3 and do everything inside it, there are a bunch of option for display: vertical/horizontal tiles, floating; tabs... it's a bit of keyboard shortcuts to remember (or a post-it ;)) for music i ca recommand musikcube or kew or ncmpcpp with mpd to get very functional players as TUIs.
or you can run a full screen tmux and do the tilling inside...
or am i missing something in your requirments?
 
Xorg nesting is not necessary, the xorg-server is capable of running multiple xorg sessions all at once out of the box, no extra configuration is required (I do it often). One can also run xorg and wayland simultaneously, provided, for wayland, a drm-kmod driver is loaded.

As I can tell, this is video driver independent, not sure about x11/nvidia-driver, though. Multiple xorg sessions are possible even with x11-drivers/xf86-video-scfb alone.

Every xorg session can run with different users, different WMs, or same user and same WM, but different configurations [1] (see icewm).

FreeBSD can have 12 virtual consoles by default with vt(4) (ttyv0 - ttyv8 pre-configured in /etc/ttys, ttyv8 reserved for xorg. The number of virtual consoles can be extended with 3 more: ttyv9 (F10),ttyva (F11) and ttyvb (F12)).

You can run a separate Xorg session in each of the 11 virtual consoles (just tested), top(1) does not show increased Xorg activity from multiple WM sessions. Just log in as a user, start the xorg session as usual. I don't know about DEs.


[1]
Code:
%  grep startx .zshrc
alias    xawesome="env XINITRC=$HOME/.xinitrc.d/awesome.xinitrc startx"
alias    xdwm="env XINITRC=$HOME/.xinitrc.d/dwm.xinitrc startx"
alias    xfluxbox="env XINITRC=$HOME/.xinitrc.d/fluxbox.xinitrc startx"
alias    xherbst="env XINITRC=$HOME/.xinitrc.d/herbstluftwm.xinitrc startx"
alias    xi3="env XINITRC=$HOME/.xinitrc.d/i3.xinitrc startx"
alias    xicewm="env XINITRC=$HOME/.xinitrc.d/icewm.xinitrc startx"
alias    xicewm2="env XINITRC=$HOME/.xinitrc.d/icewm2.xinitrc startx"
alias    xjwm="env XINITRC=$HOME/.xinitrc.d/jwm.xinitrc startx"
alias    xopenbox="env XINITRC=$HOME/.xinitrc.d/openbox.xinitrc startx"
alias    xsawfish="env XINITRC=$HOME/.xinitrc.d/sawfish.xinitrc startx"
 
The Xorg server takes argument to tell it which $DISPLAY number to use and which tty to use. That is how you make a separate session.
 
I use i3 and do everything inside it, there are a bunch of option for display: vertical/horizontal tiles, floating; tabs... it's a bit of keyboard shortcuts to remember (or a post-it ;)) for music i ca recommand musikcube or kew or ncmpcpp with mpd to get very functional players as TUIs.
or you can run a full screen tmux and do the tilling inside...
or am i missing something in your requirments?
To use two different user login sessions each for a desktop session on separate virtual consoles. For instance, to login to one desktop or window manager session as a music user group, and another as my traditional window managers. So, I'll log in and out of different accounts on one, and leave my music account with the window manager on a different virtual terminal on.

If I use one window manager, with hotkeys for different windows, which I've done, I wouldn't be able to use a separate user account for the other window manager. I could use a terminal emulator for that, but I want a whole new virtual console for it, that I could leave on with that session.


Also, how could I do a separate session with xdm? Or should I use xdm for one session which I traditionally use, and xinit for the second user session? For my second session, to log into the virtual console to that terminal under that account, and use that as an alias or a shell script in place of typing that out?
 
Also, how could I do a separate session with xdm? Or should I use xdm for one session which I traditionally use, and xinit for the second user session? For my second session, to log into the virtual console to that terminal under that account, and use that as an alias or a shell script in place of typing that out?

I would start the Xorg servers in two ssh sessions as a first try. Xdm and friends add more hair. You can do that later.
 
I ran two different xdm sessions, and this basically works.

Under /usr/local/etc/X11/xdm-config, I commented out DisplayManager.requestPort: 0 as the comment says uncomment this if you want to use xdm to manage terminals.

In the file Xservers under this same directory, I also added an entry pertaining to :1 for the second display.

Also, under /etc/ttys, under ttyv2, I replaced a second entry inserting /usr/local/bin/xdm -nodaemon. Specifying the screen number hasn't worked yet, when I tried that according to xdm(8).

The other good news is that fswm with its adjacent Xorg server use minimal CPU resources.

For less technical users who come across this, this requires .xsession and preferably other configuration files in the home directory.

While this works, under ttyv0, I get:
Code:
Getty repeating too quickly on port /dev/ttyv2, sleeping 30 secs
How would I fix this to get rid of this error msg?

Also, from time to time, the keyboard inputs will stop working on an Xorg session.
 
Last edited:
To get rid of the repeating error message, I turned one instance of xdm from ttys off. Then, I adjusted Xserver.

Under the directory of /usr/local/etc/X11/xdm/:
Reiterating, in xdm-config, the DisplayManager.requestPort line is commented out.

Xserver
Code:
:0 local /usr/local/bin/X :0 vt2 -nolisten tcp
:1 local /usr/local/bin/X :1 vt3 -nolisten tcp
In this example, I used F2 and F3 consoles for xdm and the xserver. vt2 corresponds to :0, and vt3 corresponds to :1, as these vt numbers match the F keys.

Use Xsetup_0 and Xsetup_1 to adjust your xdm background.

In /etc/ttys, ttyv2 is turned off.

Adjust .xsession and other configuration files in your home directory as needed.
 
Back
Top