Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

3
My experience creating shortcuts to cd to Files bookmarks
Post Body

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.

Author
Account Strength
100%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
30,604
Link Karma
7,785
Comment Karma
21,248
Profile updated: 4 days ago
Posts updated: 8 months ago
GNOMie

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago