Closed Vladimir-csp closed 4 months ago
XDG variables in emptty are mostly handled as fallbacks for software compatibility. I have no intention to rely on XDG variables since emptty was meant for distros, that don't need them too. The plan is to support only those variables, that are necessary for compatibility. Also scanning more directories would be slower on many (non-SSD) devices.
But even if those variables are empty or not defined, their spec defaults are valid places to look for session entries. /usr/local/share/wayland-sessions
may be used by local admins, ${HOME}/.local/share/wayland-sessions
can be used by users. Listing dirs can be pretty cheap even on HDDs, reading files is the main hog.
Well, I thought you insist specifically on $XDG_DATA_HOME
or $XDG_DATA_DIRS
which I've seen in horrible states (more than 50 directories). That's why I was against it; listing multiple folders would be extremely slow. Especially when the desktop files are read during the listing.
${HOME}/.local/share/wayland-sessions
and ${HOME}/.local/share/xsessions
are small addition and could be easily done.
If user has 50 items in $XDG_DATA_DIRS
, there's probably something wrong on user's side.
Implementing hardcoded paths may not be a good idea since any of those vars can be defined via systemd's environment.d
mechanism and be already present for processes launched in user session context. In this case there is a potential for unexpected behavior from user's point of view.
In a generic default case only 6 dirs would be listed, most of which would not exist. And in case they do exist and contain overrides, there is no need to even read the same entries higher in the hierarchy.
...there seems to be no checks for Hidden
/NoDisplay
keys. A predictable thing to do to disable an option would be to put an entry with Hidden=true
to a lower place of hiearachy, i.e. /usr/local/share/wayland-sessions/
(by a local admin for all local users) or $HOME/.local/share/wayland-sessions/
(by a user).
As I mentioned, I'm not planning using XDG vars this way. I can revert previous commit to avoid any potential unexpected behaviour.
Hidden
and NoDisplay
seem nice to be implemented.
Please consider using
${XDG_DATA_HOME:-"${HOME}/.local/share"}:${XDG_DATA_DIRS:-"/usr/local/share/:/usr/share/"}
for searchingwayland-sessions
andxsessions
subdirs, as per XDG Base Directory Specification. This would augment/replaceemptty/custom-sessions/
with a more predictable set of places.