|
@@ -999,6 +999,12 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
|
|
|
"Return the current Mac idle time in seconds."
|
|
|
(string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'")))
|
|
|
|
|
|
+(defvar org-x11idle-exists-p
|
|
|
+ ;; Check that x11idle exists
|
|
|
+ (and (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)))
|
|
|
+
|
|
|
(defun org-x11-idle-seconds ()
|
|
|
"Return the current X11 idle time in seconds."
|
|
|
(/ (string-to-number (shell-command-to-string "x11idle")) 1000))
|
|
@@ -1009,12 +1015,7 @@ This routine returns a floating point number."
|
|
|
(cond
|
|
|
((eq system-type 'darwin)
|
|
|
(org-mac-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))
|
|
|
+ ((and (eq window-system 'x) org-x11idle-exists-p)
|
|
|
(org-x11-idle-seconds))
|
|
|
(t
|
|
|
(org-emacs-idle-seconds))))
|