unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: conses <contact@conses.eu>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: contact@conses.eu, 62101@debbugs.gnu.org
Subject: [bug#62101] [PATCH] home: services: Add xmodmap.
Date: Thu, 16 Mar 2023 14:15:32 +0100	[thread overview]
Message-ID: <86a60cx2ff.fsf@conses.eu> (raw)
In-Reply-To: <87wn3k21la.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 13 Mar 2023 15:00:17 +0100")

Ludovic Courtès <ludo@gnu.org> writes:

> It’d be great if you could provide a ChangeLog-style commit log (you can
> check the manual and ‘git log’ to see what it’s like); if you can’t, we
> can help with that.
>

Apologies for missing this, I added it in v2.

> More importantly, could you add documentation to guix.texi, similar to
> what is done for the other Home services?  That is: a few introductory
> lines, an example, and the reference (data types, variables,
> procedures).
>

Likewise.

>> +   (alist '())
>> +   "Association list of key and value pairs for the
>> + @code{xmodmap} configuration file.  Its syntax can take something like
>> +the following:
>> +
>> +@example
>> +'((#(add mod4) . Print)
>> +    (clear lock)
>> +    (clear control)
>> +    (#(keycode 66) . Control_L)
>> +    (#(add control) . #(Control_L Control_R)))
>> +@end example"))
>
> I don’t quite get the syntax.
>
> Use of vectors is unusual in this context, I’d recommend against it.
>
> Regarding pairs: in some cases, the cdr is a symbol/vector, in other
> cases it’s a one-element list (as in ‘(clear lock)’).  That also makes
> it a bit confusing to me.
>
> Perhaps we should try to make it look more consistent?  WDYT?

I've amended the type of config to be of list instead.  As I've hinted
in the manual, the motivation for including vectors and lists is to
provide a more Lisp-like configuration syntax for those that want it, it
can simply take strings too.  IMO there's no point in making it
consistent since the original syntax isn't consistent in the first
place, you can check out some examples here
<https://wiki.archlinux.org/title/xmodmap>.

>
>> +(define (home-xmodmap-shepherd-service config)
>> +  (list
>> +   (shepherd-service
>> +    (provision '(xmodmap))
>> +    (start #~(make-system-constructor
>> +              (string-join
>> +               (list #$(file-append
>> +                        (home-xmodmap-configuration-xmodmap config)
>> +                        "/bin/xmodmap")
>> +                     #$(home-xmodmap-file config)))))
>> +    (one-shot? #t))))
>
> Perhaps it’d be useful to have a ‘stop’ procedure that undoes that
> changes?  In which case it wouldn’t be one-shot anymore.
>

I found here <https://askubuntu.com/a/1155211> that xmodmap settings can
be simply reversed by calling setxkbmap, so I've added a stop procedure
for this.

>> +(define home-xmodmap-service-type
>> +  (service-type
>> +   (name 'home-xmodmap)
>> +   (extensions
>> +    (list
>> +     (service-extension
>> +      home-profile-service-type
>> +      home-xmodmap-profile-service)
>> +     (service-extension
>> +      home-xdg-configuration-files-service-type
>> +      home-xmodmap-files-service)
>> +     (service-extension
>> +      home-shepherd-service-type
>> +      home-xmodmap-shepherd-service)))
>> +   (description "Configure @code{xmodmap} bindings and rules.")
>
> Please expand the description a bit.
>

Done.

-- 
Best regards,
conses




  reply	other threads:[~2023-03-16 13:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 19:57 [bug#62101] [PATCH] home: services: Add xmodmap conses
2023-03-13 14:00 ` Ludovic Courtès
2023-03-16 13:15   ` conses [this message]
2023-03-16 13:03 ` [bug#62101] [PATCH v2] home: services: Add home-xmodmap-service-type conses
2023-03-16 21:43   ` [bug#62101] [PATCH] home: services: Add xmodmap Ludovic Courtès
2023-03-17 12:06 ` [bug#62101] [PATCH v3] home: services: Add home-xmodmap-service-type conses
2023-03-17 21:50   ` bug#62101: " Ludovic Courtès

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=86a60cx2ff.fsf@conses.eu \
    --to=contact@conses.eu \
    --cc=62101@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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/guix.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).