[SOLVED] Location of Favorites folder?

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
smjure
Level 1
Level 1
Posts: 21
Joined: Thu Feb 13, 2020 12:45 am

[SOLVED] Location of Favorites folder?

Post by smjure »

May I ask where's the Favorite folder located.
[img]file:///home/oem/Pictures/2023-01-24_20-30.png[/img]
The path is to 'favorites:///' which I cannot use in script for keyboard shortcut, which I'd like to do. If I right click it and open in terminal, it opens in root folder where 'Favorites' are not there. Please, what's the path to the Favorites?
Last edited by LockBot on Tue Jul 25, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: Location of Favorites folder?

Post by xenopeek »

That a file is a favorite is stored in its metadata and in a list in user settings.

To start with the latter you can get the list of favorites with command gsettings get org.x.apps.favorites list or dconf read /org/x/apps/favorites/list. The output isn't directly usable in bash but we can get much closer by using jq. First, apt install jq to get it. Then you can run the command like so

Code: Select all

gsettings get org.x.apps.favorites list | tr "'" '"' | jq -rM '.[]'
and that will get you a nicer one file per line output though you still will need some further processing to cut off the ::mimetype part and probably convert the URI to a plain file path. Exercise for the reader. The tr "'" '"' is needed because jq expects double quotes but the gsettings/dconf output has single quotes.

To get the metadate of a file you can run gio info metadata::xapp-favorite /path/to/file but you'd have to run that on each file so this is probably not useful to what you're trying to do.
Image
smjure
Level 1
Level 1
Posts: 21
Joined: Thu Feb 13, 2020 12:45 am

Re: Location of Favorites folder?

Post by smjure »

Sorry regarding the image, here it is:
Image

Thank you, I did not expect to be so complicated just to do a keyboard shortcut to Favorites :) but will try to do some workaround.
Last edited by xenopeek on Wed Jan 25, 2023 4:42 am, edited 1 time in total.
Reason: fixed image link
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: Location of Favorites folder?

Post by xenopeek »

What do you want to do with favorites on the keyboard shortcut?
Image
smjure
Level 1
Level 1
Posts: 21
Joined: Thu Feb 13, 2020 12:45 am

Re: Location of Favorites folder?

Post by smjure »

With keyboard shortcut, I'd just like to open the folder Favorites 🙏🏻
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: Location of Favorites folder?

Post by xenopeek »

Okay. From your screenshot, this command works to open favorites:
nemo favorites:///

That opens a new Nemo window on favorites. Use nemo --existing-window favorites:/// if you want to open it in a tab in an existing Nemo window.
Image
smjure
Level 1
Level 1
Posts: 21
Joined: Thu Feb 13, 2020 12:45 am

Re: Location of Favorites folder?

Post by smjure »

Thank you kindly 🙏🏻
Locked

Return to “Scripts & Bash”