flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

Environment Variable in Path Configuration

Open Fovir-GitHub opened this issue 2 months ago • 2 comments

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

  1. Write savePath=$HOME/Pictures into .config/flameshot.ini.
  2. Run flameshot gui

Screenshots or screen recordings

No response

System Information

  1. NixOS 25.11 (Xantusia) x86_64

Fovir-GitHub avatar Oct 13 '25 08:10 Fovir-GitHub

@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.

borgmanJeremy avatar Oct 27 '25 01:10 borgmanJeremy

@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).

mmahmoudian avatar Oct 27 '25 07:10 mmahmoudian