Qball's Weblog

Beati pauperes spiritu

Netflix, Rofi and More

| Comments


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:

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

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.


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:

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:


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

echo empty; gen_workspaces

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

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.


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:

FcNameParse(3)                                                                                        FcNameParse(3)

       FcNameParse - Parse a pattern string

       #include <fontconfig/fontconfig.h>

       FcPattern * FcNameParse (const FcChar8 *name);

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

       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.

Rofi - Updates

| Comments

Although Rofi is in a good place and is mostly feature complete, I did manage to fix several small annoyances and added several new features. I will list the most important ones below. I hope to make a new release in the coming weeks. It would be nice if I could promote Rofi a bit more. If you have ideas for this, please let me know.

Pasting support

You can now paste the current clipboard (both primary as secondary) to the search entry box.

  • Insert or Ctrl-v: Pastes the primary clipboard.

  • Shift-Insert or Ctrl-Shift-v: Pastes the secondary clipboard.

Disabling History

On request it is now possible to disable the history function. People who use Rofi to enter a lot of manual commands might find this useful.

Levenshtein Distance Sorting

When you start typing to filter the list, initially the results where sorted alphabetically. I have added an option that allows you to sort it by Levenshtein distance. This should allow you to find your desired option more quickly.

Many small fixes

Several small sizing and drawing bugs have been fixed, making things look just that little bit better.


Every blog post needs atleast one image, so here we go.

Screenshot rofi popup mode

Ducky 2108 Under Linux

| Comments

Ducky DK2108 (Image from Mechanical Keyboards Holland)

I know I haven't blogged in a long time, yet I probably have enough things to talk about that
others might find interesting. Like Rofi search updates, notes.sh rewrite in C++, etc.
I will try to catch-up in the coming months. But for now my latest GmG.

After many years of typing on crappy keyboards and wearing them out in no-time at all, I decided to get a real keyboard again. I used to be a big fan of the old IBM Model-M keyboards and still mourn the day my stash got lost (they where nice ones with detachable cables and all). So I got a mechanical keyboard, the Ducky DK2108 with Blue Switches and the only thing I can say is: I should have done this years ago! The feel is lovely, the sound is heavenly and the overall typing experience is paradise.

However paradise never lasts, I noticed that when typing command lines I often noticed I wound up with this: some command |\ grep <keyword>.

This happens when I press shift \ and release the shift earlier then the \ key (for my feeling I release them at exactly the same time). After some fiddling around, I noticed that it only happens with N-Key Rollover enabled. After firing up xev and taking a closer look this is what I saw:

  • KeyPress: Shift
  • KeyPress: | (keycode 51)
  • KeyRelease | (keycode 51)
  • KeyRelease Shift
  • KeyPress: \ (keycode 51)
  • KeyRelease \ (keycode 51)

While I get without NKRO or old keyboard and would expect the following:

  • KeyPress: Shift
  • KeyPress: | (keycode 51)
  • KeyRelease Shift
  • KeyRelease \ (keycode 51)

First thinking my keyboard might be buggy, or there being a problem with NKRO anyway, I decided to try it on a windows box. Here it works as expected………

The whole problem is mostly academic, I really do not need N-Key Rollover, I do not play games, so it is very doubtful I will press more then 6 keys at the time. If (and that is a big if) I would play a game where I have to press more then 6 keys, I can enable NKRO without issues given it only goes wrong with the \. I would be very pleased if I could fix the issue, so if anybody has a clue on how to do this? Please let me know.

While typing this I got an E-mail from MKH with a firmware update (but no guarantees that it fixes it). So far the service of the shop has been very good, they where quick with sending the keyboard, it was well packaged (the original box in a 2nd box with wrapping) and there support response time is impressing (even in the weekend).

Rofi Now Has a Website

| Comments

Rofi now has an official website, this is a first step towards making a release.

Currently the following is left to do:

  • Extend command-line options to cover all options.
  • Update documentation.
  • Provide some configuration examples on the website.

The second point will take the most time, help is always welcome.

Some recent tweaks to Rofi include:

  • Abstract out history code that was duplicate between ssh/run dialog. This fixes a bug with loosing history.
  • Allow more fine-grain tweaking of window position, allowing it to behave like a dropdown.
  • Fix small font rendering issue.
  • When no result is matched, double-tab will switch to next dialog. Allowing for a more fluent work-flow.

The rofi website is made using Jekyll, and I do like it. It did not take a lot of effort to tweak the theme so it did what I wanted. It seems octopress is kinda dead (no release for years now), so maybe someday I will try to strip off the octopress part and just use jekyll directly.

Gnome 3 Application Under Not Gnome

| Comments

I do not use gnome anymore, haven’t for a reasonable time. I do however use some of the gnome 3 applications from time to time. These are mostly gedit for quick editing or as clipboard and evince. For some reason though, it seems to be harder and harder to run these applications without issues under !gnome3.

Today I opened up gedit, to quickly paste a small piece of text and this is how it looked:

Gedit under I3

