An X for every application

I picked up an odd tip the other day, by way of questions about window managers. falconindy pointed out that, rather than looking for a lightweight option, perhaps better route is to open another instance of X.

It’s something that I knew I could do, but didn’t really want — or need — to. After all, I’m normally I’m opposed to X in general, on account of the weight it has put on in recent months (years?). But something as quick and easy as this actually might prove … well, quicker and easier. :roll:

#!/bin/bash
DISPLAY=:1
X :1 -ac -terminate &
sleep 2
$*

Copy, paste, mark as executable. Call it from the terminal and suffix it with the name of the application you want to run. Switch between them by way of the CTRL+ALT+F# keys, with successive servers getting successive numbers.

Memorywise, I don’t know if it is a wise idea, or at least a wise idea for something as slow as this. On the other hand, it’s a dwindling population that uses machines with those specifications, so it might be perfectly acceptable for anyone using something built after 1999.

I gave it a try on a machine running Arch and had no real issues; whether or not you use it may depend on how practical it works out for you. After all, most window managers support multiple “desktops,” and so adding a whole different instance of X may be overcomplicating things to an unwieldy degree. You’re the best judge of that though. ;)

About these ads

12 Responses to “An X for every application”


  1. 1 sigtermer 2009/11/30 at 1:30 AM

    you have a display error in your script. the & in the third line is displayed as is.

    by the way, try using newer hardware. i can see why you do this, but it comes to a point when it just isn’t practical anymore. just an opinion ;)

    • 2 K.Mandla 2009/11/30 at 8:22 AM

      Thanks, got it.

      Yes, I suppose its going to be practical or impractical, depending on the person. For me, it’s not something I would probably use often, regardless of the hardware.

  2. 3 Greg 2009/11/30 at 2:37 AM

    Extra X servers have their uses- for instance, trying out new WMs without closing out all your open applications, or running full screen games like World of Warcraft in Wine without having to close it every time you want to switch programs.

  3. 4 Jose Catre-Vandis 2009/11/30 at 7:30 AM

    Do you have to be root (or sudo) to do this? I tried it out from a terminal whilst in Xubuntu 9.04 and needed to sudo the command to get the new display. Cute trick though :)

  4. 5 LeoSolaris 2009/11/30 at 7:53 AM

    I’ve never had to be sudo to use it… but then again, I do not open a new X with the same user either. I have a few different users, and occasionally use this sort of thing to switch to them.

    Since startx doesn’t work for a second user, you could just use the command: xinit — :X

    (X= number of running X’s plus one. So xinit — :1 would be a second display, xinit — :2 would be the third and so on.)

    In theory you can make as many as you like, but switching between them with the Ctrl+Alt+Fn keys is limited. If you have F1-F6 as consoles, then you have F7-F12 left as easy switches. There is probably a way around this, but I don’t know it right off.

    • 6 Jose Catre-Vandis 2009/12/02 at 6:40 AM

      xinit — :1 also requires sudo.

      X: user not authorized to run the X server, aborting.
      xinit:  Server error.

      When run as sudo, it fails

      Fatal server error:
      Server is already active for display 0
      	If this server is no longer running, remove /tmp/.X0-lock
      	and start again.
      
      
      Please consult the The X.Org Foundation support 
      	 at http://wiki.x.org
       for help. 
      
       ddxSigGiveUp: Closing log
      xinit:  Server error.

      This is on Xubuntu 9.04 – no funny business on the install :)

      • 7 Jose Catre-Vandis 2009/12/02 at 6:41 AM

        Oh, and I am trying to run the commands in xfce4-terminal. KMandla’s original command created an new instance of X using sudo.

        • 8 Stevko 2010/06/20 at 2:52 AM

          Look at file Xwrapper.config. You find allowed_users=console there. It means only users from console can run new X. You can chenge it to allow anyone to start X. I do not know if it is good or bad idea.

  5. 9 vespas 2009/11/30 at 9:29 PM

    this should be ok memory-wise since most of the memory should be in shared libs, so already loaded with the first instance of X. have a look at top’s SHR field.

  6. 10 Naib 2009/12/01 at 6:49 AM

    newx() { DISPLAY=:1.0; xinit $* — :1; };
    in your .bashrc

    then just: newx foo

    alot simpler

  7. 11 Jakob 2009/12/05 at 12:24 PM

    Really nice idea! Works fine. I use it to launch mplayer (playback in framebuffer doesn’t work with my setup).

  8. 12 Isengrin 2009/12/09 at 11:42 AM

    This is great for me since Awesome just can’t handle java apps (they look as an empty grey window).
    So, when I need one of them I call it this way. Thanks. :D


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,959,852 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: