Archive for the 'Software' Category

How to set the urgency hint for new mail in Thunderbird

Some window managers, including i3wm, the one I use at the moment, highlight windows and desktop tabs when the window or one of it’s children sets the X urgency hint. irssi, for example, supports that, allowing for nice and silent notifications when somebody querys or mentions you. However, even after hours of googeling, I couldn’t find any way to make Thunderbird set this flag when new mail arrives. This is why I came up with my own solution. I wrote a python script that finds the Thunderbird window and set’s the urgency hint using the python-xlib (which you would have to install yourself!) bindings. I then installed the Thunderbird extension Mailbox Alert, that allows you to specify scripts to be executed when new mail arrives – even on a per-folder basis. (The extension is pretty awesome, you should definitely check it out!) With that, everything works perfectly now.

The script setting the urgency hint is pretty basic. Here it is:

#!/usr/bin/python2

from Xlib import X, display, Xutil

def find_window(name, w):
    for win in w.query_tree().children:
        if win.get_wm_class() and win.get_wm_class()[1] == name:
            return win
       
        if len(win.query_tree().children) > 0:
            a = find_window(name, win)
            if a:
                return a

def main(disp):
    win = find_window("Thunderbird", disp.screen().root)
    hints = win.get_wm_hints() or { 'flags': 0 }
    hints['flags'] |= Xutil.UrgencyHint

    win.set_wm_hints(hints)
    disp.flush()
   
if __name__ == '__main__':
    main(display.Display())

Using a virtual machine as local development webserver

I like my linux to be as clean as possible and therefore hate packages with gazillions of dependencies, that I may only need once.  I tend to forget about these packages and they are then sitting there, eating precious SSD space (where my root system is located). Especially when it comes to webdevelopment, webservers etc. this bugs me a lot, since a working LAMP server together with Python and all the extensions I need takes up a lot of space, config files in /etc and consists of many packages. This is why I recently switched to a virtual machine as development server. The advantages are the following:

  • I can separate all the webserver and scripting language stuff from my root filesystem
  • It is portable
  • I can use a distribution similar to the one running on my (real) webserver, which makes deployment easier.
  • It works (nearly) exactly as if I used the main filesystem, since today’s computers are powerful and memory big enough.

I will outline briefly what I did:
Continue reading ‘Using a virtual machine as local development webserver’

Openbox pipemenu to control virtual machines of VirtualBox

Openbox, Virtualbox… Coincidence? I don’t know. Anyway, I am a huge fan of VirtualBox, for the virtual machines are extremely fast, stable and nice to control. With the command line tool VBoxManage comes a nice tool for all those CLI-lovers out there. You can literally do anything with it, what the GUI can do. (at least it looks like that)

Now, starting the GUI to start a VM is a bit slow, so VBoxManage startvm "vm" is a huge time- and memorysaver.
Since I work with Openbox, the natural thing for me was to google for a suitable pipemenu. Unfortunately, I couldn’t find one. Long story short: Here is my self-written Openbox pipemenu to control VirtualBox’s VMs. (It can start and stop them, at least.)
Continue reading ‘Openbox pipemenu to control virtual machines of VirtualBox’

My new emacs setup (no .emacs here, don’t worry)

After having used emacs for a couple of months now, I discovered the emacs --daemon option today and was astonished. Having quite a big emacs config, it takes ages for emacs to start preventing me from using it as the standard editor for config files etc. The --daemon mode starts emacs in the background acting as a server and allows one to create emacs frames using the emacsclient in various ways. EMacs shows up lightning-fast then and becomes an option for the always-to-use text editor.


Continue reading ‘My new emacs setup (no .emacs here, don’t worry)’

How to make ReMoot work with mpd

Heya, I was struggling with ReMoot commands not having effect on the MPD (music player daemon), which is a nifty tool I discovered yesterday. Anyway, even though ReMoot lists this software as supported on it’s website, nothing happened when I executed “remoot playpause” or something like that.

The reason is that ReMoot only looks for programs that belong to the current user, while the mpd most of the times has it’s own user. (At least that is what’s proposed for example here)

To get ReMoot running with mpd you have to do the following two things:

  • ReMoot uses mpc to interface with mpd, so make sure it is installed!
  • edit /usr/bin/daemoot (or whereever it may be) and change line 470 (version 0.9 of ReMoot) to my @apps = `ps -L -u $ENV{USER},mpd -o comm,lwp`; where, of course, mpd has to be the user the mpd runs under.

That should be it. Have fun!