xfce4-terminal bind string to key?

Silvio Knizek killermoehre at gmx.net
Sun Jul 18 22:34:05 CEST 2021


Am Sonntag, dem 18.07.2021 um 21:24 +0200 schrieb Ulli Horlacher:
> Is it possible with xfce4-terminal to bind a string to a key?
>
> For example, I want the string "Test 000" to be bound to the key 0 on the
> numeric keyboard. Every time I hit the 0 key this string should be sent to
> the application running inside xfce4-terminal.
>
> Is this possible and how?
Hi Ulli,

not directly with xfce4-terminal, but with a combination of general
keyboard shurtcuts to launch applications and »xdotool« to check for
the Terminal and enter the key sequence.

```bash
bash -c '[[ "$(xdotool getactivewindow getwindowname)" =~ Terminal ]] && sleep 0.1 && xdotool key --delay 10 --clearmodifiers "0" "0" "0" "0" "space" "T" "e" "s" "t"'
```

Bind this in xfce4-keyboard-settings to Ctrl+0 (I really suggest the
Ctrl here, else the 0 on the numpad can't be used in other applications
anymore).
As this sounds like something for a (n)curses application, you may have
to adjust the regex in the first expression. You can get the name of a
window you select via

```bash
xdotool selectwindow getwindowname
```

HTH
Silvio



More information about the Xfce mailing list