You are not logged in.

#1 2010-07-19 21:24:48

sausageandeggs
Member
Registered: 2009-12-05
Posts: 66

Moving windows between separate X screens

I've just switched over to using separate X screens for various different reasons and the only thing I can't get sorted is to find a way to move a window from one screen to another. I've tried 'xmove' and 'wmctrl' so far but had no joy. I don't want to go back to using twinview and searching around the usual supects is turning up nothing besides what i've already mentioned.
From what i've read it's (quite easily) do-able on other platforms but does anyone know if this is possible on Linux?

Offline

#2 2010-07-19 22:55:29

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Moving windows between separate X screens

You can't move apps between two x-screens. The initiatives that used to be able to do that were hacks which started the apps on a separate x-server and created windows which displayed what was running on those servers (sort of like 'screen' for console apps).

You'll probably have to live with this limitation if you want 2 x-screens. I used them for a good long while but have just gone to twinview finally (compiz is dropping separate X support soon enough). Out of curiosity, why do you not want twinview?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-07-20 08:52:40

sausageandeggs
Member
Registered: 2009-12-05
Posts: 66

Re: Moving windows between separate X screens

Thanx Ngoonee, i wasn't really expecting anything, just posted more in hope than in expectation. I got sick sick of full screen apps opening up in between screens, (i know theres ways around it). The thing that really p****d me off was that all of my apps kept limiting themselves to the resolution of my smaller screen (eg. Firefox kept opening up at 800x600) and nothing i tried would solve it. also i really like the way sep X screens look, plus i like fiddleing with stuff, plus i like to break things to see how you fix them, plus i .......... !
I thought that in compiz 0.9 you can open an instance of compiz for each screen?

Offline

#4 2010-07-20 12:22:52

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Moving windows between separate X screens

sausageandeggs wrote:

The thing that really p****d me off was that all of my apps kept limiting themselves to the resolution of my smaller screen (eg. Firefox kept opening up at 800x600) and nothing i tried would solve it.

I have two monitors with different resolutions and an extremely simply xorg.conf and a xrandr command in .xinitrc works fine to set the resolutions and the whole right-of thingy. Does that not work with you ? I am using xf86-video-ati. Does nvidia (assuming you have nvidia -since you talked about twinview) not support that?

Last edited by Inxsible (2010-07-20 14:43:58)


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2010-07-20 12:46:35

sausageandeggs
Member
Registered: 2009-12-05
Posts: 66

Re: Moving windows between separate X screens

Xrandr + Compiz + Nvidia wouldn't work for me no, I'm pretty sure that Nvidia doesn't support xrandr. It is an annoying problem though, when opening things on my higher res screen (which is also set as my main one), It's not a massive problem really (not being able to send stuff to other screens) as i only use the other screen for watching movies etc. It would just be nice to have the best of both worlds That and I just don't like things not working on my box

Offline

#6 2010-07-20 15:01:44

BurntSushi
Member
From: Massachusetts
Registered: 2009-06-28
Posts: 362
Website

Re: Moving windows between separate X screens

sausageandeggs wrote:

Xrandr + Compiz + Nvidia wouldn't work for me no, I'm pretty sure that Nvidia doesn't support xrandr. It is an annoying problem though, when opening things on my higher res screen (which is also set as my main one), It's not a massive problem really (not being able to send stuff to other screens) as i only use the other screen for watching movies etc. It would just be nice to have the best of both worlds That and I just don't like things not working on my box

I'm pretty sure xrandr works with nvidia. I'm not sure if this will solve your problem with applications opening in weird positions, but I have nvidia and use disper for all my multi-monitor needs. It's in the AUR.

Window placement though, is the job of the window manager. I don't use Compiz, but I'd hunt around for multi-monitor/xrandr/xinerama settings. It's Compiz's job to recognize multiple monitors and place/size windows accordingly. The information is certainly there! (Provided by X.)

If that doesn't work, devilspie might be of interest to you. It should certainly be able to accomplish what you want. You'll just need to configure it. See http://burtonini.com/blog/computers/devilspie/.

Last edited by BurntSushi (2010-07-20 15:02:51)


Education is favorable to liberty. Freedom can exist only in a society of knowledge. Without learning, men are incapable of knowing their rights, and where learning is confined to a few people, liberty can be neither equal nor universal.

Tu ne cede malis sed contra audentior ito

Offline

#7 2010-07-20 16:17:25

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Moving windows between separate X screens

