4

How can one set a keyboard shortcut for an instance of xfce4-terminal? It appears that the Terminal->Set Title menu does not have a shortcut tooltip, and I would really like to keep my open terminals organized.

Addendum: if this is not possible within xfce4-terminal itself, maybe there is a way to do this using an OS shortcut? I am using OpenSuSe 13.2.

3 Answers 3

4

You can "always" set the terminal title from the command-line, since XFCE4 Terminal uses VTE, which supports the corresponding xterm title escape sequence. A simple script like this would work (setting both title and icon name):

#!/bin/sh
printf '\033]0;%s\007' "$*"

OpenSUSE also has xtermset available; it sets title or icon, e.g.,

xtermset -T "my title"

I just checked, to see that the title can be set independently on each tab (though ultimately this is a feature of VTE and can be broken by upgrades if the GNOME developers decide to deprecate it further).

However, if you are using bash, its default setting for PS1 makes it modify the title, and your changes would be lost.

Further reading:

1
  • The printf variant does not work for me.
    – shevy
    Oct 23, 2020 at 15:02
2

Hover over menu item and press desired keyboard combination. To remove one, hover and press Backspace. If it doesn't work, see the FAQ for pointers how to enable GTK+ shortcuts changing for you may not have it enabled. Attached screenshot from the FAQ as well.

From http://docs.xfce.org/faq, quoting here for your convenience:

A number of Xfce applications (Xfce Terminal and Thunar for example) support the standard GTK+ way of changing shortcuts: simply hover over the menu option with the mouse pointer and press the keyboard shortcut you want to rebind it to.

To delete a keyboard assignment, press the Backspace key while you are on the menu entry.

Just had same problem and found this out, I did that by accident with s and could not type commands with s cause it would ask me for a new terminal title. :D

EDIT after comment:

if the shortcut doesn't change, then you need to enable the feature in GTK+. This can be achieved in 3 ways:

If you are running the Xfce desktop environment, enable Editable menu accelerators in the User Interface Preferences dialog.
If you are running GNOME then you can enable Editable menu accelerators in the Menu and Toolbars control center dialog.
Otherwise put the following in your ~/.gtkrc-2.0 file (create the file if it doesn't exist):
gtk-can-change-accels=1

FAQ screenshot

3
  • That would be a great solution, however for me it didn't work...
    – Klangen
    Jul 5, 2017 at 15:24
  • @Pickle - edited my answer with how to enable that way of changing shortcuts. Jul 6, 2017 at 4:38
  • In Xubuntu, to get to the User Interfaces Dialog search for the Appearances dialog (at least on version Xfce 4.12)
    – gerardw
    Mar 5, 2018 at 20:02
2
  • Go to ~/.config/xfce4/terminal

  • Open your ~/.config/xfce4/terminal/accels.scm in an editor.

  • You will see a long list with keyboard shortcuts that are only available for xfce4-terminal.

  • Try to find:

    (gtk_accel_path "<Actions>/terminal-window/set-title" "<Primary>F2")
    

    this is my setting for naming or renaming a tab.

  • In your case, you will find it with a semicolon at beginning, meaning that is "commented", like this:

    ;(gtk_accel_path "<Actions>/terminal-window/set-title" "<Primary>F2")
    
  • In order to apply the settings and load them into the terminal everytime, you need to "uncomment".

  • Use whatever you want.

    <Primary> - CTRL
    <Shift> - SHIFT
    <F2> - F2
    and so on

    and letters are with lowercase

    a - a
    and so on

  • For example, if you want Ctrl+Shift+A, you would have:

    "<Primary><Shift>a"
    

    and you are ready to go.

You must log in to answer this question.

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