84
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 16 May 2025
84 points (90.4% liked)
Linux
54200 readers
527 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 6 years ago
MODERATORS
I hear your frustration. It can be annoying. There's a reason for it, and that's because environment variables are limited in their use by scoping: they're only inherited from the parent to children, and they're pass-by-value. This means that, from a child process, you can't influence the variables for any other sibling, or the parent. There's no way to propagate environment variables to anyone except new children you fork.
This is a significant limitation. There is no work around using only environment variables. It's a large part of why applications store scalar values in files: it's (almost) the only environmentally agnostic way to propagate information to other processes.
Herbstluftwm has
herbstclient getenv
andsetenv
, because ostensibly every user process is a child of the window manager, and it's a convenient way to communicate scalar changes between processes. tmux has similar commands; in both cases, the source of truth is the parent application, not the environment. gsettings is just Gnome's version; KDE has it's own version. I'd be surprised if Sway didn't.Environment variables are great, but they're limited, and they are simply unsuitable for purposes. They're also insecure: anyone with the right permissions can read them from
/proc
. The consequence is that it can be difficult to track down where settings are stored, especially if you're still using some component of a desktop, which tend to manage all of their settings internally.We do have a global solution for Linux: the kernel keyring. It's secure, and global. It is not, however, automatically persisted, although desktops could easily persist and restore values from the keyring when they shut down or start up. Every desktop I know just keeps it's own version of what's essentially the Windows registry.
It's a mess.