First thought was ‘nice shadow’ how they do that, but when I looked closer it turned out I am getting a nice window in window. Below you see the red circle contains the window border, the green is the background with the shadow.

Gedit zoom

This is pretty ugly. I do not understand why both gnome 3 team and canonical thinks we no longer want window decorations or menu bars (GIVE ME BACK MY KEYBOARD (mnemonic ed) FRIENDLY MENU BARS), but ok, fine then not. At least try to make it work as expected outside of it and not these weird borders with shadow, this wastes space to give a shadow….

But this is not the worst screw up, in Evince they are doing the opposite and they ’re-use’ pixels. If I put evince full screen the top-bar and the search bar start overlapping.

Normal screen:

Gedit Normal


Gedit fullscreen

During daily use this is very frustrating.

Bonus Question

Find the bug in the pasted code in gedit. This is what GCC generates. Extra bonus point if you can spot the architecture.

Programmable DC Power Supply

| Comments

I recently bought another Digital Power supply, going for a more professional model this time. The biggest advantage is this one does not have a fan.

EA-PS 2042-06 B

So I decided to adjust my existing program HCS to also support this power supply. I tried to make a cleaner implementation then last time. It is not as good as I want it to be, but a start. So do you have a Elektro Automatik PS 2042-06 B or a Voltcraft PPS-11360 you can control them using this tool.


Set output voltage

$ HCS_DEVICE=/dev/ttyACM0 ./build/hcs eaps voltage 6 

Read output volage

$ HCS_DEVICE=/dev/ttyACM0 ./build/hcs eaps voltage 
> 5.94

Read output current

$ HCS_DEVICE=/dev/ttyACM0 ./build/hcs eaps current 
> 1.03

Read device status

$ HCS_DEVICE=/dev/ttyACM0 ./build/hcs eaps status 
    Device information:
     Device Type:               PS 2042-06B
     Manufacturer:                       EA
     Article No. :                 39200112
     Serial Num.:                3937461928
     Software Version:   V4.02 05.12.2012»

    Device specifications:
     Nominal voltage:                 42.00
     Nominal current:                  6.00
     Nominal power:                  100.00
     Set voltage:                     12.00
     Set current:                      0.95
     Current voltage:                  0.00
     Current current:                  0.00

There is also an interactive mode.


  • Update the documentation soon, currently it is lacking.
  • Make a more consistent output.
  • Fix command line parsing, so commands can be concatenated.



| Comments

A small post with some updates. I know I have been very bad at blogging lately, luckily nobody reads this anyway.

RIP SimpleSwitcher, long live Rofi

To avoid confusion with the original simpleswitcher I decided to rename it. After getting no useful suggestions and forgetting even more. I decided on ‘Rofi’, it is Icelandic for ‘switch’ or ‘switcher’. Mostly it is nice, short and unused.


Not a lot changed since the last blog post, given it is already perfect(ish):

  • Support for configuring rofi using X server resources.
  • Displaying UTF-8 strings.

UDOO Quad, second attempt at low power always on desktop.

Hearing that the Freescale i.MX6 are well supported and have well working X drivers (Vivante), I decided to get one. There are many interesting on the market, but this one is combined with a Arduino DUE allowing for some creative projects.


  1. Freescale i.MX 6 ARM Cortex-A9 CPU Quad core 1GHz
  2. Integrated graphics, each processor provides 3 separated accelerators for 2D, OpenGL® ES2.0 3D and OpenVG™
  3. Atmel SAM3X8E ARM Cortex-M3 CPU (same as Arduino Due)
  4. RAM DDR3 1GB
  5. 76 fully available GPIO
  6. Arduino-compatible R3 1.0 pinout
  7. HDMI and LVDS + Touch (I2C signals)
  8. Ethernet RJ45 (10/100/1000 MBit)
  9. WiFi Module
  10. Mini USB and Mini USB OTG
  11. USB type A (x2) and USB connector (requires a specific wire)
  12. Analog Audio and Mic
  13. SATA (Only Quad-Core version)
  14. Camera connection
  15. Micro SD (boot device)
  16. Power Supply 12V and External Battery connector

The choice of hooking up the GPIO pins of the Cortex-M3 and the Freescale to the same output pins without any protection is a bit odd. While it probably makes things a lot easier, it does require to take extra care, so you do not connect two outputs.


So far things are working well, still playing to find the most useful distribution to run on it. The Ubuntu 12.04 it ships with is decent enough, but has a few annoying kernel bugs, on Archlinux I got stuck with X11. Now I am currently using a community debian image, with self-compiled u-boot and kernel. I gave the board a 120GB samsung EVO SSD that is connected up via SATA. This is a welcome performance boost I was always missing on other boards, combine this with gigabit Ethernet it is a speedy little machine.

Currently I have it runnig idle at 3.5W power consumption, this is not bad but I am sure I can probably get it down to 2.5-3W (from the Wall socket). This should be low enough to keep it running, given it is powered by 12V I can have it running from the 5V/12V power line I have that feeds more arm boards, powered USB hubs and dimmable LED strips. This should be even more efficient.

Other stuff:

I will reserve the rest for more blog posts.