Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modifiers applied to single key presses #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

naalit
Copy link

@naalit naalit commented Aug 16, 2022

Fixes #13, at least for the use case described there:

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

  layers:
    - modifiers: ['rightshift']
      keymap:
        apostrophe:
          modifiers: ['rightalt']
          key: q

The modifiers listed in a keybinding are pressed until the next event, then released, so if you pressed ', then tapped a while still holding ', and finally released ', with the above configuration, it would produce:

+rightalt +q
-rightalt +a
-a
-q

@filyp
Copy link

filyp commented Sep 22, 2022

I've been waiting for this feature for long, and it's critical for me.
Thank you <3

This repo looks quite inactive, so if someone want to use this feature without waiting for merge, do:

git clone https://aur.archlinux.org/kbct-git.git
cd kbct-git

Then exchange PKGBUILD for this one:

pkgname="kbct-git"
_gitname=kbct
pkgver=0.1.0.r59.d996cb7
pkgrel=1
pkgdesc="Keyboard keycode mapping utility for Linux supporting layered configuration"
arch=('x86_64')
url="https://github.com/tolziplohu/kbct"
license=('None')
depends=()
makedepends=('git' 'cargo' 'rust')
provides=('kbct')
source=("git+$url" 'kbct.service' 'config.yml')
backup=('etc/kbct/config.yml')
md5sums=('SKIP' 'SKIP' 'SKIP')

pkgver() {
    cd "$_gitname"
    echo $(grep '^version =' Cargo.toml|head -n1|cut -d\" -f2).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd "$_gitname"
  git checkout modifiers
  cargo build --release
}

package() {
  cd "$_gitname"
  install -D -m755 ./target/release/kbct "$pkgdir/usr/bin/kbct"
  install -D -m644 "$srcdir/kbct.service" "$pkgdir/etc/systemd/system/kbct.service"
}

And then run:

makepkg -si
systemctl start kbct

@drjaska
Copy link

drjaska commented Dec 18, 2023

@naalit why does the following config fail to parse

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

  layers:
    - modifiers: ['rightalt']
      keymap:
        k:
          modifiers: ['leftshift']
          key: 5
thread 'main' panicked at src/main.rs:278:10:
Could not parse the configuration yaml file: Message("data did not match any variant of untagged enum KeyPressConf", Some(Pos { marker: Marker { index: 224, line: 10, col: 9 }, path: ".[0].layers[0].keymap" }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

but the same config but with k and 5 swapped works fine?

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

  layers:
    - modifiers: ['rightalt']
      keymap:
        5:
          modifiers: ['leftshift']
          key: k

This is an issue for me as I really wanted to map the extra characters found on the numerical keys row to alphabetical keys on a new layer.

@drjaska
Copy link

drjaska commented Dec 18, 2023

Apparently numbers on the right hand side of : need to be double quoted like key: "9" and without quotes key: 9 is no longer valid syntax.

@drjaska
Copy link

drjaska commented Dec 18, 2023

There is also an issue with config like

    - modifiers: ['capslock', 'rightalt']
      keymap:
        e:
          modifiers: ['rightalt']
          key: "8"
        r:
          modifiers: ['leftshift']
          key: "8"

which fails to send rightalt + 8 which on nordic/scandinavian keyboards should produce [ while leftshift + 8 works fine to produce (.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bind key to combination
3 participants