1

I'm running Ubuntu 20.04. I use Jupyter often, and would like to set up a Super-J hotkey to open the Jupyter Notebook. I tried to create the hotkey using jupyter notebook in the Keyboard Shortcuts settings panel, but that doesn't seem to work. I am assuming that's because the command needs to be run from the terminal. (I know the hotkeys run commands in the terminal, but I have nothing else to go on, so that's what I'm assuming is happening.)

I know that I can create a hotkey to open the terminal using gnome-terminal. Is there a way to open a terminal and run jupyter notebook in that terminal using a keyboard shortcut? I tried gnome-terminal && jupyter notebook but that just opens a terminal window; I tried gnome-terminal; jupyter notebook and that doesn't do anything.

2
  • I think that the shortcut's commands run in the ALT + F2 window
    – vmemmap
    Commented Sep 13, 2020 at 17:49
  • @r0ei Then is it possible to make a hotkey that opens a terminal instance and runs a command on the command line?
    – Yehuda
    Commented Sep 13, 2020 at 18:39

1 Answer 1

0

Try open a terminal and hit

gnome-terminal --help-all

which hints you (among other stuff) at the -e option:

Terminal options; if used before the first --window or --tab argument, sets the default for all terminals: -e, --command Execute the argument to this option inside the terminal

which is totally misleading :(, because if you do that you get:

Option “-e” is deprecated and might be removed in a later version of gnome-terminal. Use “-- ” to terminate the options and put the command line to execute after it.

So after rereading this twice, wondering why it doesn't work and realizing that if your command exits also the terminal goes down and then enhancing your "echo test" with an "exec bash" you then have a good answer for unix.stackexchange.com.. or so you hope :)

gnome-terminal --window -- /bin/sh -c "echo This line is opening a gnome-terminal, running a command in it and then handing over to bash;exec bash"

And with

gnome-terminal --window -- /bin/sh -c "jupyter notebook"

as the command, i was able to start a jupyter notebook on fedora 31 via a custom keyboard combo.

You must log in to answer this question.

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