1

Is it in some way possible to move a Window between Loginsessions in X11, proviced that I can get the XAuthority informations?

The Window will stay on the same Seat and same Display device, but it will be moved e.g. from Session2 to Session3 (currently I use consolekit, so the sessions would be /org/freedesktop/ConsoleKit/Session<X>).

The use case is: I have a daemon running for which I want the user to have a graphical feedback when it is running. The base case would be to preserve the window through e.g. fast user switching.

I use GTK right now as GUI toolkit and have access to the usual X11 Libs (no XCB, only Xlib) like XAuth, XRandR, XDamage, Xfixes, etc. Also the Daemon has an IPC connection to the Window and can transfer the MIT-MAGIC-COOKIE (or any XAuth data) to the Window to authorize to the new session.

So my question: Is this possible and, if yes, how?

For clarification: The daemon and the window are seperate programs (only connected via UNIX Socket for IPC). I just do not want to delete and recreated the window everytime the user switches, as that process also holds some logic and some data.

Nidhoegger
  • 4,973
  • 4
  • 36
  • 81
  • I would separate the daemon and the GUI as two different processes and programs – Basile Starynkevitch Oct 04 '17 at 09:27
  • They are seperated. Like I said, they only have an IPC connection for data exchange. I added it to the question for clarification. Thanks for the note. – Nidhoegger Oct 04 '17 at 09:30
  • Then just code the GUI to be able to communicate with an *existing* daemon, and restart the GUI instead of moving it across sessions, providing some mean to make that easy (e.g. save session state in a file) – Basile Starynkevitch Oct 04 '17 at 09:32
  • I know that this would be a possibility. But it would not be good in my case (as the GUI will send stuff about the current X11 data like the image to the daemon). Restarting the GUI would result in a lack of data while restarting, which I do not want. – Nidhoegger Oct 04 '17 at 09:37
  • No, you could persist something higher level than images. But I don't think that *moving* X11 windows across sessions is possible (they could run on *different* X11 servers) – Basile Starynkevitch Oct 04 '17 at 09:42
  • @BasileStarynkevitch I only want them to move to another session when on the same Seat, which is the same X11 Server. – Nidhoegger Oct 04 '17 at 09:51
  • I don't believe it is possible. Or at least, have your GTK program stop all GTK stuff and restart GTK; you want several consecutives `XOpenDisplay` -s and you should code something which could move from one X11 server to another one. – Basile Starynkevitch Oct 04 '17 at 09:53
  • I still dont want to move to another server nor another display! – Nidhoegger Oct 04 '17 at 09:55
  • But you need to code as if you did. X11 sessions are complex things set up at `gtk_init` time. – Basile Starynkevitch Oct 04 '17 at 09:55
  • You believe or you know? – Nidhoegger Oct 04 '17 at 09:56
  • Read EWMH & ICCCM things. Study source code of `gtk_init` and of `GtkApplication`. See my experiments in https://stackoverflow.com/q/43141659/841108 ... so it is between "I believe" and "I know"; restarting some GTK app is *practically* the easiest way to move across X11 sessions. – Basile Starynkevitch Oct 04 '17 at 09:58
  • No, different sessions are fully separate and isolated X11 servers. – n. m. could be an AI Oct 18 '17 at 19:38

0 Answers0