20
849
Fork
You've already forked fuzzel
83

Have the cache configuration entry understand environment variables #721

Open
opened 2025年12月31日 14:42:06 +01:00 by ccjmne · 7 comments

Pre-checks

Describe your feature request

I'd love to be able to have, in fuzzel.ini:

[main]
cache = $XDG_CACHE_HOME/fuzzel/xdg-apps

But alas, that seems to be unrecognised.
It looks like even the following doesn't quite work:

[main]
cache = ~/cache/fuzzel/xdg-apps

Apparently, the full absolute path needs to be spelled out:

[main]
cache = /home/ccjmne/cache/fuzzel/xdg-apps

Not a big deal, but it'd be nice to have nonetheless! I'm actually somewhat surprised that's unsupported and I suppose I may be missing something quite glaring... My apologies in advance.

### Pre-checks - [x] The [fuzzel.ini](https://codeberg.org/dnkl/fuzzel/src/branch/master/doc/fuzzel.ini.5.scd) and [fuzzel](https://codeberg.org/dnkl/fuzzel/src/branch/master/doc/fuzzel.1.scd) man pages. - [x] [Changelog](https://codeberg.org/dnkl/fuzzel/src/branch/master/CHANGELOG.md#unreleased) of newer and unreleased features ### Describe your feature request I'd love to be able to have, in fuzzel.ini: ```dosini [main] cache = $XDG_CACHE_HOME/fuzzel/xdg-apps ``` But alas, that seems to be unrecognised. It looks like even the following doesn't quite work: ```dosini [main] cache = ~/cache/fuzzel/xdg-apps ``` Apparently, the full absolute path needs to be spelled out: ```dosini [main] cache = /home/ccjmne/cache/fuzzel/xdg-apps ``` Not a big deal, but it'd be nice to have nonetheless! I'm actually somewhat surprised that's unsupported and I suppose I may be missing something quite glaring... My apologies in advance.
Collaborator
Copy link

Currently docs for the cache key say " Specify the default cache location. " and don't specify how relative and absolute handling work.

Another option besides parsing the env var is to start interpreting relative paths relative to $XDG_CACHE_HOME and continue to handle absolute paths as before.

Currently docs for the `cache` key say " Specify the default cache location. " and don't specify how relative and absolute handling work. Another option besides parsing the env var is to start interpreting relative paths relative to $XDG_CACHE_HOME and continue to handle absolute paths as before.
Author
Copy link

Oh, that'd be excellent! You are good at this.

Oh, that'd be excellent! You are good at this.
Author
Copy link

@markstos, I haven't written any C code since my university days, but I had a quick look at the code and I think implementing your suggestion seems easy enough that I could handle it.

Would you mind giving me some time this afternoon so I familiarise myself again a bit with the tooling and this codebase, and try to address this? :)

@markstos, I haven't written any C code since my university days, but I had a quick look at the code and I think implementing your suggestion seems easy enough that I could handle it. Would you mind giving me some time this afternoon so I familiarise myself again a bit with the tooling and this codebase, and try to address this? :)
Owner
Copy link

Right, there's actually no validation or expansion done on the cache config value. In foot, we enforce paths to either be absolute, or on the form ~/path.

If that's good enough, I'd prefer that solution, to keep parsing and behavior consistent across fuzzel and foot.

If it's not good enough, I think I'd prefer it if we disallow relative paths, and instead expand environment variables. It's much more obvious what cache=$XDG_CACHE_HOME/foobar means, compared to cache=foobar.

Right, there's actually no validation or expansion done on the cache config value. In foot, we enforce paths to either be absolute, or on the form `~/path`. If that's good enough, I'd prefer that solution, to keep parsing and behavior consistent across fuzzel and foot. If it's not good enough, I think I'd prefer it if we disallow relative paths, and instead expand environment variables. It's much more obvious what `cache=$XDG_CACHE_HOME/foobar` means, compared to `cache=foobar`.
Collaborator
Copy link

t's much more obvious what cache=$XDG_CACHE_HOME/foobar means, compared to cache=foobar.

Great point. People have a lot of tools they deal with, and explicitness avoid people wandering relative to WHAT.

@dnkl's ideas here are better than my proposal.

> t's much more obvious what cache=$XDG_CACHE_HOME/foobar means, compared to cache=foobar. Great point. People have a lot of tools they deal with, and explicitness avoid people wandering *relative to WHAT*. @dnkl's ideas here are better than my proposal.
Contributor
Copy link

This, #764 and the fact that include config option does support ~ really confused me for a bit.

workaround:

fuzzel.ini: (in dotfiles)

include=~/.config/fuzzel/fuzzel-cache.ini

fuzzel-cache.ini: (.gitignore for dotfiles, one per machine)

cache=/home/USER/.cache/fuzzel/default
This, #764 and the fact that `include` config option does support `~` really confused me for a bit. workaround: `fuzzel.ini`: (in dotfiles) ```ini include=~/.config/fuzzel/fuzzel-cache.ini ``` `fuzzel-cache.ini`: (.gitignore for dotfiles, one per machine) ```ini cache=/home/USER/.cache/fuzzel/default ```

If this was implemented, would it mean that an environmental variable could be used for the terminal option as well?

If this was implemented, would it mean that an environmental variable could be used for the ```terminal``` option as well?
Sign in to join this conversation.
No Branch/Tag specified
master
gnome-support
releases/1.14
issue-319-window-switching
issue-561-nord-theme-only
resvg-filtering-take-2
resvg-filtering
releases/1.13
rehanzo-dont-ignore-execute-648
keybinds-overwrite
issue-561-refresh-theme
ci-automated-testing
reenable-legacy-icons
releases/1.12
test-coverage-for-fzf-caching
releases/1.11
releases/1.10
releases/1.9
releases/1.8
releases/1.7
releases/1.6
releases/1.5
releases/1.4
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.14.1
1.14.0
1.13.1
1.13.0
1.12.0
1.11.1
1.11.0
1.10.2
1.10.1
1.10.0
1.9.2
1.9.1
1.9.0
1.8.2
1.8.1
1.8.0
1.7.0
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.2
1.4.1
1.4.0
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0
0.9.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fuzzel#721
Reference in a new issue
dnkl/fuzzel
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?