hexvalid / Linux-CapsLock-Delay-Fixer

That is the capslock delay problem's fixer script
GNU General Public License v2.0
248 stars 22 forks source link

Script exits with error: `Errors encountered in keyboardmap; not compiled.` #19

Open ahobsonsayers opened 2 years ago

ahobsonsayers commented 2 years ago

As discussed in this issue comment, the current script exits with the error below if xkbcomp -xkb $DISPLAY keyboardmap creates a file that has the key <CAPS> sections split across multiple lines.

syntax error: line 1386 of keyboardmap
last scanned symbol is: type
Errors encountered in keyboardmap; not compiled.

This error occurs because sed cannot do multiline replacements (as far as i know). To fix the issue, sed should be replaced with perl.

For anyone that it helps, this modified version of @tprei script which should fix the problem.

#!/bin/sh
rpl='key <CAPS> \{ repeat=no, type\[group1\]=\"ALPHABETIC\", symbols\[group1\]=\[ Caps_Lock, Caps_Lock \],actions\[group1\]=\[LockMods\(modifiers=Lock\),Private\(type=3,data\[0\]=1,data\[1\]=3,data\[2\]=3\) \] \}'

# Create copy of kb description
xkbcomp -xkb $DISPLAY keyboardmap

# Replace CAPS
perl -i -0777 -pe "s/key <CAPS>[^;]*/$rpl/" keyboardmap

# Apply
xkbcomp keyboardmap $DISPLAY

# Remove temp file
rm keyboardmap

@hexvalid im willing to open a PR if this helps!

NickDeBeenSAE commented 2 years ago

Same deal, the caps lock button still has a release delay. Even with the patch. The terminal fired back unexpected "(" ")" too, so you may need to fix that.

sightie commented 8 months ago

I'm still running into this issue even after replacing sed with perl.