Bug 427509 - "send keyboard input" > doesn't send unicode characters (or sends in wrong encoding)
Summary: "send keyboard input" > doesn't send unicode characters (or sends in wrong en...
Status: RESOLVED DUPLICATE of bug 427682
Alias: None
Product: khotkeys
Classification: Plasma
Component: general (show other bugs)
Version: 5.18.4
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-10 09:55 UTC by Shual Kravot
Modified: 2020-10-14 08:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
my khotkeys (28.08 KB, text/plain)
2020-10-10 09:55 UTC, Shual Kravot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shual Kravot 2020-10-10 09:55:46 UTC
Created attachment 132257 [details]
my khotkeys

khotkeys crash and bugs when assigning shortcut to "send keyboard input"

these multiple bugs might be related?

steps to recreate; all in program: "custom shortcuts"  (kcmshell5 khotkeys)

bug1:

1. create a new group
2. select / highlight the new group
3. create a new item: "new" > "global shortcut" > "send keyboard input"
4. the program crash.

bug2:

1. create a new global hortcut outside any group
2. crashes.

bug 3:

1. next, I run "custom shortcuts" again
2. drag the new orphand items (i.e. not inside a group) into a group.
3. press OK
4. run "custom shortcuts" again
5. the items are still outside the group

bug 4:

1. define new, or reset created "keyboard action":
2. assign a shortcut key (I tried Meta+M, Meta+W, alt+ctrl+N)
3. assign a keyboard action (i.e. any string)
4. press Apply / Ok
5. the keyboard input is not sent
6. when I press the shortcut, I see a brief flicker in the whole GUI/screen.
7. the settings appears in ~/.config/khotkeysrc , and seems "in order".

bug 5: non-ascii

1. install xdotool
2. in "custom shortcuts" create a "new > global shortcut > action / url"
3. assign a shortcut to "xdotool type ascii-text"  --> works
4. assign a shortcut to "xdotool type ₪"  --> throws garbage keyboard event


Comments:

 - this xdotool command works, with unicode, from the console, but not when set in "khotkey".
 - this xdotool appears in ~/.config/khotkeysrc as CommandURL=xdotool type $'\\u20AA'
 - I never edited manually ~/.config/khotkeysrc
 - plasmashell --version 5.18.5
 - kubuntu 20.04
 - all updates applied.
 - bug probably existed also on ubuntu 16 + kde.
 - khotkeys/focal,now 4:5.18.4.1-0ubuntu1 amd64
 - assigning and reassigning keys: the results are inconsistent.  i.e. the outcome of pressing the shortcut keys send different keys each time (just not the keys I intended)

Might be related (old, 5+ years old bugs) :
https://bugs.kde.org/show_bug.cgi?id=165099 "Keyboard shortcuts can't be set for khotkeys"
https://bugs.kde.org/show_bug.cgi?id=342263 "Deleted custom shortcut is [...] in Global Keyboard Shortcuts"
https://bugs.kde.org/show_bug.cgi?id=185904 "khotkeys keyboard shortcuts not working"
https://bugs.kde.org/show_bug.cgi?id=348456 "Keyboard input shortcut keys do not work"
Comment 1 Shual Kravot 2020-10-14 08:01:22 UTC
I just realized the main issue:  

When I assign Unicode keyboard input to a hotkey, the characters are not sent correctly. 

I assume they are being sent in plain ASCII, and the unicode char is being interpreted as a control character, (cause random phenomena on the way).


How to reproduce:

0. in "Custom Shortcuts",
1. define a keyboard action (New > Global Shortcut > Send Keyboard Input")
2. assign a shortcut key (I tried Meta+M, Meta+W, alt+ctrl+N)
3. assign a non-ascii, unicode string (I used €, or ₪)
4. Save.
5. the keyboard input is not sent
6. when I press the shortcut, I see a brief flicker in the whole GUI/screen, or a random action of the window manager (e.g. raising windows, change task, minimize/maximize, etc).
7. the settings appears in ~/.config/khotkeysrc , and seems "in order". I.e. the character is saved there as UTF-8.

I tested the same with pure textual (a-zA-Z0-9) ASCII string, and it worked as expected.
Hence I deduce this is an encoding problem, either in the sending part, or the receiving part.

Moreover:

1. I created an executable script using xdotool (apt install xdotool)
#!/bin/bash
xdotool type €

2. This script works as standalone, e.g. from the command line, crontab. It sends the euro character to the active window.

3. If the same script is running by khotkeys's "command/URL", then the outcome is not sent (produce the flicker / actions I mentioned described above).
Comment 2 Shual Kravot 2020-10-14 08:56:48 UTC

*** This bug has been marked as a duplicate of bug 427682 ***