You didn't setup your xorg.conf properly, I guess. Make sure you have Twinview on (set to 1), Xinerama off (set to 0) and a value set for TwinViewXineramaInfoOrder (if needed). Windows should maximize to one screen properly (indeed its NOT POSSIBLE to maximize them over both screens) and start on the screen with your pointer.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2010-07-20 16:36:21

sausageandeggs
Member
Registered: 2009-12-05
Posts: 66

Re: Moving windows between separate X screens

Maybe it thats xrandr wont work with dual x screens + Nvidia or maybe i'm just out of date, It's not a massive problem though as nvidia settings does all the size changing i need (which is pretty much none, they get set and left)
I'm not pushed about things starting up in the middle of the screen, it's only games anyway and its quite easily worked around, everything else started where it should've. The main apps that bugged me were firefox and thunderird they kept opening up at the size of the lowest res screen and whether i tried tweaking compz or firefox/tb it wouldn't stop happening. Thats all by the by though and all going way off topic because now that i've started using dual screens i really like having 2 totally separate cubes to work with, i don't know why i just do! and i'd really like to be able to send things between them, it isn't a HUGE problem though, just slightly annoying.
Having said all that thanx for the links i'll chcek them out, at first glance devilspie looks pretty neat.

Offline

#9 2010-07-20 16:42:14

sausageandeggs
Member
Registered: 2009-12-05
Posts: 66

Re: Moving windows between separate X screens

ngoonee wrote:

You didn't setup your xorg.conf properly, I guess. Make sure you have Twinview on (set to 1), Xinerama off (set to 0) and a value set for TwinViewXineramaInfoOrder (if needed). Windows should maximize to one screen properly (indeed its NOT POSSIBLE to maximize them over both screens) and start on the screen with your pointer.

I've explained my self poorly i think, sorry for that. It was only games that open up wrongly but its an easy fix, twinview worked fine for me, well exactly as expected anyway, it was thing with a couple of apps that i've explained above that made me change, and now that i have........

Last edited by sausageandeggs (2010-07-20 16:43:33)

Offline

#10 2013-04-26 11:12:03

farseerfc
Member
From: Osaka
Registered: 2013-01-29
Posts: 20
Website

Re: Moving windows between separate X screens

I believe this can be done, at least from GTK level. Here is a short example of how this can be achieved:

#include <gtk/gtk.h>
#include <gdk/gdk.h>

GtkWindow * mainWindow;
GdkDisplay *second_display;
GdkScreen *second_screen;

static void print_hello (GtkWidget *widget, gpointer data)
{
  g_print ("Hello World\n");
  GdkScreen* screen = gtk_window_get_screen(mainWindow);
  gint number = gdk_screen_get_number(screen);
  g_print ("Opened in screen %d \n",number);
  gtk_window_set_screen (mainWindow, second_screen);
  screen = gtk_window_get_screen(mainWindow);
  number = gdk_screen_get_number(screen);
  g_print ("Now in screen %d \n",number);
}

int main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *button;

  gtk_init (&argc, &argv);

  second_display = gdk_display_open (":0.1");
  second_screen = gdk_display_get_default_screen (second_display);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  mainWindow = GTK_WINDOW(window);
  gtk_window_set_title (GTK_WINDOW (window), "Hello");
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  button = gtk_button_new_with_label ("Hello World");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
  gtk_container_add (GTK_CONTAINER (window), button);
  gtk_widget_show (button);
  gtk_widget_show (window);

  gtk_main ();
  return 0;
}

This is modified from hello world example of gtk. Save the code to simple.c, then it should be compiled with:

gcc -o simple simple.c `pkg-config --libs --cflags gtk+-2.0`

The program will be started with a button inside, on where you start it. When button is clicked, the window will be move to the screen with display name ":0.1", you can change that value in source code to have it move to other screen.

As far as I known, Gimp and emacs utilized this ability so that you can move their windows to other screen.

I am not comfirmed but I think there is a similiar way to do so in QT. So if a program use either GTK or QT, its windows is capable to move to other screens.

I do not know whether this can be done in Xlib or Xcb, and how this is done in GTK. Maybe they re-created a new X window and re-map everything to that container. So maybe it is hard to control in Window Managers. Its upon the developer of applications to make this ability available.

Offline

#11 2013-04-27 00:10:09

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Moving windows between separate X screens

although your answer may help, its been almost 3 years since the last post in this thread. Things change quite frequently with rolling release.

Closing ...


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB