From patchwork Tue Mar 14 12:36:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Miguel_=C3=81ngel_Moreno?= X-Patchwork-Id: 47968 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6D01B1698E; Tue, 14 Mar 2023 12:37:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 234C51693E for ; Tue, 14 Mar 2023 12:37:14 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pc3tn-0006D6-NV; Tue, 14 Mar 2023 08:37:03 -0400 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 1pc3tm-0006Cu-9C for guix-patches@gnu.org; Tue, 14 Mar 2023 08:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pc3tm-0006cR-13 for guix-patches@gnu.org; Tue, 14 Mar 2023 08:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pc3tl-0002pq-RC for guix-patches@gnu.org; Tue, 14 Mar 2023 08:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62107] [PATCH v2] home: services: Add home-unclutter-service-type. References: <86lek41cc6.fsf@conses.eu> In-Reply-To: <86lek41cc6.fsf@conses.eu> Resent-From: conses Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 Mar 2023 12:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62107 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62107@debbugs.gnu.org Cc: contact@conses.eu Received: via spool by 62107-submit@debbugs.gnu.org id=B62107.167879740910880 (code B ref 62107); Tue, 14 Mar 2023 12:37:01 +0000 Received: (at 62107) by debbugs.gnu.org; 14 Mar 2023 12:36:49 +0000 Received: from localhost ([127.0.0.1]:36630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc3tZ-0002pP-1W for submit@debbugs.gnu.org; Tue, 14 Mar 2023 08:36:49 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:35077) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc3tW-0002pB-Qc for 62107@debbugs.gnu.org; Tue, 14 Mar 2023 08:36:47 -0400 Received: (Authenticated sender: contact@conses.eu) by mail.gandi.net (Postfix) with ESMTPSA id B8AB11C0005; Tue, 14 Mar 2023 12:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=conses.eu; s=gm1; t=1678797400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tfztIjPntM+tMT/n9Fofoak0B4v3hkD+d/qhaUEiOOg=; b=p5OueSH4CP9ydy4mQ6LRwFD29M1NncvFSeexfCW9nH6YZ02UfCd1MVtV7nxRsaOeDPKODo gX+C84DxTV4j3/BhbGC1odwlDWMLU7CCZPFwh/1fVk9yPrbC6H4lS+PQIyxG6bTAH0MAsv hLoOkXSrem+y/ZLjddHm52H0xrihkvhBnSbhmrc/3tplGQa4ruRkU2whU5swxOEhYIaGve uzG11A/w8pzHvuxy90yliOAP555DqBJJzrg2C6FV09i/QAhgYo2W15Z3uxRkESux01mbVq u3YPvTX/oGskTI91ihdXqyQaMok4BsWYI36LTG1Gc8nzHcJoSz/uywxq3dJF4w== From: conses Date: Tue, 14 Mar 2023 13:36:36 +0100 Message-ID: <86fsa7y0ff.fsf@conses.eu> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/desktop.scm (home-unclutter-configuration) (home-unclutter-service-type): New variables; (home-unclutter-shepherd-service): New procedure; * doc/guix.texi (Desktop Services): Document it. --- doc/guix.texi | 30 ++++++++++++++++++++ gnu/home/services/desktop.scm | 53 +++++++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6671ba9305..551e5078f6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42541,6 +42541,36 @@ Desktop Home Services @end table @end deftp +@defvar home-unclutter-service-type +This is the service type for Unclutter, a program that runs on the +background of an X11 session and detects when the X pointer hasn't moved +for a specified idle timeout, after which it hides the cursor so that +you can focus on the text underneath. Its associated value must be a +@code{home-unclutter-configuration} record, as shown below. + +A typical configuration, where we manually specify the idle timeout (in +seconds), might look like this: + +@lisp +(service home-unclutter-service-type + (home-unclutter-configuration + (idle-timeout 2))) +@end lisp +@end defvar + +@deftp {Data Type} home-unclutter-configuration +The configuration record for @code{home-unclutter-service-type}. + +@table @asis +@item @code{unclutter} (default: @code{unclutter}) (type: file-like) +Unclutter package to use. + +@item @code{idle-timeout} (default: @code{5}) (type: integer) +A timeout in seconds after which to hide cursor. +@end table + +@end deftp + @node Guix Home Services @subsection Guix Home Services diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index cb25b03b64..ab2b871539 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ludovic Courtès ;;; Copyright © 2022 ( +;;; Copyright © 2023 conses ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,7 +23,7 @@ (define-module (gnu home services desktop) #:use-module (gnu home services shepherd) #:use-module (gnu services configuration) #:autoload (gnu packages glib) (dbus) - #:autoload (gnu packages xdisorg) (redshift) + #:autoload (gnu packages xdisorg) (redshift unclutter) #:use-module (guix records) #:use-module (guix gexp) #:use-module (srfi srfi-1) @@ -32,7 +33,10 @@ (define-module (gnu home services desktop) home-redshift-service-type home-dbus-configuration - home-dbus-service-type)) + home-dbus-service-type + + home-unclutter-configuration + home-unclutter-service-type)) ;;; @@ -226,3 +230,48 @@ (define home-dbus-service-type (default-value (home-dbus-configuration)) (description "Run the session-specific D-Bus inter-process message bus."))) + + +;;; +;;; Unclutter. +;;; + +(define-configuration/no-serialization home-unclutter-configuration + (unclutter + (file-like unclutter) + "The @code{unclutter} package to use.") + (idle-timeout + (integer 5) + "Timeout in seconds after which to hide the cursor.")) + +(define (home-unclutter-shepherd-service config) + (list + (shepherd-service + (provision '(unclutter)) + (requirement '()) + (one-shot? #t) + (start #~(make-forkexec-constructor + (list + #$(file-append + (home-unclutter-configuration-unclutter config) + "/bin/unclutter") + "-idle" + (number->string + #$(home-unclutter-configuration-idle-timeout config))) + #:log-file (string-append + (or (getenv "XDG_LOG_HOME") + (format #f "~a/.local/var/log" + (getenv "HOME"))) + "/unclutter.log")))))) + +(define home-unclutter-service-type + (service-type + (name 'home-unclutter) + (extensions + (list + (service-extension home-shepherd-service-type + home-unclutter-shepherd-service))) + (default-value (home-unclutter-configuration)) + (description "Run the @code{unclutter} daemon, which, on systems using the +Xorg graphical display server, automatically hides the cursor after a +user-defined timeout has expired.")))