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

Feature/Linux KDE Plasma Desktop environment support #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

EchoEllet
Copy link

@EchoEllet EchoEllet commented May 18, 2024

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:

  • Update the README.md to mention which Linux desktop environments are supported and what are the limitations
  • Fix the desktop environment check-in isGnome 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 Gnome
  • Use System.getenv instead of running a process to get output from the terminal for checking isGnome and isKde
  • Add isKde method check in the isSupported static method and in createDetector
  • Add 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 the LookAndFeelPackage 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 contains dark in a non-case sensitive way

The 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.

Ellet added 2 commits May 18, 2024 21:40
…nvironment check, use System.getenv instead of Process in the desktop environment check
@EchoEllet EchoEllet changed the title Feature/kde support Feature/Linux KDE Plasma Desktop environment support May 18, 2024
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.

add KDE support
1 participant