2

I would like to rebind next/previous tab shortcut in XFCE's Terminal from Ctrl+PgDn/PgUp to Ctrl+Tab/Ctrl+Shift+Tab. It doesn't seem to work either by editing accels.scm or changing the shortcut interactively by hovering over the menu and pressing the desired key combo.

Other keys work fine for this, it's just shortcuts that involve Tab that are a problem. I assume these are special to GTK and don't even reach the application. Is there a way to override this?

3 Answers 3

2

You can't use Tab key for shortcuts, at least in Xfce Terminal.

Direct answers

[...] it's just shortcuts that involve Tab that are a problem. I assume these are special to GTK and don't even reach the application.

Your assumption is correct. The limitation actually applies to GTK+ application programs and Xfce Terminal is one of them. And it's not just shortcuts that involve Tab key, but also few other keys i.e. PageUp, PageDown, F10 that cannot be used individually (without modifier key).

Is there a way to override this?

Likely no, although workaround may exist. A better way is to look for alternatives to Tab key, or use other application programs that allows it. See also the following explanations.

Explained by contributors

First, there is dated bug 3524 that reported "Next/previous tab keyboard shortcuts does nothing". The most relevant comment has been quoted below.

[Comment 9: Nick Schermer 2009-10-10 13:49:08 CEST]

Xfwm and terminal use a different way if handling accelerators (xfwm directly from x, terminal relies on gtk). is in gtk handled as an invalid accelerator, so to 'fix' this terminal will check if the accelerator is valid before setting it. As a result pressing will do nothing in the shortcuts editor from now on.

Second, there is dated post on Stack Overflow that asked "PyGTK: Allow usage of Tab in AccelGroup". Relevant part of question has been quoted below.

When using gtk.AccelGroup any combination with Tab charater is invalid. Now I do understand that UI navigation is done using this key [...]

Explained by documentation

Regarding "UI navigation is done using this key", GNOME Developer documentation has noted the matter in topic of Keyboard input as quoted below.

Keyboard navigation

[...] Tab is the standard key for moving around an interface with GTK+ and GNOME.

Additionally, shortcuts that use Tab key have dedicated functions.

Standard navigation keys

Tab and Shift+Tab Moves keyboard focus to the next/previous control

Ctrl+Tab and Shift+Ctrl+Tab Moves keyboard focus out of the enclosing widget to the next/previous control, in those situations where Tab alone has another function

Ctrl+Tab and Shift+Ctrl+Tab Moves keyboard focus to the next/previous group of controls

So earlier comments make sense now.

Revised answer (2017-04-04)

Despite Tab key is recognized as ^I in the command-line shell for tab completion, it has least relevance with inability to use Tab key as shortcut in graphical application programs.

Why Tab key cannot be used as a shortcut? The reason was simple: Tab key and its combination keys are reserved by GTK+ and GNOME.

Despite GNOME Terminal via GSettings allows to use Tab key for shortcuts, there is no equivalent hack for Xfce Terminal via Xfconf to this answered date.

6
  • 1
    Yes, Tab is interpreted by the shell, but that your lengthy explanation doesn't address my question: why can't Ctrl+Tab be used as a shortcut? Mar 29, 2017 at 20:58
  • Looks like I didn't fully comprehend the question. So this may be Xfce or GTK+ specific issue. Need to research further before revising the answer.
    – user109256
    Mar 30, 2017 at 16:56
  • Revised my answer. While the reason was simple, I couldn't find any straightforward answer. I had to quote text from several sources, which makes my answer lengthy anyway.
    – user109256
    Apr 1, 2017 at 18:06
  • Thank you for the update: you are right, it's the GTK that reserves the Tab combo in accelerators, so the apps can't use it without tricks (like Pidgin does): bugzilla.gnome.org/show_bug.cgi?id=123994. Apr 4, 2017 at 6:08
  • 1
    Also, someone figured out a workaround with gnome-terminal using "<Primary>Tab" and "<Primary><Shift>Tab": bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/162000/…. Could something like that be used in xfce-terminal too, I wonder? Apr 4, 2017 at 6:10
2

I bind "Tab" short keys using utility autokey For example using Tab for switching between right and left panel in Nemo file commander.

Linux Mint 20 Nemo 4.6.5

Should be set in AutoKey to: Hotkey: Window Filter: nemo

----- Script example ---# Bind Tab key to switch panel (F6 key)

keyboard.send_key("<f6>")
time.sleep(0.1)
keyboard.send_key("Tab")
0

This works in xfce4-terminal 0.8.9.1 (Xfce 4.14) - edit .config/xfce4/terminal/accels.scm

(gtk_accel_path "<Actions>/terminal-window/next-tab" "<Primary>Tab")
(gtk_accel_path "<Actions>/terminal-window/prev-tab" "<Primary><Shift>Tab")
1
  • Thank you very much this answer @galatians, because it seems like it solves my problem. Unfortunately, I upgraded the laptop on which I ran Xfce to a regular Ubuntu and don't have a system to actually try it out. I'll set up a VM when I get a chance and if it works there, I'll accept it as the answer. Mar 22, 2021 at 13:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .