contact
----------------------------

Blog <-

Archive for the ‘gnome’ Category

RSS   RSS feed for this category

gCountDown v1.0: Systray countdown timer for Linux

I've released v1.0 of the gCountDown program.

gCountDown is a very simple alarm countdown timer. It sits in your system tray where you can click it to set an alarm. Once the time runs out, you will be alerted.

This release adds the ability to play a sound when an alarm goes off pops up a menu on right-clicking the icon so you can quit the application and has some minor bugfixes. A Debian/Ubuntu package is now also available.

GNOME/GTK hack: Smaller icon sizes

Icons are freaking huge in Gnome. Since I'm not blind, I'd like them a bit smaller. Unfortunately, GNOME doesn't seem to offer an easy way to do this.

There's the desktop/gnome/interface/toolbar_icon_size in the gconf-editor, but it doesn't appear to do anything, so that's not really gonna work. Besides, I have no idea what I should set the integer too. Fortunately, we can tweak everything using GTK's Resource files. The nice thing about this is that it works for all GTK 2.0 apps as well as Gnome apps.

Create a file .gtkrc-2.0 in your homedir, and put the following in it:

gtk-toolbar-icon-size=small-toolbar

That makes the toolbar buttons smaller, though not by much. You may not even notice it. Try starting some GNOME program with a toolbar (gedit is a good one; don't use the File Browser (Nautilus) because it's already loaded) to see if it's satisfactory. If it's not small enough for you, you can tweak it even further. Just add the following to the same file:

gtk-icon-sizes="gtk-small-toolbar=16,16"

That will make icons 16 by 16 pixels. Small enough for my tastes.

You can modify more than just the toolbar icons:

gtk-icon-sizes="\\
    gtk-menu=16,16:\\
    gtk-button=16,16:\\
    gtk-small-toolbar=16,16:\\
    gtk-large-toolbar=16,16:\\
    gtk-dnd=16,16:\\
    panel-menu=16,16:\\
    panel=16,16:\\
    gtk-dialog=16,16\\
"

You'll have to figure out for yourself what they do though. Most should be obvious. Some don't work anymore in newer gnome versions.

Changes you've made won't affect Nautilus (the file browser, the desktop and everything else powered by Nautilus) until you restart Gnome. Maybe you could killall -HUP nautilus, but I didn't dare try that.

Gnome/Metacity keybindings and other customizations

I never really liked Gnome because I couldn't make Metacity act the way I like it.

I'm used to WindowMaker, and it has very configurable keybindings for managing windows. For instance, it's quite easy to map a keybinding like <Control><Alt>-; to an action that maximizes the currently focussed window horizontally. Another keybinding maximizes the window vertically. These are very useful options for me, since I use terminal windows a lot.

Another annoying thing about Gnome/Metacity was that you could have a keybinding which maximized the currently focussed window, but pressing that keybinding again wouldn't bring the window back to the original size. This is another feature is use all the time, because I often need to have more screen real estate for my terminal window for a short while (so that I can see more of the terminal output buffer).

Something else I missed from WindowMaker is binding keybindings to programs in the menu so that, say, <Win>-e opened my editor. This didn't seem possible in Gnome/Metacity, and I didn't want to use a third-party application for it, because that doesn't integrate nicely with Gnome (and will therefore cause strange behaviour, such as conflicting keybindings in applications).

In the past, I've given Gnome a couple of tries, but everytime I switched back to WindowMaker after a little while because of the lack of proper keybindings. A couple of days ago I decided to give Gnome another try, because I'm planning on installing Ubuntu (currently running Debian GNU/Linux) somewhere in the near future. Quite by accident, I stumbled upon the fact that Gnome/Metacity does support all the keybindings I'm used to. All you have to do is dive into the GConf registry a bit.

Window manipulations

Here are the various locations for Window manipulations in the Gnome registry and their purposes. To edit these, you'll have to have the gconf-editor installed.

  • /apps/metacity/window_keybindings/maximize
    Maximize the window. Disable this setting because it doesn't "toggle" the maximization state, it only maximizes the window. Just edit the value and enter 'disabled' as the value.
  • /apps/metacity/window_keybindings/maximize_horizontally
    Maximize the window horizontally. (make it as wide as the screen while keeping the same height)
  • /apps/metacity/window_keybindings/maximize_vertically
    Maximize the window vertically. (make it as high as the screen while keeping the same width)
  • /apps/metacity/window_keybindings/toggle_maximized
    Maximize the window on the first keypress. Unmaximize it on the next keypress.
  • /apps/metacity/window_keybindings/toggle_shaded
    Roll up the window so that only the title bar is visible. This is handy for quickly peaking under the currently focussed window.

