From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KCm2IA9B2WPthAAAbAwnHQ (envelope-from ) for ; Tue, 31 Jan 2023 17:25:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 4ODJHw9B2WOzdQAAG6o9tA (envelope-from ) for ; Tue, 31 Jan 2023 17:25:51 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F108C1B1DF for ; Tue, 31 Jan 2023 17:25:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMtRG-00084Y-NP; Tue, 31 Jan 2023 11:24:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMtRB-000843-8l for emacs-orgmode@gnu.org; Tue, 31 Jan 2023 11:24:50 -0500 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMtR8-0005Xc-Qh for emacs-orgmode@gnu.org; Tue, 31 Jan 2023 11:24:48 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1pMtR5-0009uX-VT for emacs-orgmode@gnu.org; Tue, 31 Jan 2023 17:24:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Julien Cubizolles Subject: Re: org-clock idle time in pgtk Emacs Date: Tue, 31 Jan 2023 17:24:37 +0100 Message-ID: <87lelin03e.fsf@free.fr> References: <875ylvnxf9.fsf@free.fr> <87wnea15hy.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:9CG/h9sSBc7H7w86MmL7WUjv2fE= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675182351; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=uTlBYI43RZ3CZtvHnEJyqC6JBu1iaqYsbb09d+vdDxU=; b=lfKAyLiCHmW9AzGE21X7wicVF86Nr4xIp+Jzx16Ktj1StvmZORucTyhJSBz80bao8vunMb /2xBmpk/pWJtKfsgvnqd97OY7gVmx6MdinbQD4lU+EpKlDzrrC8z6QVOQiCzLqwlvo2gBx ESQu29HFddBM2CqYj1I7VEXUZw9o0hatMZMDLxj13At4IPpQ+1/0W+aSHxQ2n0XVVpB17l hgXm+paehiBKZD1amn21AUE6dH//EYxkaslvw5zAB0CUNr671rDtFXSKKEajP9+FOPmJOK AJnLeobCOui5bNO2i5cgLVG+EdMsgSB25rmiLZKiFBM+v5m7fktMgkq2lO7ysw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=free.fr (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675182351; a=rsa-sha256; cv=none; b=UydJlPIHGw9Afqc2GAPVsUiMjPgLizrH8Vs3A0EtlgBK4bw2e9Zu+4GKBS11fpSK4Tg43P LZi3Wz/3T2PFHmIqO6WRgz5OD+rdleI0gb/i37/7sExsoW1mZ8Kok6n5gPHGPaYqnqDoZf VIMiNfMnXORSxJA5wOTZekGiDKaWdUKgMqctq83vKHxxBls8BI25888GZBYCKMEKW+3xX0 p5x5kSzEiJi6Pgc3gIeUy0o5SiU3si/yVZN/If328OCQtqfVBZJ1u71A5G4/bvFLZpUo8b 9yvUFt3rgtqqZyGBXVMqVwprp+ao5cSvsCJJi+qfybE4Xyts7KwC1zjbzp/Qow== Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=free.fr (policy=none) X-Migadu-Scanner: scn0.migadu.com X-Spam-Score: -1.28 X-Migadu-Queue-Id: F108C1B1DF X-Migadu-Spam-Score: -1.28 X-TUID: XsN8nWzpJSJC --=-=-= Content-Type: text/plain Ihor Radchenko writes: > > As Tim pointed out, we cannot guarantee that things working on 'x build > will also work on 'pgtk. Instead of abusing settings for 'x window > system, can you please introduce a new function org-pgtk-idle-seconds > using a new variable org-clock-pgtkidle-program-name, similar to > org-x11-idle-seconds, and then update org-user-idle-seconds? Sorry for the delay, here is a patch to that effect. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org-clock.patch diff --git a/lisp/org-clock.el b/lisp/org-clock.el index ceb1fc833..81be37448 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -453,6 +453,15 @@ https://orgmode.org/worg/code/scripts/x11idle.c" :package-version '(Org . "9.7") :type 'string) +(defcustom org-clock-pgtkidle-program-name + (if (executable-find "jc-idle-time") + "jc-idle-time") + "Name of the program which prints idle time in milliseconds. +Case of a pgtk Emacs instance." + :group 'org-clock + :package-version '(Org . "9.7") + :type 'string) + (defcustom org-clock-goto-before-context 2 "Number of lines of context to display before currently clocked-in entry. This applies when using `org-clock-goto'." @@ -1199,6 +1208,17 @@ 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-pgtkidle-exists-p + ;; Check that org-clock-pgtkidle-program-name exists. But don't do that on DOS/Windows, + ;; since the command definitely does NOT exist there, and invoking + ;; COMMAND.COM on MS-Windows is a bad idea -- it hangs. + (and (null (memq system-type '(windows-nt ms-dos))) + (eq 0 (call-process-shell-command + (format "command -v %s" org-clock-pgtkidle-program-name))) + ;; Check that x11idle can retrieve the idle time + ;; FIXME: Why "..-shell-command" rather than just `call-process'? + (eq 0 (call-process-shell-command org-clock-pgtkidle-program-name)))) + (defvar org-x11idle-exists-p ;; Check that x11idle exists. But don't do that on DOS/Windows, ;; since the command definitely does NOT exist there, and invoking @@ -1214,6 +1234,10 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling "Return the current X11 idle time in seconds." (/ (string-to-number (shell-command-to-string org-clock-x11idle-program-name)) 1000)) +(defun org-pgtk-idle-seconds () + "Return the current X11 idle time in seconds." + (/ (string-to-number (shell-command-to-string org-clock-pgtkidle-program-name)) 1000)) + (defun org-user-idle-seconds () "Return the number of seconds the user has been idle for. This routine returns a floating point number." @@ -1222,6 +1246,8 @@ This routine returns a floating point number." (org-mac-idle-seconds)) ((and (eq window-system 'x) org-x11idle-exists-p) (org-x11-idle-seconds)) + ((and (eq window-system 'pgtk) org-pgtkidle-exists-p) + (org-pgtk-idle-seconds)) (t (org-emacs-idle-seconds)))) --=-=-= Content-Type: text/plain > Please, make sure that the pgtk option works on Wayland as well (or not, > but we will then need to wait until someone tests the patch on Wayland). It's working in Wayland, with a pgtk build. -- Julien Cubizolles --=-=-=--