Meet GMenu, Sibling of DMenu

I have been using wmii for quite some time now and right now can’t think of ever using a non tiling window manager ever again. Before wmii I tried dwm but didn’t quite like it as much as wmii.

But what I liked most about dwm and wmii is their “application launchers”: wimenu and dmenu. Actually they’re not really application launchers. All they really do, is read a list of items from STDIN and pop up a window where you can search and select the item you want. This (or whatever you typed) is then printed on STDOUT. It’s really trivial to create an application launching utility from these, basically just pipe ls /usr/bin to one of them, and then execute the resulting string. And did I mention they are both fast? Well, they are!

But they are also limited in ways I didn’t like. Wimenu displays it’s window either at the top edge or the bottom edge of the screen, and it displays the items in a horizontal list. Dmenu is similar, though it can display the items vertically, it will still span the whole screen width. I find horizontal lists hard to read, I prefer vertical lists. And while Dmenu can satisfy that, I would still prefer the window to be centered on the screen, a region I look at most of the time.

I spend some time reading the code of wimenu and dmenu, considering hacking them. But in the end, I decided against it. Both are written in plain C, no toolkit used, just basic Xlib. For the features I wanted to add, it was clear to me I would spend quite a bit of time implementing half a gui toolkit before I could even get to coding my desired features. And that’s when I decided to use GTK for my application, and hence I called it gmenu (as unimaginative as that is.)

You can check out gmenu at github.

Unbind/Rebind Ctrl+D in Gedit

After quite some googleing and experimenting I finally managed to change the behavior of Gedit and that annoying Ctrl+D shortcut. By default, pressing Ctrl+D deletes a line… very useful, I’m deleting lines all the time :roll-eyes:

To change this to something much more useful – like cutting the line and putting it into the clipboard – put the following into your ~/.gtkrc-2.0:

binding "override-ctrl-d" {
    bind "<ctrl>d" {
        "move-cursor" (display-line-ends, -1, 0)
        "move-cursor" (display-lines, 1, 1)
        "cut-clipboard" ()
    }
}
class "GeditView" binding :highest "override-ctrl-d"

To completely disable Ctrl+D, use the following instead:

binding "override-ctrl-d" {
    unbind "<ctrl>d"
}
class "GeditView" binding :highest "override-ctrl-d"

The important bit about these snippets is really just “class "GeditView" .... Now I just need to figure out how to remove the next useless key binding Ctrl+Shift+U…