Skip to content

Per-layout command / more flexible commands #15

Open
@michaelcadilhac

Description

@michaelcadilhac

My use case is that I alternate between US and US Dvorak. For both, I have a setxkbmap option and I then reload ~/.xmodmaprc. I use this rather unfortunate line:

kbdcfg.add_primary_layout("Dvorak", "DV", "-option\" compose:ralt  dvorak && xmodmap ~/.xmodmaprc && echo \"")

This is to "hack" into the os.execute that is done by the code.

A much more elegant solution would be to have a add_primary_layout with named arguments name, icon, full_command, cmd_argument, with the last two optional, although one of the two should be there. For instance:

kbdcfg.add_primary_layout_opt { name = "Dvorak", icon = "DV",
   full_command = "setxkbmap -option compase:ralt dvorak && xmodmap ~/.xmodmaprc" }

xbdcfg.add_primary_layout_opt { name = "US", icon = "US", cmd_argument = "us" }

Alternatively, we could specify the command when creating kbdcfg as:

cmd = "setxkbmap -option compose:ralt \"{}\" && xmodap ~/.xmodmaprc"

… but this does not provide the same flexibility.

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