Git Product home page Git Product logo

jsystemthemedetector's Introduction

Kotlin Java

Daniel's GitHub stats

Buy Me a Coffee at ko-fi.com

jsystemthemedetector's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jsystemthemedetector's Issues

automatic module cannot be used with jlink

Hai, Thanks For Your work on this lib, I am using it to detect system theme but i am facing the issue with the dependencies

Error: automatic module cannot be used with jlink

I can't use it with the javafx:jlink due to this. Could you update the dependencies to latest version

[MacOS Catalina] NPE: Couldn't execute theme name query with the Os

Hi,
Just noticed this NPE, wondered if this is normal or an OS-related issue somehow.
My code calls OsThemeDetector.getDetector().isDark() at some point, and the full stack trace reads

[AWT-EventQueue-0] ERROR com.jthemedetecor.MacOSThemeDetector - Couldn't execute theme name query with the Os
java.lang.NullPointerException
	at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
	at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
	at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
	at java.base/java.util.regex.Pattern.matcher(Pattern.java:1133)
	at com.jthemedetecor.MacOSThemeDetector.isDarkTheme(MacOSThemeDetector.java:96)
	at com.jthemedetecor.MacOSThemeDetector.isDark(MacOSThemeDetector.java:86)

More specifically, the NPE is due to the following call (within the isDark() method) returning the '0' byte:

Foundation.invoke(userDefaults, "objectForKey:", Foundation.nsString("AppleInterfaceStyle"))

I should mention that this happens during daytime (and luckily isDark() returns false), so no harm done (besides an avoidable(?) pollution of the logger)

Any clue where that might come from?

In case this helps: using version 3.7 @ openjdk11 @ macOS 10.15.7

ConcurrentModificationException

Hi @Dansoftowner

I found this Exception while using jSystemThemeDetector:

WARNING: JNA: Callback com.jthemedetecor.MacOSThemeDetector$1@460d420f threw the following exception
java.util.ConcurrentModificationException
at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1493)
at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1516)
at java.base/java.lang.Iterable.forEach(Iterable.java:74)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2067)
at com.jthemedetector/com.jthemedetecor.MacOSThemeDetector.notifyListeners(MacOSThemeDetector.java:109)
at com.jthemedetector/com.jthemedetecor.MacOSThemeDetector$1.callback(MacOSThemeDetector.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at [email protected]/com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
at [email protected]/com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)

Maybe you could have a look at this?

Thanks and best regards
Stephan

Publish this library to maven central.

Jitpack is not reliable and can't be used in most corporate environments. So please consider publishing this library to maven central. Thank you for the nice work!

Error occurred during initialization of boot layer

Hello,

After including this library in my Java 16 project (using IntelliJ), as soon as I add requires com.jthemedetector; to my module-info.java file, I don't even need to try and include the library in a class at all ... just put that one line in the module file and I get this error during the build process:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules org.apache.commons.collections4 and org.jetbrains.annotations export package org.jetbrains.annotations to module com.sun.jna

And I don't know how to fix it. I'm fairly new with modularized java so I'm kind of at a loss as to what to do... the error is not informative enough - at least for me - to give me a solid direction to go in for correcting the problem.

My pom file has the following:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>16</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>16</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.22</version>
        </dependency>
        <dependency>
            <groupId>com.simtechdata</groupId>
            <artifactId>Switcher</artifactId>
            <version>9.8.7</version>
        </dependency>
        <dependency>
            <artifactId>CustomControls</artifactId>
            <groupId>com.simtechdata</groupId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.dustinredmond.fxtrayicon</groupId>
            <artifactId>FXTrayIcon</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.fuin</groupId>
            <artifactId>utils4j</artifactId>
            <version>0.10.1</version>
        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>11.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.Dansoftowner</groupId>
            <artifactId>jSystemThemeDetector</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>com.github.oshi</groupId>
            <artifactId>oshi-dist</artifactId>
            <version>5.8.2</version>
            <type>pom</type>
        </dependency>
    </dependencies>

and here is my module-info file

module com.simtechdata.vjuice2021 {
	requires javafx.controls;
	requires javafx.fxml;
	requires javafx.graphics;
	requires java.sql;
	requires Switcher;
	requires org.apache.commons.collections4;
	requires com.jthemedetector;


	opens com.simtechdata.vjuice2021 to javafx.fxml;
	exports com.simtechdata.vjuice2021;
}

Any ideas about what might the problem be?

Thank you,

Mike

Error occurred during initialization of boot layer

Good day
I have this error on Eclipse and Netbeans
"Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at [email protected]/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:266)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at [email protected]/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1081)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:833)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1081)
Caused by: java.lang.RuntimeException: No toolkit found
at [email protected]/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:278)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at [email protected]/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 2 more"
i have tried almost everything and i cant solve it, please assist

v3.0 - modularity

Hi!
I added v3.0 to my project.
To make it work I had to "brute force" it by adding "--add-opens com.jthemedetector/com.jthemedetector=com.sun.jna" to my Maven argLine.

Would be nice if I wouldn't have to do this ๐Ÿ˜‰
(Adding an "opens" to the module-info.java" on your side should fix it IMHO.)

Thanks again
Stephan

8 Seconds slow?

So I've got this JavaFX application, launches pretty much instantaneously howver whenever I add
final OsThemeDetector detector = OsThemeDetector.getDetector();
I get a delta of 8185-8180 ms.

long startTime = System.currentTimeMillis();
final OsThemeDetector detector = OsThemeDetector.getDetector();
long endTime = System.currentTimeMillis();
long timeDiff = endTime - startTime;

I'm realy confused how and why this is happening. For now I just threaded the process but you'll still have that 8s delay before it switches darkmode.

NullPointerException with MacOSThemeDetector.isDark on Mac Monterey

	java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
	at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
	at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
	at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
	at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
	at com.jthemedetecor.MacOSThemeDetector.isDarkTheme(MacOSThemeDetector.java:96)
	at com.jthemedetecor.MacOSThemeDetector.isDark(MacOSThemeDetector.java:86)

Maybe Foundation.toStringViaUTF8(Foundation.invoke(userDefaults, "objectForKey:", Foundation.nsString("AppleInterfaceStyle"))) is returning null for some reason. i don't know why.

I'm on MacOS 12.3.1

NullPointerException on Gnome shutdowns

Hi,
I have seen the following NPE a number of times when i shut down my application.

[Exception Chain]:
1: Root-> (NullPointerException) Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null

[Stack trace]:
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
	at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
	at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
	at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
	at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
	at com.jthemedetecor.GnomeThemeDetector$DetectorThread.run(GnomeThemeDetector.java:126)

Exception on Mac when switching to Light Theme

Description

An error occurs when switching back to the light theme under MacOS. The problem is that the string returned by this call is null, which leads to a regex parsing problem:

String appleInterfaceStyle = Foundation.toStringViaUTF8(Foundation.invoke(userDefaults, "objectForKey:", Foundation.nsString("AppleInterfaceStyle")));

(MacOSThemeDetector line 85)

Steps to reproduce

Run the code on:

MacBook Pro
14", 2021
macOS 14.2.1

if (OsThemeDetector.isSupported()) {
    final OsThemeDetector detector = OsThemeDetector.getDetector();
    detector.registerListener(isDark -> {
        Platform.runLater(() -> {
            if (isDark) {
                System.out.println("Dark theme detected");
            } else {
                System.out.println("Light theme detected");
            }
        });
    });
}

Error output

 ERROR com.jthemedetecor.MacOSThemeDetector - Couldn't execute theme name query with the Os
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
        at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
        at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
        at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
        at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
        at com.jthemedetecor.MacOSThemeDetector.isDarkTheme(MacOSThemeDetector.java:96)
        at com.jthemedetecor.MacOSThemeDetector.isDark(MacOSThemeDetector.java:86)
        at com.jthemedetecor.MacOSThemeDetector$1.callback(MacOSThemeDetector.java:47)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:579)
        at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:610)

Another problem with modularity

Hi @Dansoftowner

I found another problem while running my JUnit-Tests:

java.lang.IllegalAccessError: class com.jthemedetecor.util.OsInfo (in module com.jthemedetector) cannot access class oshi.SystemInfo (in unnamed module @0x72cc7e6f) because module com.jthemedetector does not read unnamed module @0x72cc7e6f

	at com.jthemedetector/com.jthemedetecor.util.OsInfo.<clinit>(OsInfo.java:24)
	at com.jthemedetector/com.jthemedetecor.OsThemeDetector.getDetector(OsThemeDetector.java:43)
	at DocumentArchiver/com.sophisticatedapps.archiving.documentarchiver.util.ThemeUtil.<clinit>(ThemeUtil.java:17)
	at DocumentArchiver/com.sophisticatedapps.archiving.documentarchiver.util.ThemeUtilTest.getCurrentTheme(ThemeUtilTest.java:34)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Maybe you could have a look?

Thanks and best regards
Stephan

Failed to load class "org.slf4j.impl.StaticLoggerBinder".

I get these error messages:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

All that I do with this library

val detector = OsThemeDetector.getDetector()
val isDarkThemeUsed = detector.isDark
JOptionPane.showMessageDialog(null, if (isDarkThemeUsed) "You are using dark theme" else "You are using light theme")

Demo app does not work on macOS Big Sur 11.4

When running OsThemeDetectorDemo on Big Sur 11.4, changing the OS theme does not result in any printouts like it should. The isDark function can correctly identify whether or not the system is in dark mode, but the listener is not called when the OS theme is changed.

The value of OsThemeDetector.getDetector().getClass().getName() is com.jthemedetecor.MacOSThemeDetector, so it would appear that this is not an issue of the detector implementation being determined incorrectly.

The graphical demo app does work.

jdeps Exception

Executing command: cmd.exe /s /c "D:\jdk-17.0.8\bin\jdeps -q --multi-release 17 --ignore-missing-deps --print-module-deps D:\IdeaProjects\MooTool\target\MooTool\libs*.jar
Exception in thread "main" java.lang.module.FindException: Module com.sun.jna not found, required by jfa

Automated detection of JavaFX Application Thread

Hi @Dansoftowner

If found an interesting function within the GestureFX code:

	private static void runLaterOrNowIfOnFXThread(Runnable r) {
		if (Platform.isFxApplicationThread()) r.run();
		else Platform.runLater(r);
	}

(see https://github.com/tom91136/GestureFX/blob/master/gesturefx/src/main/java/net/kurobako/gesturefx/GesturePane.java)

I think this could be interesting for jSystemThemeDetector, right!? At least if the library is running within an JavaFX context.

If you would add this to the calling code of the OsThemeDetector Listeners, users wouldn't have to worry about it and you could remove the warning from the README. Or am I missing something here?

Let me know your thoughts.

Best regards
Stephan

SLF4J error

I appear to be getting a non-fatal error with this library. Starting up my app with OSThemeDetector.registerListener() in the main() method gives me this:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.