forked from fathomssen/redtimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Add idle check:
Example: link to stackoverflow
-
On Windows, GetLastInputInfo, see this answer
-
On OS X, NSWorkspaceWillSleepNotification and NSWorkspaceDidWakeNotification, see this answer
-
On X11, it is the screensaver API:
/* gcc -o getIdleTime getIdleTime.c -lXss */
#include <X11/extensions/scrnsaver.h>
#include <stdio.h>
int main(void) {
Display *dpy = XOpenDisplay(NULL);
if (!dpy) {
return(1);
}
XScreenSaverInfo *info = XScreenSaverAllocInfo();
XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info);
printf("%u", info->idle);
return(0);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels