2

It takes me by default to /home/username, but I have most of my things in the Desktop directory.. How to change it? I was thinking of making a script like:

gnome-terminal --working-directory=~/Desktop 

and then "associate" it with some keyboard short-cut if possible, but the above command doesn't work for me (it opens another terminal in /home/username). I've read this question's first answer but I don't get how should I repair the bug (I wanted to ask for elaboration, but I haven't enough reputation...) . Also , I don't want to lose the "Open in terminal" option when right clicking, so adding cd ~/Desktop in ~/.bashrc won't work for me....

Diego
  • 211

1 Answers1

3

Here's possibly what you want. Works for me perfectly

First you need to install (other similar programs available too) xbindkeys

sudo apt-get install xbindkeys

Then create a default configuration file with

xbindkeys --defaults

(Prints the default configuration file)

So to create a configuration files with default values run

xbindkeys --default > $HOME/.xbindkeysrc

Using ctrl+alt+T is not recommended in this case, since it is already in use. Find a unique key combination to use. I personally chose ctrl+shift + aring

You may want to use the following command to see exact names of the keys used

xbindkeys -k

After running the command, you need to hit the key combination. You will see an output similar to this

m:0x5 + c:34
  Control+Shift + aring

Then edit the configuration file you created with an editor of your choice

vim .xbindkeysrc

You will see that the only lines that are not commented out are

"xbindkeys_show"
  control+shift + q

That's one existing key combination

Add the following lines below the above mentioned lines

"gnome-terminal --working-directory=/home/$USER/Desktop"
   control+shift + aring

(If you used different keys, add those instead of control+shift + aring)

The file around that area should be looking something like this

# Examples of commands:

"xbindkeys_show"
   control+shift + q

"gnome-terminal --working-directory=/home/$USER/Desktop"
   control+shift + aring

# set directly keycode (here control + f with my keyboard)
#"xterm"
#  c:41 + m:0x4

Save the file. After saving, you need to run the following command to activate key shortcuts for the session

xbindkeys

Now with the combination you set you should be able to open gnome-terminal to Desktop directory

Note! Using xbindkeys is explained very well and in more detail here

How can I change what keys on my keyboard do? (How can I create custom keyboard commands/shortcuts?)

See Seth's excellent answer on that

jiipeezz
  • 1,256
  • Thanks for your time mate, but I think that just redirection to the other answer would have been enough :). Now, I've took the liberty to add a command I guess you missed. – Diego Nov 05 '16 at 22:45
  • I guess you are right about that :) – jiipeezz Nov 05 '16 at 22:51