New Qt project: qbar

Hello there! I’m still looking for an elegant window manager for developers under GNU/Linux. I think that mcwm is one of the nearest to my concept of design. No window borders, small RAM resources, XCB based.

When I downloaded mcwm project I noticed the TODO file containing an interesting feature request: snap borders. So in a couple of day I produced a patch and submitted to the author.  Unfortunately the author’s git repository doesn’t have a web interface, so, if you’re curious, you can see the patch as follows:

$ git clone git://
$ cd mcwm
$ git diff 864bc76d d20afb19

Well, now that the patch is merged, It’s time to develop a general purpose toolbar. A toolbar to display values, a toolbar to perform actions, a toolbar to rule them all! 🙂

And…in a couple of days I developed qbar that uses stdin streaming to fill itself with objects like: buttons, labels, menu, progress bar. And who knows about the future? You can write you “applet” in standard bash script and redirect the stdout to qbar through a pipe. As you can imagine there is a protocol for the arguments given in the stdin. The protocol is the following:






<refresh> can be S (static) or R (refresh)
<size_mode> can be E (expanding) or F (fixed)

qbar is developed in Qt (4.8), so you can use a simple CSS stylesheet to develop a new theme. Let me show you how:

QMainWindow {
	background: #333333;
	color: #fff;

QLabel {
	color: #fff;

QMenu {
	background: #333333;
	color: #fff;

QPushButton {
	border-radius: 10px;
	padding-left: 5px;
	padding-right: 5px;
	color: #fff;

QPushButton:hover, QMenu::item:selected{
	background: #666;

#ITEM_2 {
	width: 150px;

QProgressBar {
     border: 2px solid rgba(0,0,0,0);
     border-radius: 5px;
     text-align: center;
     background-color: #666;
     color: #fff;

 QProgressBar::chunk {
     background-color: #05B8CC;

As you can see from the code, you can refer to the n-th element using the CSS selector <#ITEM_> followed by the element id. And, you can use the following command line parameters:

qbar [-a <l|c|r>] [-p <t|b>] [-t] [-h <pixels>] [-stylesheet <file>]

-a alignment
   l = left
   c = center
   r = right
-p position
   t = top
   b = bottom
-t set transparent background
-h height in pixels
-stylesheet css file

qbar is published at Gitorious:


and at What’s missing? Ah…yes, screenshot!


If you liked it, please vote for it on, and if you want please submit patches and feature requests, all the code is released under the terms of GNU/GPL.

jQuery short answers quiz

I’m developing a website containing my deutsch course lessons. Our teacher given us some exercises, and I had the need to render it on an interactive web page. How to accomplish this mission? Obviously using jQuery.
The main issue is to write in a simple way your “short answers” form, and leave the hard job to jQuery code. So the form need to looks like:

    The sky is <input type="text" answ="blue"/>.
    The pen is <input type="text" answ="on"/> the table.<br />
    Yes I, <input type="text" answ="am"/>.<br />
    <input type="button" class="subm" value="Verify"/>

As you can see, each <input> contains the attribute answ with the correct answer and the element you want to use to check needs to have class=”subm”. That’s all!

The JS code resizes all the text inputs using the answer’s length, and changes CSS class (answ_error, answ_ok) of the input element. Finally a couple of attributes (tot and ok) will be added to the form, containing the number of text inputs and the number correct answers.

Code is available here.

Roba che frigge il cervello

Ultimamente mi sto imbattendo con roba che frigge il cervello, per questo mi sono dilettato ad inventarne una io. Semplice semplice. Indovinare l’output del codice compilandolo a mente.

// frittura.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
    static char b[1];
    0[b] = 2;

    for(*b <<= 1; *b==3>>1<<2; *b^=*b)
        printf("%s(%d) = %d\n",argv[0], argc, **&b);

    printf("%s(%d) = %d\n",argv[0], argc, *b);
    return EXIT_SUCCESS;

$ gcc frittura.c -o frittura -W -Wall -ansi -pedantic
$ ./frittura

Buon divertimento! 🙂

OpenTerminalHere Nautilus Script

Usually I don’t use graphic user interfaces to do my jobs, I prefer something like a black screen called “terminal” 🙂

Unfortunately sometimes I have no way, and I must use such interface. While a graphic user interface have a better user-friendly usage, it is the cause of many problems…and the better friend that I can have in such moments  is a terminal (that comes from the sky like an Angel). Today I realized one of the missing links between Nautilus and the terminal (any sauce: x-term, rxvt, gnome-terminal, etc.). So I created a simple script that will save the souls:


gnome-terminal --working-directory=$CURRENTDIR&

exit 0

You can save this script in .gnome2/nautilus-scripts and make it executable. I called the script and you can execute it with the right mouse button during Nautilus file exploration.

Good saves the Terminal and bless all its users!

First Henomis’ script-Fu for The Gimp


Here my first Script-Fu for The Gimp. This script creates something like the upper image, adding a frame (background color-filled) and execute “drop-shadow” script. Two considerations:

    • I’m happy, now I can post images on WordPress in easy&cool way
    • Scheme just sucks.

    Download: henomis-photoframe-script.scm.gz

    To install copy it into ~/.gimp-x.y/scripts directory dependig on your gimp version.

    Image from: here