unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69182: home-xmodmap-service-type requires restart to work
@ 2024-02-17 19:38 Ian Eure
  2024-02-19 19:16 ` Nicolas Graves via Bug reports for GNU Guix
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Eure @ 2024-02-17 19:38 UTC (permalink / raw)
  To: 69182

I recently set up home-xmodmap-service-type so I could change the 
PrtSc key on my ThinkPad into a Hyper modifier.  This is my 
configuration:

   (service home-xmodmap-service-type
            (home-xmodmap-configuration
             (key-map '("clear mod3"
                        ("remove mod4" . "Hyper_L")
                        ("keycode 107" . "Hyper_R")
                        ("add mod3" . "Hyper_L Hyper_R")))))

However, after logging into an EXWM session, the PrtSc key is a 
Super modifier, not Hyper.  The service appears to be starting 
successfully:

    l0p!ieure~$ herd status xmodmap
    Status of xmodmap:
      It is running since 11:20:59 AM (35 seconds ago).
      Running value is #t.
      It is enabled.
      Provides (xmodmap).
      Requires ().
      Will be respawned.

The output of `xmodmap -pm' reports:

    xmodmap:  up to 4 keys per modifier, (keycodes in 
    parentheses):

    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock
    control     Control_L (0x25),  Control_L (0x42),  Control_R 
    (0x69)
    mod1        Alt_L (0x40),  Alt_R (0x6c),  Alt_L (0xcc), 
    Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3        ISO_Level5_Shift (0xcb)
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce), 
    Hyper_L (0xcf)
    mod5        ISO_Level3_Shift (0x5c)

Some of my configuration is applied, while other parts are not:

- "clear mod3" isn’t working; mod3 is ISO_Level5_Shift, which is 
  the default.
- "remove mod4 = Hyper_L" isn’t working.  Hyper_L is still on mod4 
  (which is the super modifier), which is the default.
- "add mod3 = Hyper_L Hyper_R" isn’t working.
- The "keycode 107 = Hyper_R" config *is* working, which is what 
  makes PrtSc a super modifier.

If I restart the service, the modifiers work as expected:

    l0p!ieure~$ herd restart xmodmap
    Service xmodmap has been started.
    l0p!ieure~$ guix shell xmodmap -- xmodmap -pm
    xmodmap:  up to 4 keys per modifier, (keycodes in 
    parentheses):

    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock
    control     Control_L (0x25),  Control_L (0x42),  Control_R 
    (0x69)
    mod1        Alt_L (0x40),  Alt_R (0x6c),  Alt_L (0xcc), 
    Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3        Hyper_R (0x6b),  Hyper_L (0xcf)
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
    mod5        ISO_Level3_Shift (0x5c)

I haven’t set up anything else that manipulates keymaps, so I’m 
not sure why this isn’t working after login.

I had a suspicion that another service might be running after 
xmodmap and changing the keymap.  The only home service that looks 
like it might do that is x11-display.  However, copying 
`home-xmodmap-service-type' and `my-xmodmap-shepherd-service' into 
my home.scm and editing it to add (requirement '(x11-display)) to 
the shepherd-service doesn’t fix the issue.

This appears to be a timing problem.  If I remove the service from 
my home configuration, but manually run `guix shell xmodmap -- 
xmodmap /gnu/store/g3hgzx8za4qrrdgn5hjqd80gxkb6sifx-config' after 
I log in (the file being the xmodmap configuration created by 
`serialize-xmodmap-configuration'), the keymap is set up how I 
declare it.  So *what* home-xmodmap-service-type does is correct; 
but *when* it does it is not.




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

* bug#69182: home-xmodmap-service-type requires restart to work
  2024-02-17 19:38 bug#69182: home-xmodmap-service-type requires restart to work Ian Eure
@ 2024-02-19 19:16 ` Nicolas Graves via Bug reports for GNU Guix
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2024-02-19 19:16 UTC (permalink / raw)
  To: 69182


Maybe that's because x11-display take a few milliseconds to start, and
that xmodmap actually starts before x11-display is actually done
loading.

I've encountered this type of issue with emacs-server, where I used this
solution on RDE, but it's emacs/service specific :
https://lists.sr.ht/~abcdw/rde-devel/patches/48753

I can't help you more, I don't use x11 anymore, but if that's the issue,
maybe go through the x11 documentation, find if you can start it with a
pid file, and if that's the case, you can try using a background
shepherd process waiting for the pid-file instead of a foreground one.

-- 
Best regards,
Nicolas Graves




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

end of thread, other threads:[~2024-02-19 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-17 19:38 bug#69182: home-xmodmap-service-type requires restart to work Ian Eure
2024-02-19 19:16 ` Nicolas Graves via Bug reports for GNU Guix

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).