mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-22 19:45:54 -04:00
parent
191f571bcd
commit
2ed6211cc3
@ -107,7 +107,11 @@ ui_init(void)
|
|||||||
notifier_initialise();
|
notifier_initialise();
|
||||||
cons_about();
|
cons_about();
|
||||||
#ifdef HAVE_LIBXSS
|
#ifdef HAVE_LIBXSS
|
||||||
|
char* x11_display = getenv("DISPLAY");
|
||||||
|
char* wayland_display = getenv("WAYLAND_DISPLAY");
|
||||||
|
if (x11_display && !wayland_display) {
|
||||||
display = XOpenDisplay(0);
|
display = XOpenDisplay(0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ui_idle_time = g_timer_new();
|
ui_idle_time = g_timer_new();
|
||||||
inp_size = 0;
|
inp_size = 0;
|
||||||
@ -150,6 +154,7 @@ ui_get_idle_time(void)
|
|||||||
{
|
{
|
||||||
// if compiled with libxss, get the x sessions idle time
|
// if compiled with libxss, get the x sessions idle time
|
||||||
#ifdef HAVE_LIBXSS
|
#ifdef HAVE_LIBXSS
|
||||||
|
if (display) {
|
||||||
XScreenSaverInfo* info = XScreenSaverAllocInfo();
|
XScreenSaverInfo* info = XScreenSaverAllocInfo();
|
||||||
if (info && display) {
|
if (info && display) {
|
||||||
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
|
||||||
@ -160,6 +165,7 @@ ui_get_idle_time(void)
|
|||||||
if (info) {
|
if (info) {
|
||||||
XFree(info);
|
XFree(info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// if no libxss or xss idle time failed, use profanity idle time
|
// if no libxss or xss idle time failed, use profanity idle time
|
||||||
#endif
|
#endif
|
||||||
gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
|
gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user