LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 07-01-2009, 11:10 AM   #1
devdol
Member
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 55

Rep: Reputation: 17
Question Move application between desktops?


A challenging question to the real gurus of X:

Is it principally possible to "move" a running application's window live to another $DISPLAY (without killing and restarting the app, of course)? If so, by which means?

Possible scenarios to illustrate the need for this (incomplete list):

1) User A and B are logged onto a PC on parallel sessions, lets say DISPLAY=:0 and DISPLAY=:1.0. A wants to hand over some running application (window) to B, in terms of permissions: B and A mutually agree to transfer this applications between their window managers.
(Maybe there is even an analog flag to the "on all desktops" feature on virtual desktops within a session?)

2) User X is logged on interactively on a $WINDOWMANAGER's session. $WINDOWMANAGER crashes. X starts a second parallel session and wants to save some data he just worked on unsaved yet.

3) User Y is logged on interactively, locks his session, moves to another location and reconnects to his workstation using a tunneled vnc session, which by default throws him to DISPLAY=:32.0. Maybe he wants to "fetch" his running mail client, which he left with some unfinished messages open...

And so on. Certainly (1) is more complicated, as different users normally cannot be owner of the same process and something like "chown" onto that process would be necessary, too. However, in scenario (2) and (3) there should not be no problem in terms of permissions.
They might differ, as far as the same or different window managers might be active on the different DISPLAYs.


B.t.w. - Yes, I know VNC, RDP, NX and so on, but that's not what I asked for. (They export a whole session, not a single, specific application running on them.)

Last edited by devdol; 07-02-2009 at 11:49 AM.
 
Old 07-01-2009, 01:47 PM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 248Reputation: 248Reputation: 248
Just a wild stab in the dark, but here goes;
If it's possible to change the environment variables of a running process (somewhere in the /proc tree?), then this might work;

1. Find the Process ID (PID) of the X-based application, then issue a "SIGSTOP" ("kill -SIGSTOP pid#"), which should effectivly 'pause' the application.
Basically just
2. Change $DISPLAY for that PID's environment.
3. Issue a "SIGCONT" ("kill -SIGCONT pid#")to the PID and see if it freaks and jumps to the new display...

UPDATE:
Alright, after a bit of reading, let me revise those steps;
1. Fire up the GNU Debugger ("gdb")
2. Run the following;
(gdb) attach process_id
(gdb) call putenv ("DISPLAY=your.new.value:here")
(gdb) detach
3. ???
4. Profit!

Really not sure if that's going to work...but it's *bound* to leave an interesting mark!

Last edited by xeleema; 07-01-2009 at 02:04 PM.
 
Old 07-02-2009, 04:49 AM   #3
devdol
Member
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 55

Original Poster
Rep: Reputation: 17
That's a quite fascinating proposal. Thanks!

However, when I try to move an running thunderbird from :0 to :32.0, it remains where it is - independent of having it SIGSTOPped before and SIGCONTinued afterwards or not.

Furthermore, wmctrl, invoked on :32.0, always only "sees" windows on this display.

Hence, I suppose, in addition to a change of $DISPLAY in the target application's environment, it may be necessary to "deregister" it somehow from it's former window manager and "register" it to the new one - as those window managers eventually manage the window.

And perhaps, if one finds a way to execution this de-/re-registration sequence, $DISPLAY might be changed implicitly.

(Hopefully, this observation may arouse another X/wm adept...)
 
Old 07-02-2009, 06:29 AM   #4
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 248Reputation: 248Reputation: 248
At this point, I think we're going to need to clarify the technical details of your situation.

What Linux Distribution are you running? (and what version?)

Is it just Thunderbird you're trying to move? (and what version?)

Both users are connected to the same server, correct?
 
Old 07-02-2009, 09:57 AM   #5
devdol
Member
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 55

Original Poster
Rep: Reputation: 17
...it's Debian GNU/Linux squeeze/sid running a 2.6.26 kernel and xserver-xorg 7.4+3, but there should be a solution independent to those details.

In the test mentioned above, I tried to move a running iceweasle-bin from :0 (managed by KDE 4) to a vnc desktop on :32.0 (managed by icewm-lite). Again, it should be quite independent from the application, as the different window managers may care for it's window, and one and the same X server displays them.
 
Old 07-02-2009, 10:52 AM   #6
Thor_2.0
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,178
Blog Entries: 23

Rep: Reputation: 278Reputation: 278Reputation: 278
Ehrm...I do this all the time - move stuff from one desktop to the other. Just drag the thing.

Open a program on desktop 1. See the four desktops @ the right-below? The first one should display a little squarelet/shape. Ok, perhaps you can now switch to annother desktop. Moving the application is as simple as clicking on the desired desktop-icon (right-below). Now, bring the mouse over the shapelet that represents your application and hold-and-keep the mouse button down, drag and release where needed...

Hope that this is your "aha" !!!

Wellness 2 U!

Thor
 
Old 07-02-2009, 10:54 AM   #7
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
Quote:
Originally Posted by linusr@flanders View Post
Ehrm...I do this all the time - move stuff from one desktop to the other. Just drag the thing.

Open a program on desktop 1. See the four desktops @ the right-below? The first one should display a little squarelet/shape. Ok, perhaps you can now switch to annother desktop. Moving the application is as simple as clicking on the desired desktop-icon (right-below). Now, bring the mouse over the shapelet that represents your application and hold-and-keep the mouse button down, drag and release where needed...

Hope that this is your "aha" !!!

Wellness 2 U!

Thor
If I'm not mistaken, you've misunderstood the question, though I must admit, when I first read it, this is what I thought too.

The OP wants to transfer applications between $DISPLAY entities, not simply from one virtual desktop to another.

