Score:1

xkbcomp at startup in kde

cn flag

I'm using kubuntu 20.04 and want to run xkbcomp ~/.Xkeymap $DISPLAY at startup to load a custom keymap. To this end I created a script with the content

#!/bin/bash

touch ~/test
xkbcomp ~/.Xkeymap $DISPLAY

and put it in ~/.config/autostart-scripts. I made it executable, and I see that it's indeed running at startup because the touch command timestamps a file in the home directory. However, the keys are not correctly remapped, and I have to rerun the script manually each time (which has the desired effect).

I assume the problem is that the scripts in the autostart directory are run too early during startup, before kde loads its own keymaps?

Is that the correct diagnosis? And does anybody know a way to fix the problem?

Score:3
uz flag

Can't tell if your assumption is correct, but possibly you can find out by delaying the execution of the xkbcomp command, i.e. replacing

xkbcomp ~/.Xkeymap $DISPLAY

with

{
    sleep 3
    xkbcomp ~/.Xkeymap $DISPLAY
} &
user313032 avatar
cn flag
good idea, i'll try that
user313032 avatar
cn flag
It works! Even with `sleep 1`. Thanks!
Gunnar Hjalmarsson avatar
uz flag
@user313032: Great, sometimes you get lucky. :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.