Showing posts with label Window Managers. Show all posts
Showing posts with label Window Managers. Show all posts

Tuesday, June 3, 2008

qtevent: Using Signals for Event Handling

So it looks like Qt4 doesn't use signals for event handling. However, due to the nature of C++, it's trivial to extend the built-in widgets, which I did with this. To build, run qmake -project && qmake && make. Here's some sample output from a session:

% ./qtevent
76
83
32
45
76
65
32
16777248
36
72
79
77
69
16777220
`-> Captured: enter
ls -la $HOME

It makes programming similar to how I did my earlier launcher easier.

Sunday, April 27, 2008

nlaunch3.1

Here's another release of nlaunch: nlaunch3.1-20080427.tar.bz2

I'm wondering if I should create a page specifically for this purpose, but then I realize nobody would even bother to look. At least someone looks at this blog every now and then.

Monday, April 21, 2008

nlaunch3 Revision

I've made a few minor changes to nlaunch3, including a $HOME/.nlaunch3/nlaunchconfig.py specific to the user. The first configurable part is the method by which the executables are chosen. By default, it follows the old method ('old_style'), but it can also do by path ('full_path') or by the executable's basename ('basename'). The new styles worry me a bit, so they won't be default: nlaunch3-20080421b.tar.bz2

nlaunchconfig.py

select_command = 'full_path'

This one enables the new full path matching.

Sunday, April 20, 2008

nlaunch3!

Finally, nlaunch3 is here. However, I've decided to package them into a Tar archive and upload them, since most web browsers don't do well with tabs: nlaunch3.

I've made some usability improvements, but the major improvement is the ability to have a $HOME/.nlaunch/nlaunchuser.py script, like this:

nlaunchuser.py

#!/usr/bin/python
import functions
import os
class Wikipedia(functions.NLaunchFunction):
browser = 'firefox'
def __call__(self, *args):
return functions.forkexec(self.browser, 'http://en.wikipedia.org/wiki/Special:Search?search=' + '+'.join(args).replace(' ', '+') + '&go=Go')
class Kanji(functions.NLaunchFunction):
gs = os.path.join(os.environ['HOME'], 'Documents', 'kanji.ps')
viewer = 'kghostview'
def __call__(self, *args):
print str(self.gs)
return functions.forkexec(self.viewer, self.gs)
def Print(*args):
for i in args: print i,

To add something, one may either define a callable class (not an object), or create a function.

Tuesday, April 15, 2008

nlaunch3 Near Completion

So I've been working on nlaunch3 a bit, to succeed nlaunch2. The new version is basically done, but I need to do some more testing before I put it up here. The major difference is that this new version supports a $HOME/.nlaunch/user.py script, which contains functions and callable class definitions to add pseudo-programs to the launcher.

Depending on how I view the slight increase in overhead, I may stick with nlaunch2 as my primary launcher.

Sunday, April 13, 2008

screensize.py

Someone wondered if it was possible to get the resolutions of screens in Xinerama/TwinView, so I decided to do a proof-of-concept in Python using PyGTK. Here it is:

screensize.py

#!/usr/bin/python
# coding=utf8
import pygtk
pygtk.require('2.0')
import gtk
from os import environ


display = gtk.gdk.Display(environ['DISPLAY'])
if display:
for i in xrange(display.get_n_screens()):
screen = display.get_screen(i)
for j in xrange(screen.get_n_monitors()):
geo = screen.get_monitor_geometry(i)
print 'Screen %d/%d %dx%d' % (i, j, geo.width, geo.height)
else:
print 'Unable to get display:', environ['DISPLAY']
% python screensize.py
Screen 0/0 1400x1050
Screen 0/1 1400x1050

Awesome Window Manager

I've been exploring a few different window managers, and a friend of mine suggested Awesome, originally based on a rewrite of DWM. I found it to be very easy to configure, and the keyboard-oriented setup I've configured is efficient for my use. It even supports Japanese characters (unlike the older WMs) with the proper font (Kochi Gothic looks great).

Another useful feature is its widget system, where you define widgets in the .awesomerc, then pass data to the awesome-client program. Awk is amazingly useful here:

#!/bin/sh
# this script is for awesome 2.2


while true; do
sensors -u | awk '/[^s]+ Temp:/ { accum = accum $1 ": " $3 "C " }; END { print "1 widget_tell sense " accum }' | awesome-client
sleep 10
done

This widget's a simple CPU temperature monitor.