mighack is a small preload library that makes it possible to move GTK+ applications to a different X server and/or screen. It works by adding a signal called "screen_migrate" to GtkWindow by hooking into creation of the GtkWindow class. This signal is similar to the "screen" property, but takes a string like "localhost:10.0".

Note that as the name suggests, this is a hack ("<Company> that is nasty"). I think a window manager integration makes more sense in the long run. But it is a nice little hack.

Getting mighack

mighack is available with git from


To use the hack you need to load by exporting it in for example your ~/.gnomerc with:

export LD_PRELOAD=/path/to/lib/

Just adding a signal of course is not enough, to use the hack you also need to add a keybinding to trigger the screen migration. To do this write something like the following into your ~/.gtkrc-2.0:

binding "migration_hack" {
# Cycle trough the screens with Ctrl+Escape, the list of screens is
# separated with '#'
  bind "<ctrl>Escape" { "screen_migrate" ("localhost:22.0#:0.0") }

# Explicitly switching to a specific screen with <ctrl>F1 or F2
  bind "<ctrl>F1" { "screen_migrate" (":0.0") }
  bind "<ctrl>F2" { "screen_migrate" ("localhost:22.0") }

class "GtkWindow" binding "migration_hack"

With the above snippet you can migrate windows between localhost:22.0 and localhost:0.0 by either pressing Ctrl+Escape or Ctrl+F1/F2.

In some enviroments ~/.gtkrc-2.0 may be an auto generated file. If this is the case, it will usually include a file called ~/.gtkrc.mine or similar. If that is not the case, you can also just create a new file and add it to the GTK2_RC_FILES enviroment variable.


I am not aware of any problems with the code itself. However the screen migration is not very reliable. Many applications will not work at all (epiphany, evolution) and others have problems (gnome-terminal stays blank).

It does work fine with gedit and evince. I successfully migrated them between my main screen and an Xnest.