Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, December 29, 2010

getting workspace with gnome visal effects

I maintain linux-desktop-audit software. My Ubuntu machine recently allowed me to enable 'visual effects' to make nice looking transitions between workspaces.

However, this broke linux-desktop-audit. So, instead of listening to 'active_workspace_changed' the code should be listening to 'viewports_changed'. Once this event fires, to get the current workspace number I use the following code:

def viewport_change (self, screen):
        self.current_workspace = screen.get_active_workspace()
        v_x = self.current_workspace.get_viewport_x()
        v_y = self.current_workspace.get_viewport_y()
        v_w = screen.get_width()
        v_h = screen.get_height()
        v_r = self.current_workspace.get_width()
        v_c = self.current_workspace.get_height()
        total_cols = v_r/v_w
        total_rows = v_c/v_h
        desk_col = v_x/v_w
        desk_row = v_y/v_h
        ws_num = desk_col + (desk_row * total_cols)

Thursday, June 18, 2009

Hamster time tracker on opensuse

I've got interested in trying to identify what I spend my time in front of my computer doing. I knocked up a python script to watch 'wnck' and 'dbus' for desktop events (dbus for screensaver) which is available on my website.

While I was thinking of alerting the gnome community to the embryonic work, I discovered the 'Hamster' applet, which apparently is aimed at fulfiling the same need as my scratchy program.

So, I visited the hamster site and cloned the git repository onto my machine. Then I went about configuring it.

For OpenSuse, this turned out to require a bunch of dependencies to be fulfilled, so I thought I'd record them here so others may benifit.


zypper install autoconf automake libtool glib2-devel libgconf2-dev intltool gconf2-devel python-devel
zypper install gtk2-devel python-gtk-devel python-gobject2-devel python-gnome-devel


I might have missed some out while going through my .history, but that should get you close.

I'm not sure how much this is an additional OpenSuse specific feature, but I needed to set $PKG_CONFIG_PATH which I set to: /usr/lib64/pkgconfig/ (i'm on 64bit).