fix: handle X11 connection loss gracefully

Use XSetIOErrorExitHandler on X11 to detect connection loss and
disable GTK features (tray, clipboard, notifications).

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Co-authored-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
Michael Vetter
2026-03-31 13:06:09 +02:00
parent 9b2f96fb45
commit 8eac31e5e1
6 changed files with 76 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
#include <stdlib.h>
#include "log.h"
#include "ui/tray.h"
/*
For now we rely on tray_init(void)
@@ -27,6 +28,9 @@ void clipboard_init(int argc, char **argv) {
char*
clipboard_get(void)
{
if (!tray_gtk_ready()) {
return NULL;
}
gchar* clip;
GtkClipboard* cl = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);