mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-23 18:41:24 -08:00
Keybindings: Catch even more errors, and manually check that operating system is Windows
This commit is contained in:
1 parent
ad03caa064
commit
e58706d212
2 files changed
+16
-6
No files matched your search
@@ -1,11 +1,12 @@
|
||||
package dev.slimevr.gui;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.melloware.jintellitype.HotkeyListener;
|
||||
import com.melloware.jintellitype.JIntellitype;
|
||||
import com.melloware.jintellitype.JIntellitypeException;
|
||||
|
||||
import dev.slimevr.VRServer;
|
||||
|
||||
import com.melloware.jintellitype.HotkeyListener;
|
||||
import io.eiren.util.ann.AWTThread;
|
||||
import io.eiren.util.logging.LogManager;
|
||||
|
||||
@@ -18,6 +19,17 @@ public class Keybinding implements HotkeyListener {
|
||||
public Keybinding(VRServer server) {
|
||||
this.server = server;
|
||||
|
||||
try {
|
||||
String osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
|
||||
if(!osName.contains("windows")) {
|
||||
LogManager.log.info("[Keybinding] Currently only supported on Windows. Keybindings will be disabled.");
|
||||
return;
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
LogManager.log.info("[Keybinding] Can't check operating system name. Keybindings will be disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if(JIntellitype.getInstance() instanceof JIntellitype) {
|
||||
JIntellitype.getInstance().addHotKeyListener(this);
|
||||
@@ -38,9 +50,7 @@ public class Keybinding implements HotkeyListener {
|
||||
JIntellitype.getInstance().registerHotKey(QUICK_RESET, quickResetBinding);
|
||||
LogManager.log.info("[Keybinding] Bound quick reset to " + quickResetBinding);
|
||||
}
|
||||
} catch(JIntellitypeException je) {
|
||||
LogManager.log.info("[Keybinding] JIntellitype initialization failed. Keybindings will be disabled. Try restarting your computer.");
|
||||
} catch(ExceptionInInitializerError e) {
|
||||
} catch(JIntellitypeException | ExceptionInInitializerError | UnsatisfiedLinkError e) {
|
||||
LogManager.log.info("[Keybinding] JIntellitype initialization failed. Keybindings will be disabled. Try restarting your computer.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user