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 support #4

Closed
wants to merge 24 commits into from
Closed

Linux support #4

wants to merge 24 commits into from

Conversation

edfloreshz
Copy link
Collaborator

@edfloreshz edfloreshz commented Sep 1, 2021

This PR adds support for Linux by implementing the FreeDesktop standard color-scheme key.

In the event this key isn't present in the system, the crate will fallback to traditional ways of figuring out if dark mode is enabled.

This PR is ready to be merged.

Fixes #1

Support for kde plasma implemented.
Implemented check_dconf for GTK based Desktop Environments.
Implemented check_file to read from configuration files.
Implemented cases for:
- Cinnamon
- Gnome
- MATE
- Unity
- XFCE
@edfloreshz
Copy link
Collaborator Author

edfloreshz commented Sep 2, 2021

The last commit implemented detect() for many distros, I would appreciate some help testing it.

Cargo.toml Show resolved Hide resolved
src/linux.rs Outdated Show resolved Hide resolved
src/linux.rs Outdated Show resolved Hide resolved
edfloreshz and others added 4 commits September 21, 2021 07:01
Co-authored-by: Corey Farwell <coreyf@rwell.org>
Co-authored-by: Corey Farwell <coreyf@rwell.org>
@frewsxcv
Copy link
Owner

Is this pull request still in-progress?

@edfloreshz
Copy link
Collaborator Author

edfloreshz commented Nov 12, 2021

Been kinda busy but still in-process.

Converting to draft.

@edfloreshz edfloreshz marked this pull request as draft November 12, 2021 05:35
@Be-ing
Copy link
Collaborator

Be-ing commented Dec 24, 2021

This should prefer the new Freedesktop standard and fall back to legacy desktop environment specific methods if that is not available.

@edfloreshz
Copy link
Collaborator Author

I will take a look at it.

@edfloreshz
Copy link
Collaborator Author

I added initial support for FreeDesktop's color-scheme key, I would appreciate some help testing this code as I don't currently have this key present in my system.

Cargo.toml Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@edfloreshz edfloreshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready to merge, already tested the new color-scheme implementation.

I will make the required changes to macOS and Windows to accommodate the Result we return from main now.

@edfloreshz edfloreshz marked this pull request as ready for review January 5, 2022 21:58
src/linux.rs Outdated Show resolved Hide resolved
src/linux.rs Outdated Show resolved Hide resolved
@edfloreshz
Copy link
Collaborator Author

This should be ready to merge now 🙂

src/linux.rs Outdated Show resolved Hide resolved
@edfloreshz
Copy link
Collaborator Author

I got a 404 when I clicked the invitation 🤔

@frewsxcv
Copy link
Owner

frewsxcv commented Jan 6, 2022

@edfloreshz
Copy link
Collaborator Author

Got it! Thanks 🙏🏼

src/linux.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@edfloreshz edfloreshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, all reviews have been resolved, I would suggest we test this thing out before we merge it @Be-ing

Cargo.toml Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
@Be-ing
Copy link
Collaborator

Be-ing commented Jan 6, 2022

I would suggest we test this thing out before we merge it

How about I rebase and clean up the Git history tomorrow and open a new pull request before merging? I'll do some testing on all the supported desktop environments too.

@edfloreshz
Copy link
Collaborator Author

I would suggest we test this thing out before we merge it

How about I rebase and clean up the Git history tomorrow and open a new pull request before merging? I'll do some testing on all the supported desktop environments too.

Sounds good! Let me know if you notice something else.

@edfloreshz
Copy link
Collaborator Author

edfloreshz commented Jan 6, 2022

How about I rebase and clean up the Git history tomorrow and open a new pull request before merging? I'll do some testing on all the supported desktop environments too.

We can squash all the commits into one, edit the commit message and merge right from GitHub, we don't have to open another PR. @Be-ing

I have redacted the following commit message, let me know your thoughts.

* Linux support

This PR implements support for Linux/BSD by using the FreeDesktop Color Scheme Standard.
On supported systems this will be the preferred option, otherwise it will use 
traditional methods to determine the current state of the OS color scheme.

If that's the case, the following distributions have been implemented so far:

- KDE Plasma
- GNOME
- Mate
- Unity
- XFCE
- Cinnamon

The rest of the distros will fall back to light mode.

We will be implementing more of them in the future.

Changelog:
- Adopted FreeDesktop Color Scheme Standard using `zbus`.
- Marked dependencies as Linux/BSD only.
- Implemented `Mode` and created `from` function that takes a bool and returns either `Light` or `Dark`.
- Implemented `check_dconf` for GNOME based Desktop Environments. 
- Implemented `check_file` to read from configuration files for other distributions.

Co-authored-by:

- Corey Farwell <coreyf@rwell.org>
- Funami580 <Funami580@users.noreply.github.com>
- Be <be.0@gmx.com>

If you're okay with this commit message let me know after you're done testing so I can merge.

@edfloreshz edfloreshz reopened this Jan 6, 2022
@edfloreshz edfloreshz self-assigned this Jan 6, 2022
@edfloreshz edfloreshz added the enhancement New feature or request label Jan 6, 2022
@Be-ing Be-ing mentioned this pull request Jan 6, 2022
@Be-ing
Copy link
Collaborator

Be-ing commented Jan 6, 2022

I did a bit more than squashing to one big commit, see #6.

@edfloreshz
Copy link
Collaborator Author

Closing because of #6

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

Successfully merging this pull request may close these issues.

Linux support?
5 participants