Often-used text-snippets assigned to function-keys


it should be possible to assign up to 12 often-used text-snippets (incl. returns) to the 12 function-keys, so that they can be inserted in any text-field of any app with only pressing one of the function-keys.

Best regards,

This sounds like a great idea for an extension!

You cannot “insert” text inside an application from the outside. At most, you can put text inside the clipboard, and paste from the application.

1 Like

OK, I understand. Is this for security-reasons? If not, this should be implemented.

But if this is for security there would also be a solution:
if you use the assigned keyboard-shortcut, the function for this functionality could use the clipboard for inserting the text. E.g. like the shortcut for inserting the clipboard a shortcut for the suggested feature could copy the text of that feature into the clipboard and then copy the clipboard to the cursor-position.

No, it’s not for “security reasons” (though those have to factored in). The clipboard is a “pull” protocol: applications say “I have data to put into the clipboard”, and when another application decides to paste the contents of the clipboard, the windowing system will ask the application for the clipboard data.

The operation of pasting has to be initiated by the application itself, after a user request; you cannot have a third party component doing that.

Feel free to look into how this would work. I very much doubt somebody else is going to implement this functionality for you—unless you decide to pay them.

Will it work if we simulate Ctrl+V with something like libinput replay?
We can populate the clipboard with gpaste-client reading a specific text file.

An alternative is to use 2 shortcuts in a row:

  • Copy the relevant file contents to the clipboard.
  • Manually paste the clipboard contents.