You are not logged in.

#1 2011-08-28 20:32:20

ying
Member
From: Austria
Registered: 2010-03-02
Posts: 110

*Solved* Appliction to switch between running X Servers

Hi all
I am looking for a command application, which allows me to switch between running X Servers. Similar to ctrl+alt+Fx. I do need this, because I need the source how this is done.

THX

Last edited by ying (2011-08-30 20:36:31)

Offline

#2 2011-08-30 12:17:19

cra
Member
From: Sweden
Registered: 2009-09-25
Posts: 70

Re: *Solved* Appliction to switch between running X Servers

There is a virtual keyboard application called xdotool
For example,

xdotool key ctrl+alt+F1

Thou shalt not make a machine in the likeness of a human mind

Offline

#3 2011-08-30 12:20:40

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: *Solved* Appliction to switch between running X Servers

You can use "chvt" commnd. For example, command:

chvt 4

will switch to console 4


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#4 2011-08-30 13:42:12

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: *Solved* Appliction to switch between running X Servers

Shark wrote:

You can use "chvt" commnd. For example, command:

chvt 4

will switch to console 4

Not exactly, I get

[karol@black ~]$ chvt 4
chvt: VT_ACTIVATE: Operation not permitted

when running inside X. OP wants to switch between running X servers, not VTs.

Offline

#5 2011-08-30 14:12:36

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: *Solved* Appliction to switch between running X Servers

karol wrote:
Shark wrote:

You can use "chvt" commnd. For example, command:

chvt 4

will switch to console 4

Not exactly, I get

[karol@black ~]$ chvt 4
chvt: VT_ACTIVATE: Operation not permitted

when running inside X. OP wants to switch between running X servers, not VTs.

If you are inside X, then you have to do:

sudo chvt 4

Running X servers can be switched via chvt. For me to change from display 0 to display 1 i just do "chvt 8" as root.

Last edited by Shark (2011-08-30 14:14:54)


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#6 2011-08-30 14:40:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: *Solved* Appliction to switch between running X Servers

Shark wrote:

If you are inside X, then you have to do:

sudo chvt 4

Running X servers can be switched via chvt. For me to change from display 0 to display 1 i just do "chvt 8" as root.

D'oh. Thanks for this explanation.

Offline

#7 2011-08-30 14:44:39

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: *Solved* Appliction to switch between running X Servers

In X, when you press Ctrl+Alt+F1...F12, you are switching VTs. In the xorg-server source xorg-server-1.11.0/hw/xfree86/common/xf86Events.c, you can see the function called for switching VT is xf86VTActivate(), which is defined in the files xorg-server-1.11.0/hw/xfree86/os-support/*/*VTsw*. The actual code is something like:

ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno)

Compare this to the chvt code:

ioctl(fd,VT_ACTIVATE,num)

You see how it's done smile


This silver ladybug at line 28...

Offline

#8 2011-08-30 20:36:21

ying
Member
From: Austria
Registered: 2010-03-02
Posts: 110

Re: *Solved* Appliction to switch between running X Servers

Hey thanks to all of you!

@lolilolicon: Perfect!

*Solved*

Edit: Is there also a way, to read out all running X servers and get the display and vt of it?

Last edited by ying (2011-08-30 20:37:28)

Offline

Board footer

Powered by FluxBB