Score:0

How to set keyboard shortcut to open desktop shortcut?

it flag

For example, I have desktop shortcut for Telegram with config file /usr/share/applications/telegram.desktop that has the following content:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=Telegram Desktop
Exec=/opt/telegram/Telegram -- %u
Comment=Official desktop version of Telegram messaging app
Icon=/opt/telegram/telegram.svg
StartupWMClass=Telegram
Categories=GNOME;GTK;Network;
MimeType=application/x-xdg-protocol-tg;x-scheme-handler/tg;
X-Desktop-File-Install-Version=0.22

This desktop shortcut was added to Favorites and visible in Ubuntu Dash panel on desktop.

Is it possible to define keyboard shortcut for this desktop shortcut?

I suppose that this should be configured in Settings -> Keyboard Shortcuts -> Custom Shortcuts. But specification there either the desktop file or the command in this file:

  • /usr/share/applications/telegram.desktop
  • /opt/telegram/Telegram -- %u
  • /opt/telegram/Telegram

is not working.

In Windows keyboard shortcut can be specified just inside properties of the desktop shortcut. If it possible how to configure such behavior in Ubuntu?

Andra avatar
tr flag
maybe take a look at [this](https://askubuntu.com/questions/1332731/how-to-run-desktop-file-from-bash-script)
it flag
@Andra Great, with specification command as `gtk-launch telegram.desktop` the keyboard shortcut is working. You can post this as answer. Thanks!
Andra avatar
tr flag
it's better you write the answer yourself - you solved your problem
it flag
@Andra Only with your help. So it would be more honestly if you post this an answer and I will accept it. But if you still want me to do this I will.
it flag
I also checked `dex` tool. With it keyboad shortcut also works but full path to the desktop file should be specified. Example: `dex /usr/share/applications/telegram.desktop`
Score:0
it flag

Need to specify command as:

gtk-launch telegram.desktop

Or to install dex:

sudo apt install dex

and to specify command as:

dex /usr/share/applications/telegram.desktop

Source: how to run ".desktop" file from bash script

Checked on Ubuntu 20.04.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.