Running program in separate X display

From ArchWiki
Revision as of 13:21, 27 September 2010 by Psycho zs (talk | contribs)
Jump to: navigation, search

It may often be handy to run some program in separate X display. I.e. 3D games for gaining performance, or making alt+tab-style switching possible with ctrl+alt+[F7-F12].

The simplest way would be:

xinit appname -- :10

But if you have ~/.xinitrc in place, you should use full path to app to override it. Also there can be some environment variables and X options to pass. So the smart way would be to pack it all into a wrapper:


# use this display number to run

# this flag is used for indicating inaccessible or broken DRI. 
# it can be mistakenly set, for example, when using fglrx+compiz-manager
# Some games will refuse to start if this variable is set.
# unsetting it should not do any harm, and can be really useful.

# this var can fix jumping pointer with some A4 mice in SDL games
# but it can also generate other glitches. Use only if needed

# main execution line with automatic full path retrieval.
xinit `which $*` -- $NEWDISP &

#then we set useful parameters
sleep 1s

# disable non-linear mouse acceleration
xset m 1 0
# disable hard-coded default 10m screensaver
xset s 0 0

General principle: set variables before xinit line, and xset parameters after.

Save it as /usr/bin/xrun

After that launching app in separate X display should be as easy as typing

xrun appname

--Psycho zs 09:21, 27 September 2010 (EDT)