Sasha
 
Old 07-02-2009, 11:42 AM   #8
devdol
Member
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 55

Original Poster
Rep: Reputation: 17
Definitely yes - within the same $DISPLAY, just between virtual desktops, it's very easy )

Nevertheless, thank you all for your replies!

Moving windows between different window managers seems to be a challenge on X11-level. Didn't find out yet which tool to use for that.
 
Old 07-02-2009, 12:37 PM   #9
Thor_2.0
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,178
Blog Entries: 23

Rep: Reputation: 278Reputation: 278Reputation: 278
Eh...sorry about the misread...

Best of luck getting the answer!

Thor
 
Old 07-03-2009, 10:12 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Quote:
Originally Posted by devdol View Post
A challenging question to the real gurus of X:
I am nowhere near that. I am not even reasonably knowledgeable about xlib. However, I can answer, I think.

Quote:
Is it principally possible to "move" a running application's window live to another $DISPLAY (without killing and restarting the app, of course)? If so, by which means?
No.

Long answer: while technically possible in theory, no application supports this. For this to possible, the feature would need support in both the X server and the application itself. So, applications as they are now wouldn't work even if X supported such a thing, at least this is my understanding.

The application would need to be able to "detach" itself from a display, and from it's own UI, which would die an horrible death, then the UI would need to be recreated and the core of the application re-attached to the new UI we just created, then a new window would need to be created around the application (there's absolutely no way that you can just transfer a window from wmX running on display :0.1 to wmY running on :0.0

Much like a server/client thingie, like if the core of the application was some kind of daemon or so. There's an irc client for qt4 that can do a similar thing like screen does for text sessions. I think it was called qassel or something like that.

I have no idea if there's any mechanism in X to communicate two sessions, via dbus or whatever. If that doesn't exist, it would need to be implemented as well, so sessionX can tell to sessionY:

"hey, attach appCoreX to a new window inside yourself and let the application know that it must re-render it's UI, then let me know how it went so I can kill the UI here"

As you see, technically possible, but, as far as I know, there's no infrastructure for this yet, and applications would need to support it (or at least, it would need support at toolkit level, then all apps made with a given toolkit would inherit the capability).

This is all just thinking aloud, as I said, I am no guru on the X internals.

Last edited by i92guboj; 07-03-2009 at 10:14 PM.
 
Old 07-02-2010, 12:19 AM   #11
lxop
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
It is possible

Hi, I realise this is a late response, but thought I'd throw it out there anyway.
It can definitely be done, the framework is there, but I haven't yet figured out how to do it for arbitrary apps. If you download the GTK examples package, and run gtk-demo, you'll find `Change Display' in the list on the left. Double click to run the example app. This can be used to move the GTK examples app from one display to another, but for me it didn't work on any other apps.

Just thought I'd poke in to say it can be done, just not sure how.
 
1 members found this post helpful.
Old 11-17-2010, 06:00 AM   #12
opusvl
LQ Newbie
 
Registered: Nov 2010
Location: Rugby, UK
Distribution: Debian (Squeeze)
Posts: 4

Rep: Reputation: 0
Thumbs up Solution to enable X application mobility between screens

shifter & xpra solve this beautifully.

shifter is a graphical helper applet, xpra is the abstraction layer between the X app and the X display which mobilises the X application.

use your favorite search engine to get more details.
 
Old 11-17-2010, 06:21 AM   #13
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
Quote:
Originally Posted by opusvl View Post
shifter & xpra solve this beautifully.
This sounds very interesting! I hope the OP is still around and has a chance to read this update, and maybe report if they have made any progress in this area since their last post..

I'll be looking into this myself at some point here.. If it works 'as advertised' then this would/could (a big *maybe*) act as the "missing link" as far as not being able to drag apps from one screen to another while in TwinView mode (nvidia). Long story short (re: my nvidia hardware):

TwinView: works with compositing
TwinView: does not allow dragging apps from screen to screen.

Xinerama: does not work with compositing.
Xinerama: allows dragging apps from screen to screen.


Of course, this invites another unfortunate question: why do we need a(nother) separate X-related tool/application to do this? Jeez.. Oh well.. Maybe one day there'll be an X that has all its pieces & functionality contained within one unit..
 
Old 11-18-2010, 08:32 AM   #14
opusvl
LQ Newbie
 
Registered: Nov 2010
Location: Rugby, UK
Distribution: Debian (Squeeze)
Posts: 4

Rep: Reputation: 0
The "xpra" seems to work as advertised. I think there is further work required for shifter as although on the surface it does the job, it seems to struggle with a terminal server having thin clients, users logged on in 2 locations etc. The core seems up to this, maybe just needs some user testing & feedback. I will share here if I get shifter to do what I need. Hopefully it will address your Twinview issue.
 
Old 11-21-2010, 11:42 PM   #15
lxop
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
@GrapefruiTgirl:

I can drag apps between my monitors with TwinView - are you sure you can't? Are you using TwinView or separate X screens?
 
  


Reply

Tags
application, manager, move, process, register, server, share, transfer, window


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I move a running application from one X session to another? drchuck Linux - Software 4 11-17-2010 06:02 AM
KDE4 - Multiple desktops(zoom able) - Unable to move taskbar flebber Linux - General 7 02-08-2008 11:37 PM
LXer: Deal aims to move 50,000 Asian Windows desktops to Linux LXer Syndicated Linux News 0 07-29-2006 10:21 PM
how to move virtual desktops huntinphil MEPIS 5 09-02-2005 01:07 PM
Move application from one distro to another kvalvik Linux - Software 2 07-08-2005 06:45 PM


All times are GMT -5. The time now is 11:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration