Bug 478219 - Global shortcuts that send keystrokes/characters to the focused window
Summary: Global shortcuts that send keystrokes/characters to the focused window
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (show other bugs)
Version: 5.27.9
Platform: Fedora RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2023-12-07 15:54 UTC by pgnd
Modified: 2024-02-20 20:12 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pgnd 2023-12-07 15:54:02 UTC
many of my KDE DE (@ Fedora, mostly, but not exclusively) instances use CustomShortcuts for a11y users' (in addition to others', generally) support -- via khotkeys/kglobalaccel et al available under X11

with the impending/inevitable switch to wayland, this,

```
Custom Shortcuts are gone in 5.25 on Wayland 
 https://bugs.kde.org/show_bug.cgi?id=455444
```

says "CLOSED INTENTIONAL" & 'ask in support channels'

in support channels, asking for methods/docs/examples of how to,

	press a trigger chord (e.g. Control+Opt+Cmd+T) and have a string of chars (e.g., "T e s t !") typed-out in the active window

, nothing as yet forthcoming.

under kde/wayland, it's clear how to have a chord trigger exec of an app/script @

	System Settings -> Shortcuts -> Custom Shortcuts Service

there does not appear (?) to be a method in the UI to specify a string of characters to be typed, as is done under X11, where it's clean/elegant/trivial,

	@ SystemSettings -> CustomShortcuts
		create new shortcut
		add Comment
		assign Trigger
			e.g., Meta+Ctrl+Alt+T
		enter Action
			e.g., Shift+t:e:s:t:Shift+1

in any/all apps, then, chord-press of "Meta+Ctrl+Alt+T" types out : "Test!"

the X11 solution is not 'hacky', is end-user usable -- particularly by/for a11y users, demonstrated & in-use here for ages -- and at least for awhile, was deployed as 'officially included' in the KDE SystemSettings UI.

Under Wayland, we need some equivalent in-UI solution to roll out to real, a11y-using end-users.
Something non-coder end-users can setup/modify/use.
And can be easily configured and deployed to multiple end-user machines.
Comment 1 pgnd 2023-12-07 16:35:58 UTC
for info/ref, from KDE/X11's CustomShortcuts' Example == "Type Hello",

"After pressing Alt+Ctrl+H the input of 'Hello' will be simulated, as if you typed it.  This is especially useful if you have call to frequently type a word (for instance, 'unsigned').  Every keypress in the input is separated by a colon ':'. Note that the keypresses literally mean keypresses, so you have to write what you would press on the keyboard. In the table below, the left column shows the input and the right column shows what to type.

"enter" (i.e. new line)                Enter or Return
a (i.e. small a)                          A
A (i.e. capital a)                       Shift+A
: (colon)                                  Shift+;
' '  (space)                              Space"
Comment 2 pgnd 2023-12-20 00:30:40 UTC
fyi, from a comment in #fedora-kde

  "the emulated input support needed for what you want is not yet implemented, https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/12"
Comment 3 Neal Gompa 2023-12-28 18:07:52 UTC
I'm not sure this counts as wishlist level? It's something that is used as an accessibility feature.
Comment 4 Nicolas Fella 2024-01-06 22:08:38 UTC
Can you elaborate a bit on the use case? Is this primarily about typing in text? Or more generally about UI automation, e.g. by triggering shortcuts in the application?
Comment 5 pgnd 2024-01-06 22:19:00 UTC
(In reply to Nicolas Fella from comment #4)
> Can you elaborate a bit on the use case? Is this primarily about typing in
> text? Or more generally about UI automation, e.g. by triggering shortcuts in
> the application?

Typing text.
Exactly as given in the examples above, in

 https://bugs.kde.org/show_bug.cgi?id=478219#c0
 https://bugs.kde.org/show_bug.cgi?id=478219#c1
Comment 6 Nicolas Fella 2024-01-06 22:39:38 UTC
I'm asking because it potentially makes a difference in how we present this in the UI.

Users specifying "Hello" as input seems more friendly than "Shift+H:E:L:L:O"
Comment 7 Nicolas Fella 2024-01-06 22:42:43 UTC
Also, not every text is easily typeable via keystrokes on every keyboard layout (particularly non-latin/CJK text), so shifting the mental model from  keystrokes towards text input makes sense
Comment 8 Nicolas Fella 2024-01-06 22:45:11 UTC
Random aside: The builtin "Type 'Hello'" example in khotkeys is broken. It only types "hello". This is because the shortcut uses H so it swallows the first letter
Comment 9 pgnd 2024-01-06 23:15:31 UTC
> Users specifying "Hello" as input seems more friendly than "Shift+H:E:L:L:O"

couldn't agree more.
that's what existed.  and what we made do with.
frequently, complex strings to be typed have to be 'assembled' _for_ the user, and assigned to a manageable key-chord.
a PITA, but doable -- and deployable.
it would be a great improvement to be able to 'enter' a string to be typed, simply by typing it -- not synthesizing it.

e.g., 'simply'

 TEXT to type: [   p@s$w0rD_1  ]
 KEY COMBO:  Ctrl-Meta-P

or,

TEXT to type: [ (tab)Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. (return)(return)Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ]
KEY COMBO:  Ctrl-Shift-Meta-L

and, when KEY-COMBO is played in active window (Konsole, LibreOffice, Firefox URL bar, etc etc), the TEXT would be typed, as input.
Comment 10 Neal Gompa 2024-02-18 12:12:52 UTC
This is not fixed, so reopening.