How to Quickly Create Keyboard Shortcuts in Ubuntu.
The keyboard shortcuts are very convenient. You can customize the launch of shell scripts, third-party applications, or even specific web pages. For example, I assigned Alt + Space to run a shell script that stores my text snippets and I can quickly type in postal addresses, credit card number, etc. Moreover, Ubuntu allows you to map all of these keyboard shortcuts natively. Here are some ways to quickly create keyboard shortcuts in Ubuntu.
How to quickly create keyboard shortcuts in Ubuntu
1. Command line
If you’re too used to the command line, there are two more ways to do this – dconf and gsettings. If you already have dconf installed, continue, otherwise we will do it via gsettings. First of all, we need to check if the keyboard bindings list is empty. If it’s empty, which is usually what it should be if you haven’t created shortcuts before. However, use the following command to check the list of keyboard shortcuts. gsettings gets org.gnome.settings-daemon.plugins.media-keys custom-keybindings
If you get an empty result like above, we need to create our own list first. I call my list “custom0”. You can give it any name, but to keep it clean, we’ll choose custom0. To do this, use the following command. gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings “[‘/ org / gnome / settings-daemon / plugins / media-keys / custom-keybindings / custom0 /’]”
After the command completes successfully, run the following command again to test the creation of the custom key list. You should get something similar to the following result. gsettings gets org.gnome.settings-daemon.plugins.media-keys custom-keybindings
Then we need to add our keyboard shortcuts to the “custom0” list we just created. This requires a set of 3 commands, which will first give our shortcut a name, file location and shortcut respectively. For example, I want to map “Ctrl + Alt + Page_Down” to launch the Gedit editor. So, I just found the location of the gedit application file using the “whereis” command. Below are the commands I used to do this. gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding: / org / gnome / settings-daemon / plugins / media-keys / custom-keybindings / custom0 / name “‘gedit_launch'” gsettings set org .gnome.settings-daemon.plugins.media-keys.custom-keybinding: / org / gnome / settings-daemon / plugins / media-keys / custom-keybindings / custom0 / binding “‘ Page_Down'” gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding: / org / gnome / settings-daemon / plugins / media-keys / custom-keybindings / custom0 / command “‘/ usr / bin / gedit ‘”
After successfully completing all the commands, you will be able to launch the application by pressing a key. Moreover, you will also see an entry at the end under the keyboard.
If you want to change the shortcut, you can do so through the GUI. Alternatively, if you run the same commands, it will override the previous configurations.
2. Graphical user interface
You can also create a shortcut through a GUI, and it is comparatively more intuitive. To do this, go to the settings menu and click the “Devices” tab. Then click the Keyboard tab. Alternatively, you can also type “Keyboard” in the GNOME search bar.
In the Keyboard section, scroll down and click the + button.
In the pop-up window for adding a shortcut, you must enter the name, file location and keyboard shortcut. For example, I want to map “Alt + Ctrl + Page_Down” to launch a gedit application. So, I figured out the location of the gedit application file using the “whereis” command. Also, to add a keyboard shortcut, you just need to click the “Set keyboard shortcut …” button and the keystroke will be recorded.
After entering all the parameters, click the Add button in the upper right corner.
Once added, you should be able to see the shortcut at the bottom of the page. If you can, you should be able to launch the application with a keyboard shortcut.
These keyboard shortcuts can also be used to launch shell scripts or application images. If you have further problems or questions, let me know in the comments below.
Also Read: Best Ubuntu Browsers You Must Try In 2019