Run command with Key Combination in Gnome
Is there a way in Ubuntu (22.04) to run a given bash command for a given Key combination in Gnome (42.9)? This Ubuntu is running in Hyper-V on a Win10 host.
(I would like to run the setxkbmap us
and setxkbmap hu
commands many times a day and finding the terminal and typing their aliases makes too much time. It would be even nicer if the same keyboard combination would do the two alternately, but I can do a Python script for that.)
1 answer
The following users marked this post as Works for me:
User | Comment | Date |
---|---|---|
Arpad Horvath |
Thread: Works for me It is the complete, easy to follow description of the solution. |
Oct 26, 2023 at 05:57 |
Gnome should have a Settings app with a Keyboard shortcut section. Here you can click Add Custom Shortcut which will let you bind any key to any shell-style command. source
Unless you are very sure of your command, I would recommend wrapping it in a script that also emits logs somewhere. If the command fails there is usually little indication, so it can be hard to troubleshoot otherwise.
0 comment threads