GNU bug report logs -
#66932
[PATCH] services: Add xremap service.
Previous Next
To reply to this bug, email your comments to 66932 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#66932
; Package
guix-patches
.
(Sat, 04 Nov 2023 15:20:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
VÖRÖSKŐI András <voroskoi <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Sat, 04 Nov 2023 15:20:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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 <at> muradm.net>
;;; Copyright © 2023 Bruno Victal <mirai <at> makinata.eu>
;;; Copyright © 2023 Zheng Junjie <873216071 <at> qq.com>
+;;; Copyright © 2023 VÖRÖSKŐI András <voroskoi <at> 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.")))
+
;;;
;;; The default set of desktop services.
base-commit: 9dcd8802f5bc472579f23a38dcf437f8a9ac976c
--
2.41.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#66932
; Package
guix-patches
.
(Sat, 02 Dec 2023 10:49:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 66932 <at> debbugs.gnu.org (full text, mbox):
Hi András,
VÖRÖSKŐI András <voroskoi <at> gmail.com> skribis:
> * 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
Nice!
> +(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"))))
Did you consider writing “bindings” so that one can configure it Scheme,
as is the case for most other services? (To be clear, I think we should
still allow people to provide their own Yaml file as is done here.)
If that’s too tricky/impractical, we can keep the patch as is, but
adding “native” configuration on top of that would be sweet.
I wonder if it would make sense, in a future patch, to also provide
‘home-xremap-service-type’ as a direct mapping of this service. Food
for thought.
Thanks,
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#66932
; Package
guix-patches
.
(Mon, 04 Dec 2023 17:44:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 66932 <at> debbugs.gnu.org (full text, mbox):
Hi Ludo,
Thanks for the reply.
On Sat Dec 2, 2023 at 11:48 AM CET, Ludovic Courtès wrote:
> Hi András,
>
> Did you consider writing “bindings” so that one can configure it Scheme,
> as is the case for most other services? (To be clear, I think we should
> still allow people to provide their own Yaml file as is done here.)
I did consider that, but I am not familiar with guile, so that is too
hard for me and there are a lot of combinations to handle.
> If that’s too tricky/impractical, we can keep the patch as is, but
> adding “native” configuration on top of that would be sweet.
It is tricky for me and telling the truth I do not see the benefit.
> I wonder if it would make sense, in a future patch, to also provide
> ‘home-xremap-service-type’ as a direct mapping of this service. Food
> for thought.
I was thinking about that, but was not sure. There is a section in the README about that:
https://github.com/k0kubun/xremap#running-xremap-without-sudo
The basic idea is creating an input group with write permission for every
input type.
I think we can not automate the "add user to input group" in the home-service,
so that would be still a manual task.
Is this solution acceptable?
Thanks,
András
Information forwarded
to
guix-patches <at> gnu.org
:
bug#66932
; Package
guix-patches
.
(Mon, 09 Dec 2024 01:57:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 66932 <at> debbugs.gnu.org (full text, mbox):
Hello!
Looks like this got a little lost, but would love to have an xremap
service (I have a config I found which gives me nice emacs keys
everywhere).
On Mon, Dec 04, 2023 at 06:43 PM, VÖRÖSKŐI András wrote:
> Hi Ludo,
>
> Thanks for the reply.
>
> On Sat Dec 2, 2023 at 11:48 AM CET, Ludovic Courtès wrote:
>> Hi András,
>>
>> Did you consider writing “bindings” so that one can configure it Scheme,
>> as is the case for most other services? (To be clear, I think we should
>> still allow people to provide their own Yaml file as is done here.)
>
> I did consider that, but I am not familiar with guile, so that is too
> hard for me and there are a lot of combinations to handle.
>
>> If that’s too tricky/impractical, we can keep the patch as is, but
>> adding “native” configuration on top of that would be sweet.
>
> It is tricky for me and telling the truth I do not see the benefit.
>
From what I saw when I first looked at xremap, there's quite a lot of
syntax and possibilities. I guess the simplest thing is just something
that produces yaml from s-expressions without much logic, but maybe that
doesn't gain us much.
In any event, would like to have this as a starting point.
Ludo’: had you reviewed this at all do you remember, besides the
comment/suggestion above?
>> I wonder if it would make sense, in a future patch, to also provide
>> ‘home-xremap-service-type’ as a direct mapping of this service. Food
>> for thought.
>
> I was thinking about that, but was not sure. There is a section in the README about that:
> https://github.com/k0kubun/xremap#running-xremap-without-sudo
>
> The basic idea is creating an input group with write permission for every
> input type.
> I think we can not automate the "add user to input group" in the home-service,
> so that would be still a manual task.
>
> Is this solution acceptable?
>
I don't know how this might work, sorry. It did seem more complicated to
do this without root, I believe by design of how such input grabbing
works (as one would hope, for security). A home service would indeed be
ideal, along with configuring as noted above, but I think both are quite
a bit more work.
> Thanks,
> András
Thanks for the patch, I haven't tried it but maybe I can just take the
actual service part and slap it in my config...
John
This bug report was last modified 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.