3

The hotkey should be easy to disable and enable (with another shortcut).

The text and keys to enter are string, and should be called by typing "r". It should be used in a flash app for easier navigation.

Is there a chrome extension that can do it?

I've already googled and I haven't found anything.

So I need something like Auto Hotkey (https://autohotkey.com/), but for Linux.

  • What do you mean by "the" text? Do you just want to bind some key to the insertion of "↩"? Does it have to be "r" without modifier? – L. Levrel Mar 22 '16 at 10:36
  • Please edit your question and clarify. What is ? Is that supposed to represent the return key, a new line, the character itself? What is "the text"? The more details you give, the likelier it is we'll be able to help you. – terdon Mar 23 '16 at 13:49
  • It's <enter>string<enter>, and should be called by typing "r". It should be used in a flash app for easier navigation. Hope this helps :) – linuscl Mar 23 '16 at 17:14
3
+50

This can be done by use of xbindkeys+xdotool.

One has to be careful: if your string, say my-string, contains the letter "r", binding xdotool type string to r would cause a loop! To avoid this, I disable xbindkeys, then call xdotool, then enable xbindkeys back.

Suppose your string is my-string, you want key F1 to enable the shortcut, and F2 to disable it.

  1. Create file ~/.xbindkeysrc to contain:

    "killall xbindkeys && xdotool key Return type my-string && xdotool key Return && xbindkeys"
    r
    
    "killall xbindkeys"
    F2
    
  2. Then use your Desktop environment's Settings manager to bind F1 to launching xbindkeys.

You can now type F1 { r | <other_keys> }... F2.

2

Use xdotool

Install and run xdotool it just automate keyboard/mouse/.... for you.
after installing you can this in bash:
xdotool key Return && xdotool type sometext

For your shortcut key you can use "gnome keyboard custom shortcuts" and assign this command to a shortkey!

To install xdotool do: apt-get install xdotool (if using ubuntu)

  • By the way you cannot assign simple r for your shortcut key it must be something more complex. – Arash Mar 25 '16 at 13:55
  • After assignment of shortcut key, you should logout & log back in for changes to take effect. – Arash Mar 25 '16 at 13:58
  • Please refrain from using comments on your own questions or answers. You can easily edit your initial post and add this information, where it makes it easy to read and find. – MelBurslan Mar 25 '16 at 14:02
  • @MelBurslan I want to keep my Answer brief and also give some advice! – Arash Mar 25 '16 at 14:04
1

I'm not sure what exactly do you want to achieve but one chrome extension seems like it might be able to solve your problem (if you know javascript). It's called: Shortkeys (Custom Keyboard Shortcuts)

  • have you a link? – cat Mar 25 '16 at 14:04
  • here you go – UncleAlbie Mar 26 '16 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.