Feature/Linux KDE Plasma Desktop environment support #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adding support for checking is a dark mode for the Linux desktop environment without any breaking changes affecting anything else or doing further code refactoring
The changes are:
README.md
to mention which Linux desktop environments are supported and what are the limitationsisGnome
in order to fix a bug that will happen when you have installed both KDE plasma desktop and Gnome on the same distro, the previous check will return true if the Gnome Desktop environment was installed regardless of the current used desktop environment is KDE or GnomeSystem.getenv
instead of running a process to get output from the terminal for checkingisGnome
andisKde
isKde
method check in theisSupported
static method and increateDetector
KdeThemeDetector
, since there is no way to check if the system is dark or light and we only can get the installed look and feel packages and the current used one, using this command :grep "^LookAndFeelPackage=" ~/.config/kdeglobals | awk -F "=" '{print $2}'
would work and print the currently used look and feel package name, instead I used
FileReader
and read the file and got theLookAndFeelPackage
property, the check will check if it's one of the defined dark look and feel packages, if not then it will check if it containsdark
in a non-case sensitive wayThe listeners are not supported yet as it would require more time and testing, I was hoping for an example module to simplify the development for all the developers to try and test, we might need to write a few tests too
I used a virtual machine and copied the source code into an example project to test the change since I couldn't switch to my Linux machine
KDE Plasma desktop doesn't have any straight way to check if the theme is dark or not in the terminal so searching online for
A Linux command on KDE Plasma Desktop to check if the theme is dark or light
will probably mention that you need a third party package installed on the system.Related issues:
Testing
I tested the changes on Ubuntu which has the default gnome desktop environment and KDE plasma desktop installed, I switched to both and tested the changes to ensure to not create any new bugs with this feature but still more testing is welcome
I would like to thank you for your efforts for this library, I also noticed some areas for potential improvement that are outside of the purpose of this feature.
Feel free to ask for any additional changes.