Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] interpolate $HOME and/or ~ in config #1892

Closed
2 tasks done
nioncode opened this issue Aug 24, 2023 · 3 comments
Closed
2 tasks done

[REQUEST] interpolate $HOME and/or ~ in config #1892

nioncode opened this issue Aug 24, 2023 · 3 comments
Milestone

Comments

@nioncode
Copy link

Before opening a feature request

  • I checked the next branch to see if the feature has already been implemented
  • I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

It would be nice if either $HOME or ~ (or both) get interpolated in the config file to point to the user's home directory.

Currently, I have to set cache-dir: "/home/nion/.local/share/rofi/rofi.cache"; instead of being able to use something like cache-dir: "~/.local/share/rofi/rofi.cache"; as in most configurations. This makes the config not portable across different usernames.

How do you know that this problem exists today? Why is this important?

Without path interpolation, the config is not portable and cannot be shared between different users.

Who will benefit from it?

Everyone who uses the cache-dir setting (or other paths?) with different user names.

Rofi version (rofi -v)

1.7.5

Configuration

https://gist.github.com/nioncode/5d0b5d640df770047a5bc38a4a3efc6f

Additional information

No response

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Aug 24, 2023

Normally it should resolve using this:

On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be XDG_CACHE_HOME.

On Windows it follows XDG Base Directory Specification if XDG_CACHE_HOME is defined. If XDG_CACHE_HOME is undefined, the directory that serves as a common repository for temporary Internet files is used instead. A typical path is C:\Documents and Settings\username\Local Settings\Temporary Internet Files. See the documentation for FOLDERID_InternetCache.

So it should be perfectly portable between users as there should be 0 use for setting a custom cache-dir.

I will fix the handling and auto expand ~{user}/ as that is a trivial fix.

@DaveDavenport DaveDavenport added this to the 1.7.6 milestone Aug 24, 2023
@nioncode
Copy link
Author

Thank you for the fast implementation, I successfully tested with cache-dir: "~/.local/share/rofi/rofi.cache"; 👍

So it should be perfectly portable between users as there should be 0 use for setting a custom cache-dir.

I'm setting cache-dir to move the command history into a persistent place (see #769), since caches are commonly skipped by many backup tools, but I want to preserve my command history.

Are there any other things that are stored in the cache in addition to the command history? I only have rofi-3.runcache in my cache folder.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants