2

I want to know the technique of making custom keyboard-shortcuts to open or create any app.

yuma
  • 35
  • 1
    "open or create" are two very different things. How do you envisage creating "any app" by a custom shortcut? – DK Bose May 18 '19 at 12:27

1 Answers1

3

Requirements

App or command

Install all of these like sudo apt install wmctrl

  • xprob
  • greb
  • wmctrl

Information

WM_CLASS info of the app.

Instructions

Creating WM_CLASS for any app

To do this, you need to make desktop app.

  • Type sudo -H gedit /usr/share/applications/<appname>.desktop
  • And fill these section what you want to do, I suggest you to look these post
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Appname
GenericName=Appname
Comment=
Exec=
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=
Categories=
Keywords=
X-Ubuntu-Gettext-Domain=
StartupWMClass=

Getting WM_CLASS of any app

  • First type terminal to find WM_CLASS of any app xprop | grep WM_CLASS
  • After ENTER, click the app, which you want to make shortcut for
  • You will see a return like WM_CLASS(STRING) = "gnome-terminal-server", "Gnome-terminal"
  • Copy first string which is gnome-terminal-server with CTRL + SHIFT + C

Making shortcut

  • Open shortcuts with typing shortcut to search panel
  • Click + icon the bottom of the opened window
  • Set any name which u want to name section
  • Type bash -c "wmctrl -xa <wm_class> || <wm_class> to command section
  • Finally, click shortcut and set your custom shortcut :)
yEmreAk.com
  • 1,289