Skip to content

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

@ahobsonsayers

Description

@ahobsonsayers

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions