kbct icon indicating copy to clipboard operation
kbct copied to clipboard

Is there a way to bind one key to two?

Open Spagett1 opened this issue 4 years ago • 5 comments

I want my caps lock key to function as an esc key aswell as a modifier key, is this possible using kbct? i normally use this script

#!/bin/sh

# This script is called on startup to remap keys.
# Increase key speed via a rate change
xset r rate 300 50
# Map the caps lock key to super...
setxkbmap -option caps:super
# But when it is pressed only once, treat it as escape.
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
# Map the menu button to right super as well.
xmodmap -e 'keycode 135 = Super_R'
# Turn off the caps lock if on since there is no longer a key for it.
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock

this script only sets the esc key when the caps key is pressed quickly but i dont need this functionality, just want caps to be esc and mod4 however ive moved to wayland and none of those tools work. ive tried

- keyboards: [ "AT Translated Set 2 keyboard" ]

  keymap:
    capslock: esc
    capslock: leftmeta

but that just overwrites the esc and its only leftmeta. i also tried

- keyboards: [ "AT Translated Set 2 keyboard" ]

  keymap:
    capslock: esc,leftmeta

but that doesnt work.

Thanks!

Spagett1 avatar Dec 09 '21 20:12 Spagett1

Now the program is not working at all for some reason, Currently im just using

- keyboards: [ "AT Translated Set 2 keyboard" ]

  keymap:
    capslock: esc

as a config file and running it with the command oas kbct remap --config /etc/kbct/config.yml however while this does not give an error it does not bind the key.

Spagett1 avatar Dec 09 '21 21:12 Spagett1

Hey! Mapping from one to multiple keys is yet to be implemented (I am planning to work on that soon).

I am currently using a config where I map capslock to left alt. It's been working for me fine so far, so I'd suggest checking the logs for a message like INFO kbct > Capturing device path... to see if your keyboard is captured at all.

samvel1024 avatar Dec 10 '21 19:12 samvel1024

Hey, thats awesome to hear its on the roadmap!

all the output i recieve from kbct is INFO kbct > Starting kbct event loop, pid=3076

Spagett1 avatar Dec 12 '21 07:12 Spagett1

That means keyboard name is misconfigured (most likely).

Run sudo kbct list-devices (while having the keyboard connected) to find out the name.

samvel1024 avatar Dec 12 '21 22:12 samvel1024

Looks like duplicate of #13

Ashark avatar May 14 '22 19:05 Ashark