import wnck
import gtk
scr = wnck.screen_get_default()
while gtk.events_pending(): # This is required to capture all existing events
gtk.main_iteration()
def window_switch_handler(screen,window):
# Get Current window, then the application and the name from it
cur_win = screen.get_active_window().get_application().get_name()
print "Currently showing %s" %cur_win
scr.connect("active-window-changed", window_switch_handler)
gtk.main()
After the last line "gtk.main()", the python interpreter will hang waiting for events to be serviced. Now if you switch any of the windows, you would see the name of the application displayed on the console.
Im working on a similar setup for KDE (using PyQT). I will post a similar setup after I try it at work tomorrow (I dont have a KDE Setup at home).
As for Windows, it turns out to be much more difficult. The PyAA seems to have stuff for WM_ACTIVATE and WM_DEACTIVATE but its compiled against Python 2.4 and noone has a later version available (unless its built). Im going to try 2 things.
* Compile PyAA with Python 2.5 or Python 2.6
* Use AutoIT for automating windows tasks. Its non-python and could be an issue when I compile all three interfaces together, but atleast it would provide some way to do it.
I dont know of any such automation for Mac OSX, but thats partly due to my lack of knowledge on that OS.
Showing posts with label projects. Show all posts
Showing posts with label projects. Show all posts
Sunday, November 8, 2009
Using WNCK for capturing Gnome window events
For those new to WNCK (that includes me as well), it stands for Window Navigation Construction Kit and is used for capturing all window based events in GNOME.
You could use python's pygtk to do some window management logic. For e.g. Find below some snippets about capturing when a window got switched. The below snippet will print the name of the application whenever any of the GNOME Windows switches (from Alt-Tab or clicking on window on the taskbar)
Saturday, October 17, 2009
Time Tracking System in Ruby on Unfuddle
Last year, when I wanted to create a timetracking system for my team, I thought of picking one from the Opensource world but couldnt find one that will fit my needs. I could have customized one of the existing ones, but they were either commercial or too primitive.
I took that as an excuse to do an app in Rails and called it YATSA (Yet Another TimeSheet Application). It has the following concepts
The Features document is available here. The project itself is uploaded to Unfuddle. Unfuddle does not have public access yet, but if you need the code, let me know, I can help create an account on the system for you to access it (The free version only supports 2 users, and Im one of them, Im planning to use the other version as the "public" user). There have been requests from a commercial firm asking to add Projects to this list so we can associate People to Projects. I will be adding those into this system. I will also add instructions on how to set this up, so if anyone is interested, they could use this. There is no license for it right now, but Ill set it up under Apache License 2.0.
- People
- Department
- Activities
The Features document is available here. The project itself is uploaded to Unfuddle. Unfuddle does not have public access yet, but if you need the code, let me know, I can help create an account on the system for you to access it (The free version only supports 2 users, and Im one of them, Im planning to use the other version as the "public" user). There have been requests from a commercial firm asking to add Projects to this list so we can associate People to Projects. I will be adding those into this system. I will also add instructions on how to set this up, so if anyone is interested, they could use this. There is no license for it right now, but Ill set it up under Apache License 2.0.
Labels:
projects,
ruby/rails
Subscribe to:
Posts (Atom)
