38

Does an X client necessarily need a window manager to work? Can an X client work with only the X server?

If an X client doesn't have a window, does whether it can work need a window manager?

If an X client can work without a window manager, does the X client necessarily have no window?

Thanks.

8
  • 4
    When I first encountered X—that is, quite a long time ago—the fact that you don't need a window manager was discussed in most introductory materials. That doesn't seem to be the case these days, but I suppose that someone might think this obvious or an example of laziness. Dec 27, 2018 at 19:38
  • 11
    @Tim: You seem to have been around long enough that you should know that a downvote is not intended to communicate "hatred", "evilness", "cruelty", "discrimination" or anything like that at all. A downvote is simply a content rating system, and some content is less valuable than other content. (For the record, I didn't downvote this question: I think this question is great.) See also: Can we make it more obvious to new users that downvotes on the main site are not insults and in fact can help them help themselves? on Meta Stack Overflow. Dec 27, 2018 at 20:48
  • 5
    @Tim Some of your downvoted questions seem not useful to me. The UI (the alt text of the button) encourages users to downvote "not useful" questions. Hatred is not a necessary component. Adding a small hint/assertion that a question could be potentially used in some scenario (even if very marginal/improbable) would mostly prevent that knee-jerk reaction. Your questions that I saw are remarkably similar in that they lack any such hint/assertion.
    – kubanczyk
    Dec 27, 2018 at 23:49
  • 3
    Tim, the diamond moderators have access to some tools that detect pattern voting. Flag them and ask them to look into it. /mod on physics.se Dec 28, 2018 at 1:12
  • 1
    Parts of your question seem ungrammatical. Worst offender seems to be "does whether it can work need a window manager?".
    – hkBst
    Dec 29, 2018 at 16:40

6 Answers 6

41

No, you don't need to be running a window manager to allow an X client to work. Some systems provide an option to just run a terminal at startup, and from that you can start additional programs, including window managers. Some kiosk setups which only want one application to run don't need a window manager. Some implementations of X for microsoft windows avoid an X window manager by letting the OS manage the windows.

Without a window manager you typically need to specify the geometry to the programs so you don't have everything placed in the top left corner.

In X, the window manager is just another X client. This was unusual at the time, but made it easy to have different window managers.

Another way to look at the question is to observe that you can change window managers on the fly, so there is a time between the first one stopping and the second one taking control, but as all your applications don't crash they must be able to work without.

1
  • 2
    Hint: there is a tool called xwit which really helps when experimenting with wm-less configurations. Dec 28, 2018 at 14:32
28

No. Well written apps don't need a window manager.

But some "modern" broken apps will not work fine without a window manager (eg. firefox and its address bar suggestions which won't drop down [1]).

Many other subpar apps not only assume a window manager, but to add insult to injury, a click to focus window manager. For instance, it used to be that any java app will simply steal the focus on startup.

If you want to test, install Xephyr (a "nested" X11 server), run it with Xephyr :1, and then start your apps with DISPLAY=:1 in their environment.

[1] the "awesome bar" of Firefox won't open its suggestions pane when typed into or clicked on the history button unless there's a window manager running. The auto-hide menu won't work either.

3
  • Is there an open bug in firefox for the issue you mentioned? I think firefox's open source nature would be willing to accomodate a bug fix for that issue.
    – user328744
    Dec 27, 2018 at 22:27
  • 4
    @t3dodson You can trying submitting one, but it's highly doubtful that anybody will care to review a patch fixing that. Running firefox is not really supported without a window manager, session manager, and recently, a pulseaudio server running. Of course, you can fork it, but having to maintain a firefox fork is not something I would wish on my worst enemy ;-)
    – user313992
    Dec 28, 2018 at 9:24
  • Imo any answer on this theme is not complete without mentioning Xephyr. +1 Dec 31, 2018 at 9:02
7

A window manager is a convenience for users.

In the good^Wbad old days, I used to have a ~/.Xclients file that read:

#!/bin/sh

HOST=`uname -n | sed 's/\..*$//'`

xv -root -rmode 5 $HOME/misc/millennium/theme/Wallpaper.gif -quit &

xterm -geometry 80x24+0+85 \#52x71-104+0 -n $HOST -T $HOST &
xterm -geometry 80x24+510+429 \#52x71-52+0  -n $HOST -T $HOST &
xclock -digital -update 1 -geometry +1059+982 &
xscreensaver -nosplash &
exec /usr/local/lib/X11/fvwm/fvwm

This file would be run when I started X with startx. When this script finishes then the X server will shut down.

Note the last line: exec .../fvwm. This is the line that started my window manager (fvwm). All the previous applications (xv, xterm, xclock, xscreensaver) were running before the window manager started. Because the call to fvwm was the last line and not put in the background it meant that when fvwm terminated then X would close down.

The X startup even had a "fall back" default... if there were no configuration files then start X with a single xterm running. Closing that xterm would end the X session.

8
  • What was the advantage of not backgrounding fvwm? Dec 29, 2018 at 12:48
  • 1
    We need the script to not terminate because if it does then the X server terminates; by not backgrounding fvwm (and running it by exec) we ensure there's still a process keeping the X server from shutting down. By making that last process fvwm allows for an "exit" menu item to work as expected. Dec 29, 2018 at 13:36
  • Got it. It's been a while since I did much low-level with X. Must say though that fvwm 2 is one of my two favorite window managers (the other being kwin 3). Dec 29, 2018 at 13:43
  • In my case, fvwm-1.24r was my favourite window manager :-) Dec 29, 2018 at 13:43
  • I hear you on that. I seem to recall that v2 was more customizable than v1 though (with all config options in a single text file and reloadable on-the-fly?). Pretty light-weight too, especially by today's standards. I last used it daily in the P-II era IIRC. Dec 29, 2018 at 13:47
6

To add to other answers, I have developed and released an open source app which works without a window manager (meaning you can start it directly from xinitrc). There is some extra steps the application should do in this case besides managing geometry and Z-order of its dialogs, but this is totally manageable.

2

Yes, an X client can work with only the X server. As an example, I give my virtual machines their own virtual console on the host, like this.

# Press CTRL-ALT-F5, login and enter this command:
startx /usr/bin/virt-viewer -a -k -r -w -c qemu:///system CentOS -- :4

# Press CTRL-ALT-F6, login and enter this command:
startx /usr/bin/virt-viewer -a -k -r -w -c qemu:///system Windows -- :5

The "startx" command starts the Xorg X server on displays :4 and :5 with only virt-viewer as an client.

"CentOS" and "Windows" are the names I gave my virtual machines when I installed them. The -k switch for virt-viewer makes it full screen with minimal controls, so each virtual machine appears to own the machine until I press CTRL-ALT-Fn to switch to a different virtual console.

Of course, CentOS is running a display manager and window manager inside the virtual machine, but that has no connection with the X server running on the host.

1

There are a lot of good detailed answers here. Here is the simple clear cut answer.

Does an X client necessarily need a window manager to work?

No: But without if you will struggle to manage your windows (moving, re-sizing, lowering, raising, etc.). There are other tool that can do this, if you need it.

Can an X client work with only the X server?

Yes

If an X client doesn't have a window, does whether it can work need a window manager?

If it has no windows, then there should be no down-side of having no window-manager.

If an X client can work without a window manager, does the X client necessarily have no window?

No: it can have windows.

Try this.

DISPLAY=:21
vncserver -localhost -geometry 1920x1080  -SecurityTypes None $DISPLAY &
ssvnc $DISPLAY
xterm &

then in the new xterm type fvwm.

You may need to install vncserver, ssvnc, and fvwm, first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .