Skip to content

Commit

Permalink
Don't use xscreensaver on wayland.
Browse files Browse the repository at this point in the history
Fixes #1874.
  • Loading branch information
mdosch committed Aug 11, 2023
1 parent 191f571 commit 2ed6211
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/ui/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ ui_init(void)
notifier_initialise();
cons_about();
#ifdef HAVE_LIBXSS
display = XOpenDisplay(0);
char* x11_display = getenv("DISPLAY");
char* wayland_display = getenv("WAYLAND_DISPLAY");
if (x11_display && !wayland_display) {
display = XOpenDisplay(0);
}
#endif
ui_idle_time = g_timer_new();
inp_size = 0;
Expand Down Expand Up @@ -150,15 +154,17 @@ ui_get_idle_time(void)
{
// if compiled with libxss, get the x sessions idle time
#ifdef HAVE_LIBXSS
XScreenSaverInfo* info = XScreenSaverAllocInfo();
if (info && display) {
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
unsigned long result = info->idle;
XFree(info);
return result;
}
if (info) {
XFree(info);
if (display) {
XScreenSaverInfo* info = XScreenSaverAllocInfo();
if (info && display) {
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
unsigned long result = info->idle;
XFree(info);
return result;
}
if (info) {
XFree(info);
}
}
// if no libxss or xss idle time failed, use profanity idle time
#endif
Expand Down

0 comments on commit 2ed6211

Please sign in to comment.