Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple theme directories. #1739

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alebastr
Copy link
Contributor

Interpret ThemeDir option as a comma-separated list of directories. Similar to the recent change in SessionDir handling, the option name is preserved for compatibility.

Fixes #1561


This probably should default to QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QLatin1String("themes"), QStandardPaths::LocateDirectory); (filtering out ~/*), but it seems a bit too much of a change when sddm is close to release.

@Vogtinator
Copy link
Contributor

LGTM, but I wonder whether this is really useful without using this functionality by default.

Currently if something touches the configuration to set Theme=, it can already set the ThemeDir to wherever it is.

@Vogtinator
Copy link
Contributor

This probably should default to QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QLatin1String("themes"), QStandardPaths::LocateDirectory); (filtering out ~/*), but it seems a bit too much of a change when sddm is close to release.

If ~ is filtered out anyway this can just be hardcoded to CMAKE_INSTALL_PREFIX "/local/share/sddm/themes/," CMAKE_INSTALL_PREFIX "/share/sddm/themes/" or similar.

@alebastr
Copy link
Contributor Author

LGTM, but I wonder whether this is really useful without using this functionality by default.

Currently if something touches the configuration to set Theme=, it can already set the ThemeDir to wherever it is.

A reasonable value could be something that resolves into /usr/local/share/sddm/themes,/usr/share/sddm/themes. The problem is, which one of those is DATA_INSTALL_DIR "/themes"? Does it have to be a third entry in the list?
With immutable variants of Fedora we know the installation path and I can ask the maintainer to add more directories to the default config patch. I didn't want to make that guess for all supported systems.

If ~ is filtered out anyway this can just be hardcoded to CMAKE_INSTALL_PREFIX "/local/share/sddm/themes/," CMAKE_INSTALL_PREFIX "/share/sddm/themes/" or similar.

There's a small but important difference: QStandardPaths::AppDataLocation/QStandardPaths::GenericDataLocation will follow XDG_DATA_DIRS if set. Although it's more important for SessionDir.

@Vogtinator
Copy link
Contributor

LGTM, but I wonder whether this is really useful without using this functionality by default.
Currently if something touches the configuration to set Theme=, it can already set the ThemeDir to wherever it is.

A reasonable value could be something that resolves into /usr/local/share/sddm/themes,/usr/share/sddm/themes. The problem is, which one of those is DATA_INSTALL_DIR "/themes"?

Depends on CMAKE_INSTALL_PREFIX. That can be /usr, /usr/local or something like /opt/work/sddm-git-builds/foobar.

Does it have to be a third entry in the list? With immutable variants of Fedora we know the installation path and I can ask the maintainer to add more directories to the default config patch. I didn't want to make that guess for all supported systems.

If ~ is filtered out anyway this can just be hardcoded to CMAKE_INSTALL_PREFIX "/local/share/sddm/themes/," CMAKE_INSTALL_PREFIX "/share/sddm/themes/" or similar.

There's a small but important difference: QStandardPaths::AppDataLocation/QStandardPaths::GenericDataLocation will follow XDG_DATA_DIRS if set. Although it's more important for SessionDir.

The issue with that is that following XDG_DATA_DIRS can only happen if ThemeDir is not set. If it's set, there's no way to indicate that XDG_DATA_DIRS should be followed anyway, at least not if it's just used as default value.

@aidzmtsk
Copy link

Hello, what's the status of this PR?

@Vogtinator
Copy link
Contributor

Hello, what's the status of this PR?

Waiting for my comment to be addressed mostly.

What's your specific usecase for this? Might help in finding a proper default value.

@alebastr alebastr force-pushed the theme-dir-list branch 2 times, most recently from d699e00 to decdce8 Compare January 25, 2024 03:32
Interpret `ThemeDir` option as a comma-separated list of directories.
Similar to the recent change in `SessionDir` handling, the option name
is preserved for compatibility.

The default list of theme directories can be modified via
`-DTHEME_DIRS:STRING=a,b,c` cmake option.
@aidzmtsk
Copy link

Hello, what's the status of this PR?

Waiting for my comment to be addressed mostly.

What's your specific usecase for this? Might help in finding a proper default value.

I just wanted to try out Global Themes on Fedora Kinoite (Immutable/Atomic KDE).

With Fedora 40 and Plasma 6 nearing, I was wondering whether or not a fix was already done for the issue where you can't install Global Themes on Immutable/Atomic Desktops. It's not urgent as I've been comfortably using Breeze but wanted to see if there was anyone actively working on the issue.

@bayazidbh
Copy link

To add, the immutability of /usr has caused Global Themes install to not succeed due to some of them including SDDM themes in it. Ideally, it should be someplace in /var or /home (well, strictly speaking, /home is just mounted from /var anyways). I don't think /etc is the correct directory for the themes, though.

@Vogtinator
Copy link
Contributor

With Fedora 40 and Plasma 6 nearing, I was wondering whether or not a fix was already done for the issue where you can't install Global Themes on Immutable/Atomic Desktops. It's not urgent as I've been comfortably using Breeze but wanted to see if there was anyone actively working on the issue.

That's an issue with kcm_sddm, it cannot be addressed in sddm.

@bayazidbh
Copy link

bayazidbh commented Jan 28, 2024

@Vogtinator regarding Global Themes, true. The main thing is that I'd like to have a way to add sddm themes without relying on making a package and layering that package due to /usr immutability.

I'd say either /etc/sddm or /var/usrlocal/share/sddm make sense as a new default if you want to account for immutable distro - I don't think $HOME/.local/share/sddm make sense as a default, but as a non-default it could be added.

Once this is done, we can then move to kcm_sddm for either adding directory choice to install sddm themes in, or just request for the default to be changed to mutable /var, /etc, or /home directories.

@Vogtinator
Copy link
Contributor

Vogtinator commented Jan 29, 2024

@Vogtinator regarding Global Themes, true. The main thing is that I'd like to have a way to add sddm themes without relying on making a package and layering that package due to /usr immutability.

You can already do that.

Just put the theme into , /etc/sddm-themes/whatever//var/lib/sddm-themes/whatever and set

[Theme]
ThemeDir=/var/lib/sddm-themes/
Current=whatever

@Heus-Sueh
Copy link

@Vogtinator regarding Global Themes, true. The main thing is that I'd like to have a way to add sddm themes without relying on making a package and layering that package due to /usr immutability.

You can already do that.

Just put the theme into , /etc/sddm-themes/whatever//var/lib/sddm-themes/whatever and set

[Theme]
ThemeDir=/var/lib/sddm-themes/
Theme=whatever

Is this possible in the current version?
image

@Vogtinator
Copy link
Contributor

@Vogtinator regarding Global Themes, true. The main thing is that I'd like to have a way to add sddm themes without relying on making a package and layering that package due to /usr immutability.

You can already do that.
Just put the theme into , /etc/sddm-themes/whatever//var/lib/sddm-themes/whatever and set

[Theme]
ThemeDir=/var/lib/sddm-themes/
Theme=whatever

Is this possible in the current version? image

It's not Theme=, but Current=, I edited my comment. Other than that it works like that in pretty much any version.

You should put the theme somewhere outside of your home directory for security reasons.

@Heus-Sueh
Copy link

In relation to security, do themes really have the power to cause such danger while being on the user's home? Has this already been discussed here or elsewhere?

@Vogtinator
Copy link
Contributor

In relation to security, do themes really have the power to cause such danger while being on the user's home?

The concern here is that the theme code is executed as the sddm user but another unprivileged user has write permissions.

@Heus-Sueh
Copy link

Heus-Sueh commented Mar 16, 2024

In relation to security, do themes really have the power to cause such danger while being on the user's home?

The concern here is that the theme code is executed as the sddm user but another unprivileged user has write permissions.

I see, thanks for the clarification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Support themes installed in two file system locations
5 participants