You can edit these bindings by right-clicking on the key and selecting 'Edit key'. For the value, you'll have to type out the full keybinding name. For instance: "<Control><Alt>r" (without the quotes). Take a look at the already defined keybindings for hints.

Global command-running keybindings

After finding out about the above configuration options for Metacity, I took a closer look at other options, and it turns out you can also bind global keybindings to programs so you can have shortcuts. Just press the keybinding and the program starts. I'm using this mostly for the top-10 applications I use: browser, editor, terminal emulator and some other stuff. Here's how to add keybindings to programs:

  1. In gconf-editor, find the key /apps/metacity/keybinding_commands/. Here, you'll see a list of 'command_NR' key/value pairs.
  2. Edit the value for one of the command_NR keys, and enter the name of the program you want to run when pressing some keybinding. For instance: /usr/bin/gvim
  3. Now, go to /apps/metacity/global_keybindings/. Here, you'll see a list of keys with names similar to run_command_NR.
  4. Edit the value for the key with the name corresponding to the key you edited in step 2. Enter your keybinding in the same way as mentioned above.

Using the Windows key for bindings

Perhaps it's not the same on every system, but I couldn't use the Windows key (left of the left Alt key) for keybindings. When I tried binding commands to it in Gnome's Keyboard Shortcuts manager, all I got was an 'Super_L' entry, and I couldn't enter any extra modifiers (such as <Super>e, to run my Editor). Turns out you have to change the behaviour of the Win key so that it registers as a normal modifier key (similar to Shift, Control, etc) in X.org. Here's how to do that:

  1. Open the Keyboard manager. On my system, it's the System → Preferences → Keyboard menu-option.
  2. Open the Layout options tab.
  3. Open the Alt/Win key behavior fold-out.
  4. Choose the Meta is mapped to the left Win-key option.
  5. Now, Meta is a code-name for one of the modifier-keys. Each modifier key (Shift, Alt, Control, etc) has a codename. But internally, X.org doesn't use these codenames. Instead, it used different names: Mod1 through Mod5. And apparently it differs from system to system to which Mod-X internal name the Meta modifier is mapped. So in order to find out which Mod-X you'll need to use when specifying keybindings, you can use the Gnome Keyboard Shortcuts manager.
  6. Open the Gnome Keyboard Shortcuts manager. (System → Preferences → Keyboard shortcuts)
  7. Click on of the options, and press the Win key with some other key. This will appear in the manager as: l, for instance. You now know that you need to use Mod4 if you want to bind commands or other things to the Win key when using the GConf-editor tool.

Move/resize Windows with a modifier key

WindowMaker's got this option that allows you to move and resize windows by simply holding the Alt key and then drag-and-drop anywhere in the window to resize or move it. So, if I hold the Alt key, and press and drag anywhere in the window with the left mouse-button, I can move the window. If I hold the Alt key and press and drag with the right button, I can resize the window. This is so much more comfortable than having to go al the way to the edge of the window in order to drag it.

I don't know how long Gnome/Metacity's been supporting this, but as far as I know, it didn't the last time I tried it. It does now. I'm not sure if you need to turn it on explicitly, but here's how it's set up on my system:

In the menu, choose System → Preferences → Windows. Here, under 'Movement key', choose the 'Alt' key. You can now move windows by holding Alt and then use the left mouse-button to move the window. Holding Alt and dragging with the middle mouse-button in the window resizes the window. It's a little annoying that you can't resize windows when it's maximized (either fully, horizontally or vertically), but I guess I'll get used to that. Or maybe I overlooked an option in the GConf-editor again... lemme check.. Nope, doesn't look like it.

Standard window options

Something that's completely unsupported by Metacity is automatically setting window options on windows when they start. WindowMaker has a facility that allows you to set options for windows as soon as they are opened. This way, you can force a window to be maximized or minimized as soon as it opens, even if the program itself doesn't support this. Metacity can't do that, but there's a third-party application that takes care of that: Devil's Pie.

Application run dialog

By default, Gnome has an Application Run dialog, but it's not very good. It doesn't do a good job at completing the name of programs I want to run. I want tab-completion. Fortunately, I wrote GExec a while ago. I've hooked it up to the <Win>r keybinding as described in the 'Global command-running keybindings' section in this post.

Result

I now have the following keybindings set for Gnome/Metacity:

Control-Alt-h Switch to the workspace on the left. Vim-style.
Control-Alt-l Switch to the workspace on the right. Vim-style.
Control-Alt-j Minimize the current window.
Control-Alt-k Maximize/Unmaximize the current window.
Control-Alt-- Shade/Unshade the current window.
Control-Alt-; Horizontally maximize/unmaximize the current window.
Control-Alt-' Vertically maximize/unmaximize the current window.
Control-Alt-1 Jump to workspace 1.
Control-Alt-9 Jump to workspace 9.
Win-e Start my editor (gvim).
Win-b Start my browser (Iceweasel / Firefox).
Win-x Start my terminal emulator. (gnome-terminal)
Win-r Start my application launcher (gexec).

