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://hack.org/mcwm
$ 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:

LABEL
[L][<refresh>]<text>

BUTTON
[B][<refresh>][<icon_path>][<command>]<text>

MENU
[M][<icon_path>][<text>][<icon_path][<command>]<text>*[<icon_path>][<command>]<text>...

SEPARATOR
[S][<size_mode>]<size>

PROGRESS BAR
[P][<refresh>][<size>]<text>

<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:

git://gitorious.org/qt-projects/qbar.git

and at Qt-apps.org. What’s missing? Ah…yes, screenshot!

qbar

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

Lascia un commento