For Ubuntu 18.04.
I struggled with this problem for two days. I tried all the methods listed here earlier. And it looks like I came up with a solution. But it is very unstable and has bugs.
The basic idea is this: in the system settings you can specify the command that is started by the Ctrl+Shift+U key combination.
Note: if you specify false
as the command, the combination will not work at all.
However, we can specify the path to the script as the command, in which we will simulate pressing the same key combination.
To simulate keystrokes, I tried the xdotool
(apt install xdotool
) and the xte
(apt install xautomation
).
Both options were unstable. However, xte
turned out to be more flexible for me.
Example with xte
- Create a file
/home/username/shortcut.sh
- Add permission to execute:
chmod u+x /home/username/shortcut.sh
- Specify the path to the script as a command for the Ctrl+Shift+U key combination in the keyboard settings
Here is an example script:
#!/bin/sh
# Make a small delay in order to have time to release the keys.
sleep 0.2
# Simulate the release of just pressed keys, if they are still pressed.
xte 'keyup u' 'keyup Shift_L' 'keyup Control_L'
# Hack: Caps_Lock is used so that the system does not intercept this combination.
# You can try to remove it if it hinders you.
xte 'key Caps_Lock'
# Simulate pressing a key combination
xte 'keydown Shift_L' 'keydown Control_L' 'key u'
# Simulate releasing a key combination
xte 'keyup Shift_L' 'keyup Control_L'
# Restore Caps_Lock to the previous state.
xte 'key Caps_Lock'
I tested this in PhpStorm 2018.2 EAP Build #PS-182.3458.35 and I can say that it works, but with some caveats:
- this works slowly (on my rather old PC)
- during the execution of the script, it is better not to press any keys
- sometimes it may not work
- sometimes it can enter an infinite loop. Therefore, it's better to add a check to the script that the script is already running.
In general, if you do not often use this combination, then this solution may suit you.
But, probably, someone will come up with a better and more stable solution.
I hope this idea will help someone.
In latest Ubuntu versions you just go Language Support then Keyboard input method system is available – Vahid – 2018-05-30T21:26:48.873
19This did not work for me on Ubuntu 18.0.4 LTS. Any ideas why? – Pytry – 2018-06-19T22:05:24.853
doesnt work in 16.04 LTS also – weima – 2018-07-18T15:06:19.590
2why Ubuntu made it so difficult to disable keyboard input system? keystrokes entered going directly to program should be the default anyway. – weima – 2018-07-18T15:08:19.390
7does not work for me on ubuntu 18.04 – iRaS – 2018-08-22T08:59:44.727
@PutzKipa:Please correct the answer. A logout/login is good enough. No need to restart the OS. – Rudy Vissers – 2019-04-15T07:44:43.973
11Just logging out and back in works for me. – Martin – 2014-04-29T10:13:42.097