6

I want to add a keyboard shortcut to launch a program I typically open from the terminal. The terminal command I setup for it is julia (which points to the relevant binary in my PATH).

So I added a keyboard shortcut under Settings (I am in Ubuntu 18.04)

enter image description here

enter image description here

but it doesn't do anything. I think maybe the issue is I have to tell it somehow that this is a terminal program?

2
  • you need to provide the full path to the executable.
    – digiwizkid
    Nov 8, 2019 at 13:38
  • @digiwizkid I tried /usr/bin/julia, but it also doesn't work. Note that I have a julia binary under /usr/bin/, which is on my PATH.
    – a06e
    Nov 8, 2019 at 13:44

2 Answers 2

7

You can use: bash -c "gnome-terminal -x application" to open a terminal, note that it exits once the application opened stops running.

bash -c "gnome-terminal -x julia"

2
  • 1
    This works for me but also, if you want to run a program without a terminal popping up use (for example): ' bash -c "firefox" ' in the settings menu/keyboard shortcuts
    – Barra
    Dec 30, 2021 at 12:45
  • This also works if you just want to launch the terminal on its own bash -c "gnome-terminal" (I'd replaced the default "Terminal" program with Alacritty, but still wanted to be able to launch the Gnome terminal too). Just having a custom shortcut with bash wasn't enough.
    – icc97
    Nov 6, 2023 at 9:44
3

You could create a .desktop file with the following content:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon=/path/to/icon/icon.png
Exec=julia
Name=julia

Put this file into ~/.local/share/applications and make it executable by chmod +x . Then you should be able to add a keyboard shortcut to it.

6
  • Have to argue that even though this is a good solution I prefer over keyboard shortcuts, it's also a correct answer to another question.
    – Smurfz87
    Nov 8, 2019 at 14:16
  • @Smurfz87 I will agree that as it is written here, it is not a complete solution to the question. i just have to find out where the desktop file has to be put, so that OP can add a keyboard shortcut to it. Any ideas on that?
    – Bruni
    Nov 8, 2019 at 14:19
  • ~/.local/share/applications ?
    – Smurfz87
    Nov 8, 2019 at 14:21
  • @Smurfz Thank you! I ll adjust my answer.
    – Bruni
    Nov 8, 2019 at 14:23
  • 1
    Hi.. I would like to know what will be the keyboard shortcut command to enter in this case? ~/.local/share/applications/julia.desktop ??
    – PRATAP
    Nov 8, 2019 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .