emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Change default value of org-clock-x11-idle-program-name
Date: Tue, 24 Jan 2023 12:41:33 +0000	[thread overview]
Message-ID: <87zga83y0y.fsf@localhost> (raw)
In-Reply-To: <874jvkn1po.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Ihor Radchenko <yantar92@posteo.net> writes:

> What we can do is check if xprintidle executable is available and use
> it. Otherwise, fall back to x11idle to retain backwards compatibility on
> systems that do no have xprintidle installed.

See the attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-clock-x11idle-program-name-Prefer-xprintidle-whe.patch --]
[-- Type: text/x-patch, Size: 2634 bytes --]

From 6fe58852f30b7bd8d217bf228252dc97abd05153 Mon Sep 17 00:00:00 2001
Message-Id: <6fe58852f30b7bd8d217bf228252dc97abd05153.1674564051.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Tue, 24 Jan 2023 15:38:26 +0300
Subject: [PATCH] org-clock-x11idle-program-name: Prefer "xprintidle", when
 available

* lisp/org-clock.el (org-clock-x11idle-program-name): Change the
default value to "xprintidle" when its executable is available.
Fallback to previous default otherwise.  Update :package-version and
remove :version tags.
* etc/ORG-NEWS (New and changed options):
(~org-clock-x11idle-program-name~ now defaults to =xprintidle=, when available):
Document the change.

Link: https://orgmode.org/list/874jvkn1po.fsf@localhost
---
 etc/ORG-NEWS      | 11 ++++++++++-
 lisp/org-clock.el |  7 ++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 3ef76ec1a..d65592a2b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,7 +12,16 @@ See the end of the file for license conditions.
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
-** New options
+** New and changed options
+*** ~org-clock-x11idle-program-name~ now defaults to =xprintidle=, when available
+
+When =xprintidle= executable is available at =org-clock= load time, it
+is used as the default value for ~org-clock-x11idle-program-name~.
+The old =x11idle= default is used as the fallback.
+
+=xprintidle= is available as system package in most Linux
+distributions, unlike ancient =x11idle= that is distributed via WORG.
+
 *** New options for the "csl" citation export processor's LaTeX output
 
 The ~org-cite-csl-latex-label-separator~ and
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 0cd473209..ceb1fc833 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -439,7 +439,9 @@ (defcustom org-clock-frame-title-format '(t org-mode-line-string)
   :group 'org-clock
   :type 'sexp)
 
-(defcustom org-clock-x11idle-program-name "x11idle"
+(defcustom org-clock-x11idle-program-name
+  (if (executable-find "xprintidle")
+      "xprintidle" "x11idle")
   "Name of the program which prints X11 idle time in milliseconds.
 
 you can do \"~$ sudo apt-get install xprintidle\" if you are using
@@ -448,8 +450,7 @@ (defcustom org-clock-x11idle-program-name "x11idle"
 Alternatively, can find x11idle.c in
 https://orgmode.org/worg/code/scripts/x11idle.c"
   :group 'org-clock
-  :version "24.4"
-  :package-version '(Org . "8.0")
+  :package-version '(Org . "9.7")
   :type 'string)
 
 (defcustom org-clock-goto-before-context 2
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 225 bytes --]



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2023-01-24 12:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 22:31 org-x11idle-exists-p with emacs --daemon Julien Cubizolles
2022-10-28  3:08 ` Max Nikulin
2022-10-28  4:29   ` Ihor Radchenko
2022-10-28  4:39     ` Max Nikulin
2022-10-28  5:19       ` Ihor Radchenko
2022-10-28  4:28 ` Ihor Radchenko
2022-10-28 21:48   ` Julien Cubizolles
2022-10-29  2:54     ` Ihor Radchenko
2022-10-29 12:33   ` Max Nikulin
2022-10-30  1:33     ` Ihor Radchenko
2022-10-30  6:20       ` Max Nikulin
2022-10-31  2:50         ` Ihor Radchenko
2022-10-31  2:53         ` Change default value of org-clock-x11-idle-program-name (was: org-x11idle-exists-p with emacs --daemon) Ihor Radchenko
2023-01-24 12:41           ` Ihor Radchenko [this message]
2023-01-26 15:43             ` [PATCH] Change default value of org-clock-x11-idle-program-name Max Nikulin
2023-01-27 10:20             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zga83y0y.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).