open only new terminal window in custom directory
It already works like you wish by default.
- You can specify a different startup directory with the option
--working-directory
, e.g.gnome-terminal --working-directory ~/some-custom-directory
- When you open a new tab, the new tab will always default to the current directory of the active tab, i.e., if you are in
~/other-directory
, a new tab will also open in~/other-directory
.
To have that work for the shortcut key Super+2, which launches or switches to the application that is the 2nd favorite on your dock (in your case, that is the terminal), edit the .desktop
launcher involved.
- Copy the desktop launcher of Gnome terminal (
/usr/share/applications/org.gnome.Terminal.desktop
to your localapplications
directory (~/.local/share/applications
). - Edit that local copy of the
.desktop
file and add the option to the command in theExec=
line. Note that here, you need to indicate the full path name, because bash expansion (~
) or variable substitution (e.g.$HOME
) does not work in.desktop
launchers. The customized copy will take precedence over the default one, so within seconds, your shortcut key should launch your terminal in the directory of your choice (of course, only if Terminal was not running - if it is running, the shortcut key will only bring the running instance forward without changing directories).