GTK+ Secrets

In the last week or so I've discovered a couple of GTK+ tricks I didn't know, so I thought I'd share them.

  1. Control-Backspace in an entry deletes from the cursor to the beginning of the text. I had previously hacked up custom binding for Control-u, but this is bound by default. Thanks Emmanuele for pointing this out. Update: as proof that my fingers are still using C-u, Control-Backspace actually deletes a word and not the entire entry.
  2. Middle-clicking on a scroll bar will move directly to that point, instead of moving towards that point by a page. Very useful, I'm glad Mitch mentioned this in a bug.

NP: Didn't It Rain, Songs:Ohia

13:11 Wednesday, 21 Mar 2007 [#] [computers] (12 comments)

Posted by Nicholas Telford at Wed Mar 21 14:03:04 2007:
I've always found the Ctrl+Backspace extremely annoying. Coming from a Windows background I'm always expecting it to delete the previous word (i.e. back to a word separation token). It's nice to have, but I wish they'd chosen a different binding and kept the (traditional) functionality.
Posted by Sam Morris at Wed Mar 21 14:33:39 2007:
Ctrl+Backspace does delete a single word at a time for me.

Now if only I could get readline to recognise the keybinding! Unfortunately it seems oblivious to the Control key, no matter what I put in my .inputrc.
Posted by Peter Van den Bosch at Wed Mar 21 14:42:41 2007:
thanks for mentioning the second 'secret', didn't now that yet

some tips related to the first one: ctrl+delete also works, and ctrl+arrow_key navigates between words
Posted by Henrik at Wed Mar 21 14:58:20 2007:
In what UI paradigm does Control-u kill input?  Hell, even emacs kills input with Control-Backspace.
Posted by Ross at Wed Mar 21 15:00:18 2007:
Henrik: erm, emacs.  And readline.  Emacs will only kill on control-backspace if you have pending-delete (or is it pc-select-mode) enabled.
Posted by Gavin at Wed Mar 21 15:15:23 2007:
Ah, cool. So where can I turn on vi mode?
Posted by Luke at Wed Mar 21 17:01:20 2007:
Ctrl+Delete will also delete a word to the right of the cursor.
Posted by Dan at Wed Mar 21 18:23:38 2007:
I've just learned to use the Windows bindings when typing in entries and textviews, because they work the same on Linux, Windows, and Macs. So I'd type Shift+Home to select from the current position to the start of the line, and then Backspace to delete that selection. (After a while you don't even notice it's multiple keystrokes.)
Posted by Juri Pakaste at Wed Mar 21 20:12:41 2007:
Ctrl+Backspace is a real favorite if you don't have DontZap or whatever it's called enabled in the X server. Leave Alt pressed for a bit too long...
Posted by thebluesgnr at Wed Mar 21 20:17:54 2007:
Just a little info about the second thing: it was the default behaviour on NeXTSTEP for a left click, which is probably why GTK+ supports it with a middle-click.
Posted by zerblat at Thu Mar 22 06:26:38 2007:
I think the reason for instant scroll with middle-click in GTK is that that is how the Athena scrollbars worked: http://www.complang.tuwien.ac.at/anton/athena-scrollbars.html

I think pretty much every X toolkit since then has had that feature, including Motif, tk (iirc).

It's also pretty much the only thing I use scrollbars for -- scrollwheels are so much faster than hunting down those little arrows on scrollbars.
Posted by MamiyaOtaru at Thu Mar 22 07:53:06 2007:
Aye, Qt does it as well (middle click on scrollbars).  It also does ctrl-backspace.  I hadn't known about either beforehand though.  Maybe your entry would be better titled 'Secrets of X toolkits' ;)

Name:


E-mail:


URL:


Add 8 and 3 (required):


Comment: