Note that there are some explanatory texts on larger screens.

plurals
  1. POpyGTK detect all window move events
    primarykey
    data
    text
    <p>I'm trying to capture the configure-event for every window to create a windows 7-esque snap feature. I know there are solutions involving compiz-fusion, but my installation is running within vmware and doesn't have hardware acceleration to run compiz. I figured a simple python script could do what I wanted, but I can't seem to find the right place to bind the configure-event to.</p> <p>How/to what do you bind the configure-event callback, or is there a different event I need to watch for? I've tried binding it to the screen and the root window using get_root_window() with no luck.</p> <p><em>EDIT2</em></p> <p>Now I can capture all events, the problem is that every event returned is of type GDK_NOTHING, so I can't tell the difference between focus events, move events, close events, etc.</p> <pre><code>#!/usr/bin/python import pygtk pygtk.require('2.0') import gtk, wnck import inspect def move_event(e): print e.type, e.window print inspect.getmembers(e) return gtk.gdk.FILTER_CONTINUE def bind_win(screen, win): w = gtk.gdk.window_foreign_new(win.get_xid()) if w: w.set_events(w.get_events() | gtk.gdk.ALL_EVENTS_MASK) w.add_filter(move_event) if __name__ == "__main__": screen = wnck.screen_get_default() screen.connect("window_opened", bind_win) gtk.main() </code></pre> <p>One iteration of move_event(e) while dragging a window:</p> <p><code>&lt;enum GDK_NOTHING of type GdkEventType&gt; &lt;gtk.gdk.Window object at 0x7f38f72f8730 (GdkWindow at 0x196ce20)&gt; [('copy', &lt;built-in method copy of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('free', &lt;built-in method free of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_axis', &lt;built-in method get_axis of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_coords', &lt;built-in method get_coords of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_root_coords', &lt;built-in method get_root_coords of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_screen', &lt;built-in method get_screen of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_state', &lt;built-in method get_state of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('get_time', &lt;built-in method get_time of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('put', &lt;built-in method put of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('send_client_message', &lt;built-in method send_client_message of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('send_clientmessage_toall', &lt;built-in method send_clientmessage_toall of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('send_event', 1), ('set_screen', &lt;built-in method set_screen of gtk.gdk.Event object at 0x7f3900513d00&gt;), ('type', &lt;enum GDK_NOTHING of type GdkEventType&gt;), ('window', &lt;gtk.gdk.Window object at 0x7f38f72f8730 (GdkWindow at 0x196ce20)&gt;)]</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload