瀏覽代碼

Revert "org-clock.el (org-user-idle-seconds): Simplify."

This reverts commit f398b9ee5358422ae171405482f8f34d4f91b6bf.
Bastien Guerry 12 年之前
父節點
當前提交
0102b4b404
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      lisp/org-clock.el

+ 9 - 3
lisp/org-clock.el

@@ -1009,9 +1009,15 @@ This routine returns a floating point number."
   (cond
    ((eq system-type 'darwin)
     (org-mac-idle-seconds))
-   ((eq window-system 'x)
-    (max (org-x11-idle-seconds) (org-emacs-idle-seconds)))
-   (t (org-emacs-idle-seconds))))
+   ((and
+     (eq window-system 'x)
+     ;; Check that x11idle exists
+     (eq (call-process-shell-command "command" nil nil nil "-v" "x11idle") 0)
+     ;; Check that x11idle can retrieve the idle time
+     (eq (call-process-shell-command "x11idle" nil nil nil ) 0))
+    (org-x11-idle-seconds))
+   (t
+    (org-emacs-idle-seconds))))
 
 (defvar org-clock-user-idle-seconds)