From e9d97d6e18406a787dc90df20535555d02858b90 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Sat, 4 Nov 2023 11:15:44 -0400 Subject: [PATCH] Prevent gsettings exception when running headless on Linux Closes #1209 --- src/qz/common/TrayManager.java | 2 +- src/qz/utils/SystemUtilities.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qz/common/TrayManager.java b/src/qz/common/TrayManager.java index 252dc2589..2658e3d01 100644 --- a/src/qz/common/TrayManager.java +++ b/src/qz/common/TrayManager.java @@ -111,7 +111,7 @@ public TrayManager(boolean isHeadless) { // Set up the shortcut name so that the UI components can use it shortcutCreator = ShortcutCreator.getInstance(); - SystemUtilities.setSystemLookAndFeel(); + SystemUtilities.setSystemLookAndFeel(headless); iconCache = new IconCache(); if (SystemUtilities.isSystemTraySupported(headless)) { // UI mode with tray diff --git a/src/qz/utils/SystemUtilities.java b/src/qz/utils/SystemUtilities.java index 6a31e48e6..979e5c275 100644 --- a/src/qz/utils/SystemUtilities.java +++ b/src/qz/utils/SystemUtilities.java @@ -491,7 +491,10 @@ public static boolean prefersMaskTrayIcon() { return false; } - public static boolean setSystemLookAndFeel() { + public static boolean setSystemLookAndFeel(boolean headless) { + if(headless) { + return false; + } try { UIManager.getDefaults().put("Button.showMnemonics", Boolean.TRUE); boolean darculaThemeNeeded = true;