Unresolved: <Ctrl>Tab for gnome-terminal

by jenny on 13 March 2008 - 08:08pm in

Firefox uses <Ctrl>Tab and <Ctrl><Shift>Tab for switching between tabs. Eclipse at least lets you assign these same keybindings to its tabs. Wouldn't it be nice if gnome-terminal would allow the same thing? No such luck.

The symptom, as described by Daniel DiPaolo:

Whenever I try and assign ctrl-tab or ctrl-shift-tab to any of the keybindings (tested: File/New Profile, View/Full screen), neither one takes. I click on where it says "Disabled", it prompts for the new accelerator, and when I hit ctrl-tab or ctrl-shift-tab it goes right back to "Disabled". In fact, doing this on an already set keybinding will unbind it to "Disabled".

That's the problem, sure enough.

Here's the information I've found on this subject:

Need to document?? Need to change, more like it.

The official response:

There are a couple of keys which are not candidates to be keyboard accelerators, independently of the modifiers. Tab is one of those keys, as it (with various combinations of modifiers) are reserved by gtk for its own use and the window manager.

Note that validity is decided by calling gtk_accelerator_valid, but the list of valid accelerator keys seems to be only in the source...

...so here's the hacking I tried to do:

  • Run gconf-editor
  • Find the settings /apps/gnome-terminal/keybindings/next_tab and /apps/gnome-terminal/keybindings/prev_tab
  • Following the example for using the Tab key from /apps/metacity/global_keybindings/switch_windows, set the value of next_tab to <Ctrl>Tab
  • Open a new gnome-terminal and go to the Keyboard Shortcuts dialog
  • Notice that the value for Switch to Next Tab has, indeed, been changed to <Control>Tab -- it even expanded "Ctrl" to the nice user-friendly word "Control" -- that's a good sign that it parsed the value correctly
  • Notice that it did NOT, however, actually change the keybinding *sigh*

Next I tried some googling to figure out how to override this ridiculous 'gtk_accelerator_valid' setting, to no avail. There is a ~/.gtkrc file, but I couldn't find any useful information concerning that, either.

If anyone is interested, here's a link to the offending gtkaccelgroup.c. The link is broken in the gnome bug because they switched from cvs to svn since then. The offending function signature: gboolean gtk_accelerator_valid (guint keyval, GdkModifierType modifiers), and (I believe) the offending array: static const guint invalid_accelerator_vals[]. Of course, everything under the sun seems to be listed in there, so I'm not sure what's up with that.

If anyone has figured out how to hack this (preferably without recompiling gtk, but at this point I'd almost consider it), please let me know!!!

use xfterm4 instead of gnome-terminal

I ran into the same annoying problem - even tried to modify the gnome-terminal source code itself, but
then found xfterm4 - it's very similar to gnome-terminal, and you can modify the accelerators!

They are stored under: .config/Terminal/terminalrc

this is exactly why I HATE Gnome!

GNOME Developers: for you information:

=======================

I don't use Gnome, I use Fvwm! far superior! I just want to use gnome-terminal stand-alone!

Thank you for wasting everybody's time!

=======================

I just wasted one hour trying to get the keyboard shortcuts changed,
including hacking the %gconf.xml file -- it just *SILENTLY* did not take the values from the %gconf.file.

This is a good example of extremely poor programming style -- not giving a warning or an error, but just
silently overriding what the user wants.

DO NOT MAKE ASSUMPTIONS WHAT KEYBOARD SHORTCUTS THE USER WANTS TO USE!
LET THE USER CHOSE - if you don't like this idea, you should go work for Apple!

Apple shortcuts

Actually, Apple does let you change the shortcuts for their terminal to use Ctrl-Tab and Ctrl-Shift-Tab. It's super easy too. It's a shame that gnome-terminal doesn't.