Qball's Weblog

Beati pauperes spiritu

Rofi - 1 Year Old

| Comments

Around one year ago I decided to expand the functionality of simpleswitcher, because my wild ideas did not match with Sean Pringle his vision, I decided to fork it. Since then a lot of changes happened and simpleswitcher (now called Rofi) is no longer simple. On its one year anniversary I decided I wanted to add something to Rofi. It did not have to be something useful, but ‘special’.

Improved transparency

Given a few days before I realized the one year anniversary, I complained about the transparancy being not so nice (the ‘-opacity’ option) especially because it also makes the text transparent. I complained about fixing it being hard, so this is what I set out to do.

So if you X11 setup support TrueColor colormap (any modern one will) and you have a compositor running, you can now specify an alpha channel in each color. This will look like:

Rofi transparancy

As you can see, the background is transparent but the border, text and selected item not. I find this a lot nicer effect then the old transparency.

You can specify the color as follow: argb:AARRGGBB So for a half transparent black background you set: argb:7F000000. So for the above screenshot, the following settings apply:

1
2
3
4
5
6
rofi.fg:                   argb:FFffffff
rofi.bg:                   argb:cc000000
rofi.bgalt:                argb:dd2c3311
rofi.hlfg:                 #fdf6e3
rofi.hlbg:                 #859900
rofi.bc:                   #859900

Logo

I am still looking for a logo for Rofi.

Release

I just release 0.15.1.

BinClock - Binary Clock Qball Style

| Comments

For the 2nd x-mas day I decided to make a clock. I recently (well already 1.5 years ago I build a nixie clock. We are moving building at work and one thing I miss in my current room is a clock. Bringing a nixie clock was my first idea, but it has some problems. Firstly it is expensive to build (especially the tubes that have a real 5 not an upside down 2), it has 170V running through it and relatively easy to access and it probably wears down pretty quickly when used 24/5.

So lets build something new, preferable with LEDs. But any clock won’t do, I had some ideas:

  1. . Binary Clock.
  2. . Non normal clock-face design.

Secondly I had some extra requirements:

  1. . The minimal number of components needed and wires. This so if I like it I can easily make a cheap PCB.
  2. . Possible show temperature.
  3. . PC interface, so maybe to use for notifications.

Clock Face

I had this idea for a binary clock face a while back, its simple and it is round (like a clock). The top part (yellow leds) shows minutes, the middle part (red leds) hours (1-12 h) and bottom part (blue leds) seconds.

Clock Face

I am pretty confident it will work out.

Hardware

As I said I wanted to use the least amount of components, basically:

  • 16 LEDs and 2 resistors for the display.
  • MCU (for now I took an Arduino I had lying around) plan to take an Cortex m0 later.
  • DS1820 temperature sensor and pull-up resistor.

Wiring

So I wanted the least amount of wires. So I re-used a trick I used several years back, to hook up LEDs. In this design I control 16 LEDs with 6 wires in total. Not sure hot to do it with less (without using extra hardware or LEDs with controllers build in).

Wiring

It is a 2x4 grid (4 columns 2 banks), Then we can double the amount of entries by reversing polarity. If it works in star-trek why wouldn’t it work for me. The software is a bit more tricky, you can only enable certain LEDs at the same time (I choose to have only one on at the same time) and you need 3 states: High, Low, Floating. Luckely this is something easy to do on an AVR. The required resistors are in the bank lines.

Wiring - ugly soldering

Casing

This is where things get tricky, LEDs have the tendency to be bright, very bright. To top that, the only LEDs I had in stock where ultra-brights. So I tried several solutions:

  1. . Shine through wood. An idea that I had for a while now, but never knew if it would work. I drilled a hole that almost completely through the wood except for the last 0.5 mm (and dried various other depths). This did not give the desired result. The best result gave a weird stripe with the ‘flow of the wood’. I knew it was a long shot. Maybe I find the right wood for this later.
  2. . Veneer. I did not have anything sufficiently thin to work.
  3. . Milk-glass. This worked very well, except that the off-state are hard to see. Making it hard to read the time. So some ‘labeling’ on the glass was needed.
  4. . Paper. This worked surprisingly well and gave a nice ‘look’. Especially with the next point added.
  5. . Deep hole. I sunk the leds in a 3 mm deep hole, This looks very nice when looking at it from a (slight) angle. The problem of brightness still remains when looking directly in it.
  6. . I have some more ideas in combination with 5. If I find something perfect, I will blog about it.

For now I went with method 5, in a small wooden box. This box once held a ‘Amphenol precision connector/APC’ and dates back from 1973 or so. I got a few of these from the trash at work. If I am going to make a PCB I will make a nice small case around it. (Could be a watch?)

I also included the temperature sensor half embedded in the back of the case.

Leds front

Software

The software can be found on GitHub. It is a simple arduino sketch, that uses lower level register access here and there to speed things up (and I am more used doing it this way). As said before, only one led can be turned on at the time, but quickly turning the required LEDs on and off I can create the illusion that any number of led is on. By playing with on/off time I can also dim them when needed.

API

There currently is a simple API for controlling things:

  • sHHMMSS Set time.
  • t Show temperature.
  • a Turn on all LEDs.
  • x Test sequence.
  • lX Set led on time between 0 and 255 (raw).
  • dX Set led off time between 0 and 255 (raw).

More to come.

ToDo

There is more to do, like with any project.

  1. Make a final version.
  2. Port to Cortex M0.
  3. Make small PCB.
  4. Get time via Wireless or DCF.
  5. Button to show temperature.

Review Plantronics BackBeat FIT

| Comments

To do something random, I will review my new wireless headset, the plantronics BackBeat FIT. I have been using the headphones for 6 months now (already wrote the first version of this review 3 months back, but I updated it now to include latest experiences).

Reason for purchase

My previous bluetooth headset (plantronics BB903+) broke after many years of reliable service. It was squashed a few years back by somebody bumping full weight in my backpack. This broke off one ear-piece and after being held together by tape and instant glue for a couple of years it died.

BB 903 + (picture from plantronics.com)

Given I am using it traveling from and to work and during cycling, I set the following requirements for the replacement:

  • Bluetooth: Especially when cycling I do not want wires pulling on my ears. Beside it being painfull I broke many headsets this way.
  • Stereo sounds: It needs to support high quality (A2DP?) Audio.
  • Handsfree phone: This is extremely useful when traveling.
  • Multi-device support: My previous headset could connect to both my phone and tablet/laptop at the same time, using one for phone calls, other for music.
  • 6+ Hours battery: It should be similar or better then I had.
  • Easy, reliable fit: The last headset wasn’t the most compact/easy fit (esp. after being broken).
  • Hufter proof: It should be robust.

Reading many online reviews it quickly became apparent that the Plantronics was the best choice for me. It looked liked it satisfied all my requirements, looked very robust and it was the only one that had only positive reviews (some complained about weak base, I do not care about). Adding the fact that they build this for sporting, so it is sweat and rain proof, very robust (everything is flexible), does not block to much traffic noise and the positive previous experience it was an easy decision. I could put a list here of the other headphones I considered, but it seems the list is mostly outdated again.

BackBeat FIT

Unpacking

BackBeat FIT Case

The plantronics comes in a nice box, containing:

  • The head-set
  • USB charge wire. (Just a micro-usb cable)
  • Getting started guide
  • Impressively thick safety guide
  • A carrying case that doubles as an arm-band case for your mobile phone.

A fun note here is the text in the safety guide:

Please note the use of this accessory with iPod, IPhone, or Ipad may affect wireless
performance.

Does this affect the wireless performance of the i* or of the headset?

Initial use

Like any bluetooth headset, this was very easy, by holding the power button the device went into paring mode (A friendly female voice tells you ‘Pairing’) and phone/tablet/laptop could pair with it instantly. I tested this on Android 4.3 and up, windows 7, 8, 8.1 and Linux (Debian Jessie). So far so good. The website states, it can keep paired to 8 devices, this should allow me to use it with my phone, tablet and pc without having to re-pair each time. This works fine, although windows seems to be very reluctant to release the device, so it can be connected to something else.

Phone software

There is one thing to say about this one: CRAP. It is a huge program, that serves two purposes:

  1. . Manual. It shows you what buttons are there, and what they do.
  2. . Battery status. Showing you the remaining status.

For this it takes 10 mbyte of data. This would be fine, if it actually works. But no, for 70% of the time it shows a completely incorrect battery life time in the notification area. If you then open the app it will give a communication error and thats it. It is not capable of doing it main job: Show remaining battery. My advice, do not install it, it will just put you off. It is an issue with many hardware companies, they design nice hardware but have no clue about software.

The disappointment

When setting things up I hit one big disappointment, while the device support multiple devices it cannot connect to them simultaneous like the BB903+. I cannot have my tablet playback the music and have my phone connected for calls. After using this for a few months now, this turned out to be a non-dealbreak-issue. I put Spotify on my phone, and have no real use for my tablet. But something that was very useful from time to time and is missed.

Another small thing to note was the voice control, the old headset was a lot more verbose in giving information. It would tell me ‘4 hours remaining’ instead of full, medium and low that the current one does.

Wearing Comfort

One of the requirements was that it should be easy to put in and reliable to wear. The second thing is where it shines, I never had it fall out of my ear, get snagged or hurting my ears. I can easily wear the headphone for many hours. The headset leans on the top of your ears, it is balanced so the band at the back does not pull it out of your ears (you do not really notice it while wearing). The only minor gripe I found was that the headphone sometimes tick against the feet of my glasses (only on one ear though), this can be resolved by taking of the glasses and putting them on again, so the feet are on the outside.

Buttons

BackBeat buttons (picture taken from the manual)

The small buttons are a bit awkward to use, but you get used to this very quickly. Pressing the left one raises the volume (by one step), holding it longer lowers it (by two steps weirdly). The right one turns it on/off (long press) or reports battery lifetime (short press). The two big buttons allow you to pick/hang up the phone (right), play/pause or skip song (left). The hit rate is still not perfect after using it for half a year. Especially skipping to next song often results in me pausing and unpausing again.

Build quality

The build quality is very good, there are no rough edges, discoloration, etc. After half a year of almost daily usage it is still in good condition, only close inspection shows some wear. This is very impressive. The whole headphone is very flexible. As advertised, you can throw it in your back and forget about it. The headphone also comes with carrying case that also serves as a arm-band for a smart phone. While it looks and feels nice, I haven’t used this one.

Rain

The 1st week I had BackBeat I got trapped in a huge shower, one of the showers that flooded several villages and collapse many buildings. Luckily the headphones lived through it perfectly, they kept working and did not fill up with water. It did however direct some of the incoming water into my ear, this was slightly unpleasant. Less heavy rain did not have this problem, I guess I can claim an ‘act of god’ here.

Rain (picture from spreadshirt.com)

Sound quality

One thing to keep in mind about this headset is that its designed to be worn while exercising outside. It does not try to block outside sounds, if you are wearing it on the bike, you are still fully aware of what happens around you. Traffic sound might drown out music (less for phone calls, see below), I find this a good thing, but YMMV.

Music

Keeping in mind it is a wireless headset, the sound quality is more then sufficient. While it is worse then my wired headphones (2 Beyerdynamics), the overall performance is good. Basses are a bit weak, however I noticed this is very dependent on the fit. The better the seal, the nicer the bass. For the middle and high are clear and good for enjoying music while exercising. It is better then many other bluetooth headsets I tried. I won’t go into more details about this, as this is something very subjective. But one last remark, something I find very important, is that there is very little (unwanted) background noise. If the music is quiet (or volume on phone is set to low), so is the headset, no slight hissing (Like a rappoo I had before), no digital noise (like the audio output on my Dell laptop ) or other artifacts.

Phone calls

Where the music sound good, the phone quality is worse. It is a Weird thing; it is very easy to understand, but it is not a pleasant sound. It feels like they are boosting the loudness to improve understandability giving a very harsh sound. I guess in the end it does help you hear the other side, even over heavy traffic noises. People calling me indicated that they could hear me loud and clear, I have not tested this myself. It did not lead to any problems yet.

Battery life time

I cannot judge the talk time, as I never call more then a couple of minutes a day, plantronics claims a 6 hour talk time. The listening time to music is around 7-8 hours, it varies a bit and I haven’t figured out what is causing that. However it is close to the 8 hours advertised. Having it connected but unused, or unconnected seems to be a minimal drain on the battery. This is a significant improvement over other bluetooth devices. As a test I did not turn it off for a week, left it connected to my tablet, and it was still full.

Charging happens via a build in micro-usb port, it is a bit fiddly to open it up and use it, but it does the job. When charging the ring around the big button lights up red, and turns blue once full. Making it easy to see if it is full.

The life time is long enough that I often forget to charge it in time, it seems to be handling 10-20 minutes partial charges just fine. Giving me enough roughly 2 hours of listening time.

Conclusion

I strongly recommend this headset to anybody. The biggest down-side is the price. It is expensive and the price hasn’t dropped, nor is it for sale very often. It is worth it though, it lasts a lot longer then cheap head-sets and it adds a lot of comfort. If it will last more then 2 years (and I expect it to easily do that) it is cheaper over all.

Rofi Getting Popular? We Need a Logo!

| Comments

For reasons yet unknown to me, Rofi seems to be getting more attention lately. Having almost 100 stars at GitHub (pathetic I know, but it is a niche product.).

So any decent programs needs an icon, Right? Given I am the world shittiest artist, see my creation:

ARGH my eyes

So If anybody feels like making one; I am looking for a nice Rofi icon!

Wallpaper

PWM on Udoo Using the i.MX6 - Update

| Comments

A small update on the previous blog post.

In the previous post I actually forgot to mention how to enable the high resolution clock for PWM. There are two ways to do this.

Fiddling with registers

The clock can be enabled in the CCM_CCGR4 register. Bit 22 and 23, these can be configured to be:

  • 00 Clock is off during all modes. Stop enter hardware handshake is disabled.
  • 01 Clock is on in run mode, but off in WAIT and STOP modes
  • 10 Not applicable (Reserved).
  • 11 Clock is on during all modes, except STOP mode.

So we want to set these to 11.

1
2
$devregs CCM_CCGR4
CCM_CCGR4:0x020c4078    =0x0000c300

Now we want to enable bit 22-23 so we or it with 0x00c00000

So to enable it we set:

1
$devregs CCM_CCGR4 0x00c0c300

And the clocks are running! However this might be risky, if you screw up you might enable or disable a clock. There is a nice ‘hack’ to accomplish the same!

The hack

Let the ½ working PWM driver do it for us!

1
2
3
echo 0 > /sys/class/pwm/pwmchip3/export
echo 1 > /sys/class/pwm/pwmchip3/pwm0/enable
echo 0 > /sys/class/pwm/pwmchip3/unexport

After this, everything works as expected.

PWM on Udoo Using the i.MX6

| Comments

I have been very bad, not writing blog post. I guess that will be habit I am never going to break.

This blog post is a quick write down what I did to get pwm output working on the Udoo.

Out of the box

Out of the box PWM the only usable PWM is the one on the Atmel, but I did not want to use that, it feels wrong (also it is arduino based, so getting a decent PWM requires hacking, etc.). The Freescale has it, so why not use that See pinout. So looking around on the install I did see a nice /sys/class/pwm/ directory with the 4 pwm generators, however this was completely non working for two reasons:

  1. The pinmux is wrong
  2. The entries do not seem to setup the right registers.

So looking around, I found this post basically the only one I could find that talked about setting up PWM on the Udoo. But it gave a nice starting point. Lets first try to compile that imx-utils repository. This failed, it is setup for cross-compilation, and tries to link against framebuffer device. ( I only want the devregs tool.) A quick hack to the make file fixed this, the whole makefile now looks like:

1
2
3
all: devregs

devregs: devregs.cpp

The second problem when trying to get the tool to work is the processor detection, under ArchLinux (running 3.17 kernel) the right Revision is not exposed. A quick hack of the code to always load the imx6 version made things work. I might post this version later, mail me if interested.

So lets start setting up the PWM, first thing we need to do is setup the right pinmux. BEWARE THAT THIS PIN SHOULD NOT BE AN OUTPUT ON THE ATMEL, IF YOU DO THIS WILL DESTROY THE BOARD

1
   devregs IOMUXC_SW_MUX_CTL_PAD_SD4_DAT2 2

This sets GPIO42 to PWM4 output. Check the pinout. Then I followed the steps from the forum post, setting up the PWM:

1
2
3
4
devregs PWM4_PWMCR 0x0003fff0   # clocksource = 32kHz, div by 4096 = 8 Hz
devregs PWM4_PWMPR 6            # set period (6 + 2 = 8 cycles)
devregs PWM4_PWMSAR 1           # set duty cycle to 1/8
devregs PWM4_PWMCR 0x0003fff1   # enable PWM output

While I got some output from the PWM, it looked like utter sh??. It has a lot of high frequency components, and the output looks fully random. What could this be? (Sorry I forgot to take a photo of the output). Looking at the freescale manual IMX6DQRM.pdf it mentions several settings related to power? management: STOPEN stop mode enabled, DOZEN doze mode, WAITEN wait mode. By default if we hit any of these modes the PWM is stopped. I am not sure what Linux is doing, but lets be on the safe side and disable these.

1
devregs PWM4_PWMCR 0x0383fff0

And this instantly cleared up the PWM signal:

Plot

It is not perfect, there is still a lot of high frequency scruff on the signal, but it is clean enough. Now lets see if we can get a bit higher frequency going. Looking again at the datasheet, it looks like we can switch to highfreq clock,

1
devregs PWM4_PWMCR 0x0382fff0

And indeed the frequency goes up, now lets play with the prescaler a bit:

1
devregs PWM4_PWMCR 0x03824000

This gave me a nice stable 64kHz clock. (half from what I would expect based on the documentation, but that is an investigation for another time).

So to tie things together (I also inversed the PWM because my LED driver also inverts):

1
2
3
4
5
6
7
8
9
10
## Set pinmux
devregs IOMUXC_SW_MUX_CTL_PAD_SD4_DAT2 2
## Set high freq clock, inverse polairty, disable power  down modes etc.
devregs PWM4_PWMCR         0x03864000
## Set period to 255
devregs PWM4_PWMPR         0xfe
## Lights off
devregs PWM4_PWMSAR        0x00
## Enable clock
devregs PWM4_PWMCR         0x03864001

Now if I want to change the Light strength I call:

1
devregs PWM4_PWMSAR $HEX_LIGHT

Changing the duty cycle.

There is one small thing we still need to tweak, the PWM has a 4 element queue before the ‘SAR’ (duty cycle) register, we need to make sure this fifo is not full before we insert an element. We can do this by checking the Status Register: (PWM4_PWMSR4). The lower 3 bits indicate the remaining space. Luckely, I never manage to hit this, so will fix this at a later stage when making a dedicated PWM application instead of using devregs. Maybe even a kernel driver?

This now gives me a very nice controllable PWM. I need to play a bit with improving ‘fading’ effects. Currently it takes 9 seconds to go from low to high.

Some scripts:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash

declare -i LIGHT=$@

if [ -z "$LIGHT" ]
then
        LIGHT=0
fi

if [ $LIGHT -gt 255 ]
then
        LIGHT=255
fi 


HEX_LIGHT=$(printf "%X" $LIGHT)

devregs PWM4_PWMSAR $HEX_LIGHT
1
2
3
4
#!/usr/bin/env bash

STRENGTH=$(devregs PWM4_PWMSAR | awk -F= '{print strtonum($2)}')
echo $STRENGTH

and fading:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash

declare -i LIGHT=$@

if [ -z "$LIGHT" ]
then
        LIGHT=0
fi

if [ $LIGHT -gt 255 ]
then
        LIGHT=255
fi 

START=$(get_light.sh)

echo Going from $START to $LIGHT
if [ $START -gt $LIGHT ]
then

for a in `seq $START -1 $LIGHT`
do
        HEX_LIGHT=$(printf "%X" $a)
        devregs PWM4_PWMSAR $HEX_LIGHT > /dev/null
done

else

for a in `seq $START 1 $LIGHT`
do
        HEX_LIGHT=$(printf "%X" $a)
        devregs PWM4_PWMSAR $HEX_LIGHT > /dev/null

done

fi

Netflix, Rofi and More

| Comments

Netflix

Yesterday somebody made a nice post mentioning that we might be able to get native (so no wine running silverlight) Netflix working under linux. This uses html-5 DRM enabled video playback. It requires the latest chrome beta, specific libraries and user-agent tweaking. For some reason I had a very hard time to get the latest part working, this is also why I am making this blog, to keep this one around:

1
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2114.2 Safari/537.36

The big change is the chrome version (from previous link):

1
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36

Do not ask me why, I had to do this a couple of times before Netflix took it… It works now, not touching it anymore.

The playback is pretty stable and my aging pc seems to have little problems with it.

Rofi 0.14.8

Also yesterday I released Rofi 0.14.8. I won’t repeat the previous blog posts, but in short the changes are:

  • Pango support: Switching to pango gives us correct fallback fonts, fixing issue #69.
  • RTL support: Pango also fixed this bug: issue #70
  • RTL entering: Rafi confirmed this is now working correctly.
  • Correct UTF-8 collating of strings. Rofi now converts the strings to a case insensitive form, then creates collating keys. (using glib).
  • Improved dmenu support and minor extensions. This improves clerk.
  • Custom modi support using simple bash scripts.
  • A first throw at cleaning up the keybindings, thanks to lolilolicon. Issue: #73.
  • Cleanups.

I have probably forgotten ½ the changes.

You can download the latest version here.

Others

Trying out hoedown for Notes.CC. Hoedown only produces a body, not the rest of the HTML page and CSS. So I am going to need a nice template to fill in. So far it seems to be working fine, it seems to be actively developed. If anybody is willing to make a nice looking template?

So what is Notes.CC? It is a rewrite of Notes.txt in C++. It tries to be faster and more integrated then the previous bash hack. It uses libgit2 to handle the git repository and hoedown/discount for parsing the markdown file. I will release the thing when it is mostly feature full and reliable.

Fixing Monitor

| Comments

For the past few years, my Samsung 740BF been acting up a bit. When turning it on, or waking up from standby it would go give a garbled image. However turning it off and on fixed it. However the last few weeks it been failing all around, until today it decided to fail completely.

Experience learns that in most cases monitors and other devices die because of bad capacitors. This must be true, because there is a wikipedia article.

So opening it up, I must say, Samsung nicely constructed this. It nicely clicks together and only a few screws are needed to hold everything firmly in place. So I opened it up and took out the power supply.

Power Supply Before

If you take a good look you see that one capacitors is swollen. The 3rd capacitor in the lower left corner. So with a bit of careful soldering I took the capacitor out, a 16V 1000µF one. Replaced it by a new one with exactly identical specifications I had in my collection. Though I am not sure that it is of better quality, but never hurts to replace it. So after a few minutes of soldering:

Power Supply After

A fresh new capacitor in place. A quick assembly later, it worked like new. It now turns on without an issue and wakes up from standby. So using a € 0.03 capacitor I gave my (ancient) monitor a new life, a very dutch thing for me to do.

Rofi Updates

| Comments

Rofi recently got some nice updates. They are mostly tweaks to make things work just a bit better but in total they are a good improvement.

Custom Modi’s

In Rofi you can switch between the following modi’s: window switcher, run dialog, ssh dialog. The latest changes allow you to specify the set of active modi, so if you do not use the ssh dialog you can disable it. Simple change, but very useful. In addition I made an option to add switchers using simple bash scripts. It is like the dmenu mode, but then more integrated.

Say I want to add a modi that allows me to quickly switch between the available i3 desktops (instead of windows). You first specify (either via Xresources or command line) the new switcher:

1
rofi.switchers: window,run,ssh,Workspace:i3_switch_workspace_script.sh

Workspace is the name it shows as prompt, i3_switch_workspace_script.sh is the script that gets called.

The i3_switch_workspace_script.sh is as follow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

if [ -z $@ ]
then
function gen_workspaces()
{
    i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n
}


echo empty; gen_workspaces
else
    WORKSPACE=$@

    if [ x"empty" = x"${WORKSPACE}" ]
    then
        i3_empty_workspace.sh >/dev/null
    elif [ -n "${WORKSPACE}" ]
    then
        i3-msg workspace "${WORKSPACE}" >/dev/null
    fi
fi

Rofi will first call the script with no arguments, this will make it generate the list of available workspaces. Once the user selected an entry, Rofi calls the script again and passes the selected item as argument. (the above script can be found in Rofi’s git Examples/ directory).

More advanced scripts can be made that have sub-menu’s, an example of this is the domo_rofi_script.sh in the repository. If you the user selects a command, the script returns a new set of options, Rofi will list this until the script returns nothing, indicating it is done.

To quicker switch between the different modi, the user can press alt-4 to switch to the 4th modi directly.

Pango support

This is a change that won’t affect much for most users, but fixes a lot of issues people had that uses ‘complex’ character sets. Because of the switch to pango the following things now work as they should:

  • Fallback fonts: If some characters are not supported by the font, it will now fallback (using fontconfig) to a font that has it. This way everything is shown as expected.

  • RTL fonts: Right to left fonts are now correctly displayed and correctly aligned.

  • Entering RTL: Rafi confirmed he is capable of entering RTL text, moving through the text and matching text this way.

  • Ellipsize: The strings are nicely ellipsized this looks better then being cut off.

There are of course some downsides:

  • It is slower then using Xft directly. But nothing problematic. Benefits far outweighs the costs IMHO.

  • The font-string has slightly changed, the dash between font name and size should now be a space.

A video demonstrating (made by Rafi) can be found here

Other fixes and additions

Dmenu compatibility.

Disable levenshtein sorting when in dmenu mode.

Dmenu incompatibility

I also broke dmenu compatibly by added a shift-enter mode. This outputs the selected line, but redraws the menu with the next entry selected. This way a script can make the user select multiple items more efficiently. Clerk uses this.

UI

Several small (1 pixel) offsets and other issues where fixed. So the overall look should be a bit better.

No Documentation Can Be Better Then Some Documentation

| Comments

I like documentation, even though I am not very good creating it myself (and hate myself for it). But I try to do better with Rofi and generally it feels good once it is done. But in some cases, why did the developer even bother creating something?

This one especially annoyed me today, and would have been better with no documentation at all:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
FcNameParse(3)                                                                                        FcNameParse(3)

NAME
       FcNameParse - Parse a pattern string

SYNOPSIS
       #include <fontconfig/fontconfig.h>

       FcPattern * FcNameParse (const FcChar8 *name);

DESCRIPTION
       Converts name from the standard text format described above into a pattern.

VERSION
       Fontconfig version 2.11.0

                                                    11 10 2013                                      FcNameParse(3)

What explanation above? Is this a joke? So I entered the thing into a search engine and the first hit was this. Helpful the same bloody thing. Lets hit the up button, because that is above isn’t it? No description.

At that point, I was so annoyed, I gave up. Another day another shot at it.