pidgin (libpurple)이 어떻게 작동하는지 토마스 랭 스턴 (Thomas Langston)이 생각한 아이디어는 매우 유용했습니다. 나는 소스 코드를 다운로드하고이 발견 -
피진-2.10.0/피진/gtkidle.c에서
라인 (46)에 시작 : 파일이 다른 플랫폼이 처리하는 코드를 포함하는
/*
* Get the number of seconds the user has been idle. In Unix-world
* this is based on the X Windows usage. In MS Windows this is
* based on keyboard/mouse usage information obtained from the OS.
* In MacOS X, this is based on keyboard/mouse usage information
* obtained from the OS, if configure detected IOKit. Otherwise,
* MacOS X is handled as a case of X Windows.
*
* In Debian bug #271639, jwz says:
*
* Purple should simply ask xscreensaver how long the user has been idle:
* % xscreensaver-command -time
* XScreenSaver 4.18: screen blanked since Tue Sep 14 14:10:45 2004
*
* Or you can monitor the _SCREENSAVER_STATUS property on root window #0.
* Element 0 is the status (0, BLANK, LOCK), element 1 is the time_t since
* the last state change, and subsequent elements are which hack is running
* on the various screens:
* % xprop -f _SCREENSAVER_STATUS 32ac -root _SCREENSAVER_STATUS
* _SCREENSAVER_STATUS(INTEGER) = BLANK, 1095196626, 10, 237
*
* See watch() in xscreensaver/driver/xscreensaver-command.c.
*
* @return The number of seconds the user has been idle.
*/
.
필자가 찾고있는 것은 "시스템 유휴 시간"입니다. 시스템 레벨에 저장되어 있으며 적절한 API/기법을 통해 읽을 수 있습니다. –
** X11 ** (예 : Linux) 버전 질문 [키보드에서 키보드 감지, 마우스 활동] (https://stackoverflow.com/questions/222606/detecting-keyboard-mouse-activity-in-linux)의 질문에 대한 답변이 진짜입니다. –