This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So, a while back I started trying to create shortcuts that would open the terminal, and automatically cd to my bookmarked directories. I tried a few ways without much success, but this is how I ended up managing it.
So, the file that stores the bookmarks is
~/.config/gtk-3.0/bookmarks
And it lists, in order, every directory I have bookmarked. My objective is to have shortcuts such that ctrl 1 opens the first bookmark, ctrl 2 the second one, ctrl 3 the third, etc. So the first thing to do is creating a script, I will call it "bookmark", with the following code:
u="$(sed "$1q;d" '/home/joaquin/.config/gtk-3.0/bookmarks')";
gnome-terminal --working-directory="${u:7}";
The first line sets a variable "u" equal to the Nth line of the file. To get "N", we read $1, the first argument passed to the command call. The second line, calls gnome-terminal with that starting directory, slicing the first seven characters because they aren't of use here.
Next, I go to settings > keyboard shortcuts, and create a shortcut for ctrl 1 with the following code (replace the path with the path to the script created)
/home/username/Scripts/bookmark 1
and for ctrl 2
/home/username/Scripts/bookmark 2
that last number will be passed as the argument for the script, and the script will open a terminal in the correct directory.
Hope this helps someone.
Subreddit
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/gnome/comme...