With the customizations described above, I feel Gnome is probably much more usable for me. I hope to switch to Ubuntu shortly. For the curious among you, this is how my desktop looks now:

gnome.png.

And this is what it used to look like:

dt_blood.jpg

Update: I forgot to mention. If you want to bind keybindings to stuff like <Control><Alt>-; , you need to enter <Control><Alt>Semicolon. Use the Gnome keyboard shortcut manager to find out the proper keybinding to enter in gconf.

Update II: These customizations work for Metacity 2.14.5. Your mileage may vary for other versions.

Update III: Also check out the Emacs keybindings 'theme'. It lets you use Emacs-like keybindings in Gnome so that you can press Ctrl-u to erase everything in front of the cursor on the current line and/or use Ctrl-y to insert back what you just erased ('yanking'). Edit the GConf key /desktop/gnome/interface/gtk_key_theme and set it to the 'Emacs' value. If you're only using GTK and not Gnome, you can add a line with:

gtk-key-theme-name = "Emacs"

to a .gtkrc-2.0 file in your home directory to get the same effect.

Futile defending of spatial Nautilus

OSNews.com is carrying an oppinion article by Radoslaw Sokol about why people blame spatial Nautilius.

For those of you that don't know what spatial Nautilius is: It's the feature of Nautilius (the file browser) which causes every folder you click to be opened in a new window. It's the most hated feature of the new Nautilius and almost surpasses the horror that was Clippy in Microsoft Office. Radoslaw states that the fact that navigating in spatial mode blows is because users don't understand how they should organize their folders and files. According to him you shouldn't use deep-nested folders to store files because then spatial mode will indeed be ghastly.

I find it funny that both the gnome team and Radoslaw are defending an idea which everybody hates. According to the article, spatial mode is the best way to go since it most closely resembles the desktop metaphore. First of all I disagree with that statement completely. When I browse nested folders inside some other folder in real life, I don't retrieve each folder from it's parent, put it on my desktop and start searching in that folder all over again. I usually just open the folder when it's still inside the other folder.

But that's rather besides the point. The point is that clinging to the desktop metaphor no matter what is ludicrouse. We need to transcend these kinds of usages of computers because otherwise we might just as well throw our PCs out of the windows and start using the real life desktop anyway, right?. A computer should be easier to use than the real desktop.

One of his statements is the following:
"What is the real cause of all these attacks on the spatial Nautilius? In my opinion, it is just bad file organisation coupled with a bunch of old bad habits. It's really hard to use a spatial file browser if someone keeps his or her files in a ten-folder-deep structure. Browser-mode file browsers hide the lack of thought and organisation in the filesystem structure; spatial ones do not."

Nonsense. Spatial browsers hide the organisation just as much because if screen clutter and a lack of overview. The solution to this is a tree-view, not spatial mode browsing.

"Folder structure should be simple and as shallow as possible, and the "master" folders (something like My Images or My Music folders known from Windows)…."

Of course folder structures should be simple and shallow. But the fact is that most of the time, it can't be. Folders are, for now, the only way through which we can organise our files. We need to keep things structured. For instance, check out this folder on my system: /storage/sound/mp3/Type O Negative/Life is Killing Me. I've got more than one type of sound file. I've also got more than one band's music. Unless I don't care about having all my sounds in one huge directory, there isn't another way in which I can store these files. But navigating to a MP3 in the above folder will open a massive 6 windows on my desktop. Talk about screenclutter.

Next, Radoslaw goes on with this statement:
"one can click one field in the gconf configuration editor and turn Nautilitus into "classical" non-spatial file browser. Don't know how to use gconf? Then you shouldn't change the way Nautilitus works, I presume."

Ouch, Radoslaw! You working for Microsoft or something? I always thought that usability came first? Now you're telling me that we need to screw around with obscure old gconf in order to make up for the mistakes of the gnome dev team? No, no, no! All wrong! This is a commonly needed option so it should be available in the nautilus configuration.

"Don't know how to use gconf? Then you shouldn't change the way Nautilitus works, I presume."

Wrong again! Don't know how to use gconf in order to make nautilius into a useful file browser? Then just don't use Nautilius, I presume. NEVER EVER tell users to go screw themselves because of somebody else's mistakes. Users won't take it.

Look, it all boils down to this: Users hate it. It doesn't matter what you may think you know about metaphors, usability and organised folders. If the users hate it, the forced 'feature' should be removed, or you're users will stop using your application. Simple as that.

By the way, I don't use Nautilius at all. I hate it. It's too slow and it makes me feel as of it's made for morons. It's not configurable, nor is it power-userfriendly.