0

I recently bought a new keyboard with macro keys. Unfortunately, the manufacture has proprietary software that only runs on Windows.

I have been doing some workarounds to use the macro-keys by first creating custom keyboard shortcuts and them use them in the macro-keys.

Currently, I am trying to create a shortcut to open a local terminal in a folder and lunch visual code.

In ubuntu, a local terminal can be opened by doing:

right click + E

Shift + F10 + E

I would like to know if this is possible through a command line: with something like:

gnome-terminal --working-directory= something to be defined --LocationOfVisualStudioLuncher

Best Regards!

2 Answers2

0

For me in Ubuntu 20.10, a

cd <your folder> && gnome-terminal

will open a terminal in <your folder>.

To spawn a terminal and your custom application, you can launch to background as in

cd <your folder> && gnome-terminal & your_application &

vanadium
  • 88,010
  • This way, I have to specify the folder, no? Since I want to create a shortcut, it should know what folder it is on. what does it do when I press shift + F10 + E. How does Ubuntu know the folder? –  Jan 05 '21 at 11:39
  • I probably misunderstood your question then. You may want to clarify and more quickly come to the point, unless your macro keyboard is critical in this question. – vanadium Jan 05 '21 at 11:45
  • It appears indeed as if SLS also did not understand what you actually want. If the question is to access the "Open in terminal" right-click menu option through a hotkey, then look here: https://askubuntu.com/questions/1154110/how-to-enable-open-terminal-here-from-nautilus-when-in-list-not-tiled-mode/1154118#1154118. Unfortunatelly, assigning a shortcut does not anymore work in 20.10. You can of course open additional applications through the nautilus script. – vanadium Jan 05 '21 at 11:49
  • Look also here, https://askubuntu.com/questions/1194329/keyboard-shortcut-to-create-a-new-empty-file-on-ubuntu-18-04/1194547#1194547 (end of answer) where you can assign hotkeys to nautilus script menu items. Failing the option to bind a single hotkey, the keyboard combination Shift+F10 s is the next best thing to quickly trigger an action. Unfortunatelly, that only works when a file is selected. – vanadium Jan 05 '21 at 11:55
0

You can accomplish this by executing something like this in one line:

gnome-terminal --working-directory ~/GIT --title "code terminal" && gnome-terminal -- code

for convenience add this to your ~/.bashrc file so that you have direct access to a shortcut command "gt":

alias gt='gnome-terminal --working-directory ~/GIT --title "code terminal" && gnome-terminal -- code'

Hope that helps!

SLS
  • 168
  • 12
  • Unfortunately this did not work for me. What is GIT? –  Jan 11 '21 at 08:38
  • Sorry that did not work for you. GIT is just a folder name "working directory", "~/" is short hand for the users home directory. So you would get an error if that folder did not exist. Please try again, but substitute ~/GIT with the folder you want instead. If you tell me more precisely what you want to do I can help better. What was the error you got? – SLS Jan 11 '21 at 14:33