Skip to content

Commit

Permalink
Configure keyboard default map, disable modifiers in meta mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ardangelo committed Aug 19, 2023
1 parent 959526d commit ed71879
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ BUILD_DIR := .
endif

BOOT_CONFIG_LINE := dtoverlay=beepy-kbd,irq_pin=4
KMAP_LINE := KMAP=/usr/share/kbd/keymaps/beepy-kbd.map

all:
$(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)'
@@ -45,6 +46,9 @@ install_aux:
# Add auto-load module line if it wasn't already there
grep -qxF 'beepy-kbd' /etc/modules \
|| echo 'beepy-kbd' >> /etc/modules
# Configure keymap as default
grep -qxF '$(KMAP_LINE)' /etc/default/keyboard \
|| echo '$(KMAP_LINE)' >> /etc/default/keyboard

uninstall:
# Remove auto-load module line and create a backup file
@@ -55,6 +59,8 @@ uninstall:
rm -f /boot/overlays/beepy-kbd.dtbo
# Remove keymap
rm -f /usr/local/share/kbd/keymaps/beepy-kbd.map
# Remove keymap setting
sed -i.save '/$(KMAP_LINE)/d' /etc/default/keyboard

clean:
$(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' clean
7 changes: 7 additions & 0 deletions src/input_iface.c
Original file line number Diff line number Diff line change
@@ -525,6 +525,13 @@ static void report_key_input_event(struct kbd_ctx* ctx,
// Handle keys without modifiers in meta mode
if (!ctx->touchpad_always_keys && ctx->meta_mode) {

// Ignore modifier keys in meta mode
if ((keycode == KEY_LEFTSHIFT) || (keycode == KEY_RIGHTSHIFT)
|| (keycode == KEY_LEFTALT) || (keycode == KEY_RIGHTALT)) {
|| (keycode == KEY_LEFTCTRL) || (keycode == KEY_RIGHTCTRL)) {
return;
}

// Escape key exits meta mode
if (keycode == KEY_ESC) {
if (ev->state == KEY_STATE_RELEASED) {

0 comments on commit ed71879

Please sign in to comment.