From bd0596ea01df181b3ac3a270c4f405af4dcd2830 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 31 May 2024 20:00:49 +0200 Subject: [PATCH] hotkey: Check for Wayland to prevent crash. Closes: #1388 --- src/hotkey/plugin.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hotkey/plugin.cc b/src/hotkey/plugin.cc index e1a81ebc16..1d110a4c75 100644 --- a/src/hotkey/plugin.cc +++ b/src/hotkey/plugin.cc @@ -85,6 +85,12 @@ const char GlobalHotkeys::about[] = PluginConfig * get_config() { return &plugin_cfg; } +static bool has_x11_display() +{ + GdkDisplay * display = gdk_display_get_default(); + return GDK_IS_X11_DISPLAY(display); +} + /* * plugin activated */ @@ -96,6 +102,12 @@ bool GlobalHotkeys::init() return false; } + if (!has_x11_display()) + { + AUDERR("Global Hotkeys plugin only supports X11.\n"); + return false; + } + setup_filter(); load_config(); grab_keys();