all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#66932] [PATCH] services: Add xremap service.
@ 2023-11-04 15:17 VÖRÖSKŐI András
  2023-12-02 10:48 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: VÖRÖSKŐI András @ 2023-11-04 15:17 UTC (permalink / raw)
  To: 66932; +Cc: VÖRÖSKŐI András

* gnu/services/desktop.scm (<xremap-configuration>): New record.
(xremap-shepherd-service): New procedure.
(xremap-service-type): New variable.
* doc/guix.texi (Desktop Services): Document this.

Change-Id: I76f9e238c72fb47226140e2b86dd9490cd9c9351
---
 doc/guix.texi            | 37 ++++++++++++++++++++++++++++++++++++
 gnu/services/desktop.scm | 41 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index b90078be06..e61b4e2650 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -119,6 +119,7 @@
 Copyright @copyright{} 2023 Zheng Junjie@*
 Copyright @copyright{} 2023 Brian Cully@*
 Copyright @copyright{} 2023 Felix Lechner@*
+Copyright @copyright{} 2023 VÖRÖSKŐI András@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -25011,6 +25012,42 @@ Desktop Services
 @end table
 @end deftp
 
+@defvar xremap-service-type
+@uref{https://github.com/k0kubun/xremap/, xremap} xremap is a key remapper for
+Linux. Unlike xmodmap, it supports app-specific remapping and Wayland.
+
+@lisp
+(append
+  (list
+   (service xremap-service-type
+                    (xremap-configuration
+                     (config-file (plain-file "xremap.yml"
+"modmap:
+  - name: Global
+    remap:
+      CAPSLOCK:
+        held: CONTROL_L
+        alone: Esc
+        alone_timeout_millis: 1000"))))
+
+  ;; normally one would want %base-services
+  %base-services)
+
+@end lisp
+@end defvar
+
+@deftp {Data Type} xremap-configuration
+Configuration record for the xremap daemon service.
+
+@table @asis
+@item @code{package} (default: @code{rust-xremap})
+The xremap package to use.
+
+@item @code{config-file} (default: @samp{(plain-file "xremap.yml" "")})
+Config file to use with xremap.
+
+@end table
+@end deftp
 
 @node Sound Services
 @subsection Sound Services
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 5b79fbcda1..1cfa7c2169 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021, 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 VÖRÖSKŐI András <voroskoi@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -72,6 +73,7 @@ (define-module (gnu services desktop)
   #:use-module (gnu packages mate)
   #:use-module (gnu packages nfs)
   #:use-module (gnu packages enlightenment)
+  #:use-module (gnu packages rust-apps)
   #:use-module (guix deprecation)
   #:use-module (guix records)
   #:use-module (guix packages)
@@ -184,6 +186,9 @@ (define-module (gnu services desktop)
             seatd-configuration
             seatd-service-type
 
+	    xremap-configuration
+	    xremap-service-type
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1863,6 +1868,42 @@ (define seatd-service-type
      (service-extension shepherd-root-service-type seatd-shepherd-service)))
    (default-value (seatd-configuration))))
 
+;;;
+;;; xremap
+;;;
+
+(define-record-type* <xremap-configuration>
+  xremap-configuration make-xremap-configuration
+  xremap-configuration?
+  (package xremap-configuration-package
+           (default rust-xremap))
+  (config-file xremap-configuration-config-file
+           (default (plain-file "xremap.yml" ""))))
+
+(define (xremap-shepherd-service config)
+  "Return an <sheperd-service> for xremap with CONFIG"
+  (match-record config <xremap-configuration>
+                (package config-file)
+                (list
+                (shepherd-service
+                 (provision '(xremap))
+                 (documentation "xremap daemon")
+                 (requirement '())
+                 (start #~(make-forkexec-constructor
+                           (list #$(file-append package "/bin/xremap")
+                                 #$config-file)))
+                 (stop #~(make-kill-destructor))))))
+
+(define xremap-service-type
+  (service-type
+   (name 'xremap)
+   (extensions
+    (list
+     (service-extension shepherd-root-service-type
+                        xremap-shepherd-service)))
+   (default-value (xremap-configuration))
+   (description "Run the @code{xremap} utility to modify keymaps system wide.")))
+
 \f
 ;;;
 ;;; The default set of desktop services.

base-commit: 9dcd8802f5bc472579f23a38dcf437f8a9ac976c
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-04 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-04 15:17 [bug#66932] [PATCH] services: Add xremap service VÖRÖSKŐI András
2023-12-02 10:48 ` Ludovic Courtès
2023-12-04 17:43   ` VÖRÖSKŐI András

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.