LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Tags used in this thread
Popular LQ Tags , , , , , , , , ,

Reply
 
Thread Tools
Old 07-01-2009, 12:10 PM   #1
devdol
LQ Newbie
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 24
Thanked: 0
Question Move application between desktops?


[Log in to get rid of this advertisement]
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 12:49 PM..
devdol is offline  
Tag This Post , , , , ,
Reply With Quote
Old 07-01-2009, 02:47 PM   #2
xeleema
Member
 
Registered: Aug 2005
Location: Deep in the Heart of Texas
Distribution: Slackware 13, RHEL5, Solaris (10 on SPARC), HP-UX (11.11 on PA-RISC)
Posts: 121
Thanked: 27
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 03:04 PM..
xeleema is offline     Reply With Quote
Old 07-02-2009, 05:49 AM   #3
devdol
LQ Newbie
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 24
Thanked: 0

Original Poster
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...)
devdol is offline  
Tag This Post , , , ,
Reply With Quote
Old 07-02-2009, 07:29 AM   #4
xeleema
Member
 
Registered: Aug 2005
Location: Deep in the Heart of Texas
Distribution: Slackware 13, RHEL5, Solaris (10 on SPARC), HP-UX (11.11 on PA-RISC)
Posts: 121
Thanked: 27
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?
xeleema is offline     Reply With Quote
Old 07-02-2009, 10:57 AM   #5
devdol
LQ Newbie
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 24
Thanked: 0

Original Poster
...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.
devdol is offline     Reply With Quote
Old 07-02-2009, 11:52 AM   #6
linusr@flanders
Member
 
Registered: Nov 2007
Location: Flanders/belgium
Distribution: Fedora 10 as main OS and CentOS 5.2 as test 'n dev server
Posts: 135
Thanked: 0
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
linusr@flanders is offline     Reply With Quote
Old 07-02-2009, 11:54 AM   #7
GrapefruiTgirl
Moderator
 
Registered: Dec 2006
Location: N.S.
Distribution: Slackware64
Posts: 4,211
Thanked: 177
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
GrapefruiTgirl is offline     Reply With Quote
Old 07-02-2009, 12:42 PM   #8
devdol
LQ Newbie
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 24
Thanked: 0

Original Poster
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.
devdol is offline     Reply With Quote
Old 07-02-2009, 01:37 PM   #9
linusr@flanders
Member
 
Registered: Nov 2007
Location: Flanders/belgium
Distribution: Fedora 10 as main OS and CentOS 5.2 as test 'n dev server
Posts: 135
Thanked: 0
Eh...sorry about the misread...

Best of luck getting the answer!

Thor
linusr@flanders is offline     Reply With Quote
Old 07-03-2009, 11:12 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 2,876
Thanked: 267
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 11:14 PM..
i92guboj is offline     Reply With Quote
Thanked by:

Reply

Bookmarks


Thread Tools

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 2 02-05-2009 06:52 PM
KDE4 - Multiple desktops(zoom able) - Unable to move taskbar flebber Linux - General 7 02-09-2008 12:37 AM
LXer: Deal aims to move 50,000 Asian Windows desktops to Linux LXer Syndicated Linux News 0 07-29-2006 11:21 PM
how to move virtual desktops huntinphil MEPIS 5 09-02-2005 02:07 PM
Move application from one distro to another kvalvik Linux - Software 2 07-08-2005 07:45 PM


All times are GMT -5. The time now is 06:58 AM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration