[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-clock idle time in pgtk Emacs

From: Tim Cross
Subject: Re: org-clock idle time in pgtk Emacs
Date: Tue, 24 May 2022 20:27:09 +1000
User-agent: mu4e 1.7.23; emacs 28.1.50

Julien Cubizolles <j.cubizolles@free.fr> writes:

> org-clock checks for the 'x window-system in order to use the program
> set up by org-clock-x11idle-program-name. Recent Emacs versions use the
> 'pgtk instead of 'x and as such will default to using
> org-emacs-idle-seconds in org-user-idle-seconds.

I"m not sure this is accurate. You should only use the pgtk build of
Emacs if your running wayland. You definitely should not use it if your
running under X.

The big issue is that some important key input facilities don't work
correctly if you run the pgtk build under X (actually, I'm not sure they
work correctly under Wayland either, but then again, Wayland is a
different beast to X and differences can be expected).

The pgtk build is not a replacement for the current xlib+gtk build,
which will remain the correct build when running under X.
Unfortunately, this does mean that if you use both X and Wayland, you
likely will need two builds of Emacs.

There was a fairly long discussion thread about this on emacs-devel
about a month or so ago. The upshot was flagging the need to update the
documentation to clarify that people should not use the pgtk build when
running under X windows.

I suspect this means the below patch will need further refinement. 

> The following patch provides a crude workaround.
> I'm using a python program (included below) to report idletime in
> wayland, using the idle-time module. It can be used for
> org-clock-x11idle-program-name.
> modified   lisp/org-clock.el
> @@ -1196,7 +1196,7 @@ If `only-dangling-p' is non-nil, only ask to resolve 
> dangling
>  (defvar org-x11idle-exists-p
>    ;; Check that x11idle exists
> -  (and (eq window-system 'x)
> +  (and (or (eq window-system 'pgtk) (eq window-system 'x))
>         (eq 0 (call-process-shell-command
>                (format "command -v %s" org-clock-x11idle-program-name)))
>         ;; Check that x11idle can retrieve the idle time
> @@ -1213,7 +1213,7 @@ This routine returns a floating point number."
>    (cond
>     ((eq system-type 'darwin)
>      (org-mac-idle-seconds))
> -   ((and (eq window-system 'x) org-x11idle-exists-p)
> +   ((and (or (eq window-system 'x) (eq window-system 'pgtk)) 
> org-x11idle-exists-p)
>      (org-x11-idle-seconds))
>     (t
>      (org-emacs-idle-seconds))))
> #!/usr/bin/env python3
> from idle_time import IdleMonitor
> monitor = IdleMonitor.get_monitor()
> print(f"{1000*monitor.get_idle_time():.0f}")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]