TechWiser
  • Home
  • How To
  • Internet
  • More
    • About Us
    • Contact Us
    • Advertise
    • Privacy Policy
    • Careers

TechWiser

  • Home
  • How To
  • Internet
  • More
    • About Us
    • Contact Us
    • Advertise
    • Privacy Policy
    • Careers

How to Quickly Create Keyboard Shortcuts in Ubuntu

by Pratik March 9, 2020
written by Pratik March 9, 2020

Keyboard shortcuts come really handy. You can set up to launch shell scripts, third-party apps or even particular webpages.  For instance, I have mapped Alt+Space to launch a shell script that stores my text snippets and I can quickly enter Postal Addresses, Credit Card number, etc. Moreover, Ubuntu lets you do all of these keyboard shortcuts mapping natively. Here’s a couple of ways to quickly create keyboard shortcuts in Ubuntu.

How to Quickly Create Keyboard Shortcuts in Ubuntu

1. Command Line

In case you are too accustomed to the command-line, there’s again two ways to do this – dconf and gsettings. If you already have dconf installed go ahead with it or else we’ll do it via gsettings. Foremost, we need to check whether the keyboard binding list is empty. In case it’s empty which usually it should be unless you have created shortcuts previously. Nonetheless, use the following command to check the keyboard shortcut list.

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings

check-custom-key-bindings-list - custom keyboard shortcuts ubuntu

If you get a blank output like above, we need to first create a custom list. I am naming my list as “custom0”. You can have any name to it but just to keep it clean, we’ll go with “custom0”. Use the following command to do that.

gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"

Once the command completes successfully, run the following command again to verify the custom key list creation. You should something similar to the following output.

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings

custom-key-binding-list-creation

Next, we have to add our key shortcuts to the “custom0” list we created just now. This requires a set of 3 commands which will first give our shortcut a name, file location, shortcut key accordingly. For instance, I want to map “Ctrl+Alt+Page_Down” to launch the Gedit editor. So, I simply found the location of the gedit application file using the “whereis” command. Below are the commands I used to do that.

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 "'<Alt><Ctrl>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'"

commands-to-add-custom-key-shortcuts

Once all the commands complete successfully, you should be able to launch the app on keypress. Moreover, you would also see an entry at the end under Keyboard.

keyboard-shortcuts-in-settings-menu

In case you want to modify the shortcut, you can do it via the GUI.  Alternatively, if you run the same commands it would override the previous configurations.

2. GUI

You can also create the shortcut via the GUI and it’s more intuitive comparatively. To do that, head over to the settings menu and click on the Devices tab. Next, click on the Keyboard tab. Alternatively, you can also type “Keyboard” in the GNOME search bar.

keyboard-shortcuts-open-in-gnome-search - custom keyboard shortcuts ubuntu

On the Keyboard section, navigate to the bottom and click on the “+” button.

add-keyboard-shortcut-GUI

On the add shortcut pop-up, you have to enter the name, file location, and the keyboard shortcut. For instance, I want to map “Alt+Ctrl+Page_Down” to launch gedit application. So, I found out the file location of the gedit application file using the “whereis” command. Further, to add the keyboard shortcut, you just have to press on the “Set Shortcut…” button and it will record the keypress.

Post entering all the parameters, click on the Add button at the top-right corner.

set-all-keyboard-shortcuts

Upon adding, you will be able to see your shortcut at the bottom of the page. If you can, you should be able to launch the app via the keyboard shortcut.

keyboard-shortcuts-in-settings-menu

These keyboard shortcuts can also be used to launch shell scripts or app images. For more issues or queries, let me know in the comments below.

Also Read: Best Browsers For Ubuntu You Should Try in 2019

0 comment
0
FacebookTwitterGoogle +Pinterest
Pratik

Pratik works as an In-house writer and video host at TechWiser. Former Programmer, Current writer. Loves tech in any form, quite optimistic about AI, data science and IoT. Talks extremely less but you betcha can geek out over anything on Twitter.

You may also like

How to Combine Multiple Photos Into One PDF...

February 28, 2021

How to Run Shell Script on Mac

February 27, 2021

8 Ways to Fix Taskbar Missing or Disappeared...

February 25, 2021

How to View WhatsApp Status Without Them Knowing

February 25, 2021

How to Read Amazon Kindle Books on Windows...

February 23, 2021

How to Change Microsoft Store Download Location for...

February 23, 2021

How to Fill Out a PDF Form on...

February 22, 2021

How to Download TikTok Videos Without Watermark

February 21, 2021

How to Transfer iMovie from iPhone to Mac

February 20, 2021

How to Hide or Remove Recommended Videos From...

February 19, 2021

Leave a Comment Cancel Reply

You must be logged in to post a comment.

Recent Posts

  • 17 Best Apple Arcade Games for Kids

  • 6 Best Light Meter Apps for iOS and Android

  • How to Combine Multiple Photos Into One PDF on Windows and Mac

  • Firefox Lockwise vs LastPass: Best Free Password Manager

  • 7 Best Self Diagnosis App for Mobile and Desktop

  • Facebook
  • Twitter
  • Instagram
  • Youtube
  • RSS

©TechWiser 2012-2020