KarsMulder / evsieve

A utility for mapping events from Linux event devices.
GNU General Public License v2.0
220 stars 12 forks source link

Use just one key to switch between layouts #5

Closed positiveway closed 2 years ago

positiveway commented 2 years ago

Hi! So I have two layouts, Del key is used to activate the first one and Ins to activate the second one. Is it possible to use just one (Del) key to "rotate" between layouts?

evsieve --input /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse grab \
        --hook key:insert  toggle=:1 \
        --hook key:delete  toggle=:2 \
        --block key:insert key:delete \
        --toggle "" @norm_layout @dev_layout \
        --map key:c@dev_layout key:leftctrl key:c \
        --map key:v@dev_layout key:leftctrl key:v \
        --map key:x@dev_layout key:leftctrl key:x \
        --map key:z@dev_layout key:leftctrl key:z \
        --map key:f@dev_layout key:leftctrl key:f \
        --map key:w@dev_layout key:leftctrl key:w \
        --map key:l@dev_layout key:leftctrl key:leftalt key:l \
        --output
KarsMulder commented 2 years ago

Yes. Just remove the =:number part after the toggle clause. By default, --hook toggle sets all toggles' active indices to the next one, wrapping around if necessary. The =:1 part of --hook toggle=:1 is to explicitly set all toggles to the first index instead of rotating them.

evsieve --input /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse grab \
        --hook key:delete toggle \
        --block key:delete \
        --toggle "" @norm_layout @dev_layout \
        --map key:c@dev_layout key:leftctrl key:c \
        --map key:v@dev_layout key:leftctrl key:v \
        --map key:x@dev_layout key:leftctrl key:x \
        --map key:z@dev_layout key:leftctrl key:z \
        --map key:f@dev_layout key:leftctrl key:f \
        --map key:w@dev_layout key:leftctrl key:w \
        --map key:l@dev_layout key:leftctrl key:leftalt key:l \
        --output

(On a minor note: your input device looks like a mouse but the maps seem to treat it as a keyboard. Are you sure you've taken the correct input device?)

positiveway commented 2 years ago

Thanks a lot! My keyboard has a built-in touchpad. So system recognizes it this way. There're no other Logitech devices connected. Everything works fine though, remapping works perfectly.