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

Linux & BSD support #6

Merged
merged 10 commits into from
Jan 17, 2022
Merged

Conversation

Be-ing
Copy link
Collaborator

@Be-ing Be-ing commented Jan 6, 2022

This is #4 squashed and with a few small commits split out, plus updating README.md, formatting changes, and fixing a few clippy warnings.

Be-ing and others added 5 commits January 6, 2022 10:00
Co-authored-by: Eduardo Flores <[email protected]>
Co-authored-by: Eduardo Flores <[email protected]>
Co-authored-by: Eduardo Flores <[email protected]>
First, try XDG Desktop Portal dbus API (compatible with Flatpak
sandboxing). If that does not work, fall back to checking if the
theme name contains the string "dark". Checking the theme name is
supported on:
  - Cinnamon
  - GNOME
  - KDE
  - MATE
  - Unity
  - XFCE

Co-authored-by: Eduardo Flores <[email protected]>
Co-authored-by: Corey Farwell <[email protected]>
@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 6, 2022

Unfortunately it seems the KDE method is not really working. I suggest we change to the same method as KDE's implementation of the XDG Desktop Portal by reading the BackgroundNormal key under Colors:Window in $XDG_CONFIG_DIR/kdeglobals and calculating the grayscale value of that color.

@Be-ing Be-ing mentioned this pull request Jan 6, 2022
@edfloreshz
Copy link
Collaborator

Alright, I'll get on that next 👍

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 6, 2022

Maybe serde_ini could help? I'm not sure.

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 6, 2022

The calculation of the grayscale value with qGray is simply (r * 11 + g * 16 + b * 5)/32.

Added `rgb` method to Mode to implement qGray.
@edfloreshz
Copy link
Collaborator

Done, could you test it before we merge @Be-ing?

@frewsxcv
Copy link
Collaborator

I just enabled GitHub Actions for CI. Mentioning in case you want to merge/rebase to pick that up here

 It now checks `BackgroundNormal` under `Colors:Window`.
@edfloreshz
Copy link
Collaborator

After @Be-ing's approval, we'll be ready for merge @frewsxcv, should we merge or rebase?

@frewsxcv
Copy link
Collaborator

I have no preference between rebasing/merging/squashing. Do whatever you'd like!

@edfloreshz edfloreshz merged commit d882275 into rust-dark-light:master Jan 17, 2022
@edfloreshz
Copy link
Collaborator

Closes #1

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 17, 2022

I tested this on KDE Plasma 5.23.4 on Fedora 34 switching between several color schemes and it works! Great job!

@edfloreshz
Copy link
Collaborator

Awesome! Great job as well @Be-ing and @frewsxcv, cheers 🥂

@edfloreshz
Copy link
Collaborator

By the way, I've been improving the code, looks way better.

I'll try to upload the commit tonight so you can review it in the morning. unless you're a night owl 🦉

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 17, 2022

@frewsxcv shall we make a new release now that this is merged?

@edfloreshz
Copy link
Collaborator

How about we wait until we have #10 ready?

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 17, 2022

#10 may take some time to polish and implement on all platforms. I don't think we need to hold back a release for that. Version numbers are cheap. :)

@edfloreshz
Copy link
Collaborator

Alright then! 👍🏼

@frewsxcv
Copy link
Collaborator

0.2.0 released!

@Be-ing Be-ing deleted the freedesktop branch January 18, 2022 00:11
Be-ing added a commit to Be-ing/rust-dark-light that referenced this pull request Oct 7, 2024
and remove unused code.

Before, the sync and async APIs had completely separate
implementations. When Linux support was first added in
rust-dark-light#6
the XDG Desktop Portal color-scheme API was new and not
yet widely supported, so fallbacks were needed. Now,
the portal API is more widely supported so the fallbacks
are not needed. In my testing, the portal works on:

KDE Plasma
GNOME
Cinnamon
Xfce

MATE does not currently support the portal API. Selecting
MATE's GTK themes from Xfce's settings also does not
change what xdg-desktop-portal-gtk reports. I am not sure,
but I think that may be due to missing metadata in MATE's
GTK themes. The old implementation never worked on MATE
anyway because MATE's dark themes don't have "dark" in
their name, so there's no regression removing it.
Be-ing added a commit to Be-ing/rust-dark-light that referenced this pull request Oct 7, 2024
Before, the sync and async APIs had completely separate
implementations. When Linux support was first added in
rust-dark-light#6
the XDG Desktop Portal color-scheme API was new and not
yet widely supported, so fallbacks were needed. Now,
the portal API is more widely supported so the fallbacks
are not needed. In my testing, the portal works on:

KDE Plasma
GNOME
Cinnamon
Xfce

MATE does not currently support the portal API. Selecting
MATE's GTK themes from Xfce's settings also does not
change what xdg-desktop-portal-gtk reports. I am not sure,
but I think that may be due to missing metadata in MATE's
GTK themes. The old implementation never worked on MATE
anyway because MATE's dark themes don't have "dark" in
their name, so there's no regression removing it.
Be-ing added a commit to Be-ing/rust-dark-light that referenced this pull request Oct 7, 2024
Before, the sync and async APIs had completely separate
implementations. When Linux support was first added in
rust-dark-light#6
the XDG Desktop Portal color-scheme API was new and not
yet widely supported, so fallbacks were needed. Now,
the portal API is more widely supported so the fallbacks
are not needed. In my testing, the portal works on:

KDE Plasma
GNOME
Cinnamon
Xfce

MATE does not currently support the portal API. Selecting
MATE's GTK themes from Xfce's settings also does not
change what xdg-desktop-portal-gtk reports. I am not sure,
but I think that may be due to missing metadata in MATE's
GTK themes. The old implementation never worked on MATE
anyway because MATE's dark themes don't have "dark" in
their name, so there's no regression removing it.
Be-ing added a commit to Be-ing/rust-dark-light that referenced this pull request Oct 8, 2024
Before, the sync and async APIs had completely separate
implementations. When Linux support was first added in
rust-dark-light#6
the XDG Desktop Portal color-scheme API was new and not
yet widely supported, so fallbacks were needed. Now,
the portal API is more widely supported so the fallbacks
are not needed. In my testing, the portal works on:

KDE Plasma
GNOME
Cinnamon
Xfce

MATE does not currently support the portal API. Selecting
MATE's GTK themes from Xfce's settings also does not
change what xdg-desktop-portal-gtk reports. I am not sure,
but I think that may be due to missing metadata in MATE's
GTK themes. The old implementation never worked on MATE
anyway because MATE's dark themes don't have "dark" in
their name, so there's no regression removing it.
Be-ing added a commit that referenced this pull request Oct 8, 2024
Before, the sync and async APIs had completely separate
implementations. When Linux support was first added in
#6
the XDG Desktop Portal color-scheme API was new and not
yet widely supported, so fallbacks were needed. Now,
the portal API is more widely supported so the fallbacks
are not needed. In my testing, the portal works on:

KDE Plasma
GNOME
Cinnamon
Xfce

MATE does not currently support the portal API. Selecting
MATE's GTK themes from Xfce's settings also does not
change what xdg-desktop-portal-gtk reports. I am not sure,
but I think that may be due to missing metadata in MATE's
GTK themes. The old implementation never worked on MATE
anyway because MATE's dark themes don't have "dark" in
their name, so there's no regression removing it.
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.

3 participants