Environment Variable in Path Configuration
Flameshot Version
Flameshot v13.1.0
Installation Type
Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)
Operating System type and version
NixOS
Description
If I set the savePath option to $HOME/Pictures/Screenshots, the program say that the path does not exist.
I have tried to edit the source code, but I can not find where to expand the path.
Steps to reproduce
- Write
savePath=$HOME/Picturesinto.config/flameshot.ini. - Run
flameshot gui
Screenshots or screen recordings
No response
System Information
- NixOS 25.11 (Xantusia) x86_64
@mmahmoudian my $0,02 is this should stay outside of Flameshot.We would first need to parse the save path to detect in there is an environmental variable. Then we would need to expand that ourselves. This would need to work differently on windows vs unix.
@Fovir-GitHub This is duplicate of
- #3041
- #3442
- And partly discussed in #2314
@borgmanJeremy for my own curiosity I was searching to see if Qt has anything to offer. It seems there are two functions for this, i.e., qEnvironmentVariable and qgetenv, but I'm not sure if they both are working cross platform:
https://doc.qt.io/qt-6/qtenvironmentvariables.html#qEnvironmentVariable
If Qt is expanding it for us, in a cross platform way, then it would reduce the maintenance load for us. I also don't think that env. vars can be used as an attack surface, but even if that's the case, it would be entirely users' responsibility for having such config on their system 🤷
The only case that I can imagine having an environmental variable is handy in the config is when the user wants to keep the same config across different machines with different username (e.g., home and work).