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

Bug: No keys are sending on Mac #1317

Open
1 task done
CampAsAChamp opened this issue Nov 1, 2024 · 33 comments
Open
1 task done

Bug: No keys are sending on Mac #1317

CampAsAChamp opened this issue Nov 1, 2024 · 33 comments
Assignees
Labels
bug Something isn't working macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for it.

Comments

@CampAsAChamp
Copy link

CampAsAChamp commented Nov 1, 2024

Requirements

Describe the bug

Keys are not being sent, but are being seen/heard by Kanata

Relevant kanata config

Using the minimal.kbd

(defcfg
  process-unmapped-keys yes
)

(defsrc
  caps grv         i
              j    k    l
  lsft rsft
)

(deflayer default
  @cap @grv        _ 
              _    _    _ 
  _    _   
)

(deflayer arrows
  _    _           up 
              left down rght 
  _    _   
)

(defalias
  cap (tap-hold-press 200 200 caps lctl)
  grv (tap-hold-press 200 200 grv (layer-toggle arrows))
)

To Reproduce

  1. Run kanata with minimal.kbd (with sudo)
  2. Press back tick
  3. See the keys being picked up in the terminal
  4. Key presses not being seen in the text editor (back tick, or arrows moving the cursor)

Video:

Screen.Recording.2024-10-31.at.10.57.58.PM.1.mov

Expected behavior

Keys would be sent. Pressing any other keys (A-Z) with process-unmapped-keys yes I expected them to also send, but I got neither.

Kanata version

kanata 1.70

Debug logs

No response

Operating system

MacOS 14.7

Additional context

No response

@CampAsAChamp CampAsAChamp added the bug Something isn't working label Nov 1, 2024
@jtroo jtroo added the macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for it. label Nov 1, 2024
@jtroo
Copy link
Owner

jtroo commented Nov 1, 2024

Maybe this can help:
#1211

@andreicorpo
Copy link

I am also encoutering this issue. #1211 doesn't seem to help with this.

@CampAsAChamp
Copy link
Author

CampAsAChamp commented Nov 1, 2024

I'll give #1211 a try and also get some more debug logs to see where it might be going wrong

EDIT: Already had both Kanata and iTerm in the input monitoring, so don't think it's that.

EDIT 2: I do see this PR for the driverkit to bump it to version 5.0.0, which is what I have when I run the below command. So hoping that is just my issue and when that gets merged this hopefully will resolve

defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion
> 5.0.0

@tissak
Copy link

tissak commented Nov 3, 2024

Confirming the last comment by @CampAsAChamp. I had this issue on MacOS 15.0.1 of key presses being detected but not being written. I repointed my local cargo.toml to the driverkit git repo mentioned in PR and rebuilt locally. Now works.

@CampAsAChamp
Copy link
Author

@jtroo how should I resolve this? Close it and mention that this issue should be fixed when that above PR gets merged? Or how would you like?

The only reason why I have version 5.0.0 is because that's what Karabiner is shipping with currently.

@jtroo
Copy link
Owner

jtroo commented Nov 5, 2024

We can leave this open until we bump the dependency version in Kanata.

@fearlessgeekmedia
Copy link

fearlessgeekmedia commented Nov 5, 2024

I'm having trouble even with 5.0.0. On MacOS Sonoma 14.7. When I run kanata, my whole keyboard is unusable.

@jtroo
Copy link
Owner

jtroo commented Nov 5, 2024

@fearlessgeekmedia my understanding is that, having 5.0.0 is the problem (on kanata side) and kanata needs an updated dependency to work correctly.

@fearlessgeekmedia
Copy link

Oh, ok. So I just need to wait?

@jtroo
Copy link
Owner

jtroo commented Nov 5, 2024

You could:

  • wait
  • get an older karabiner driver version
  • compile Kanata yourself with modified dependencies
  • ask for a binary build from someone else doing the above

@mattdw
Copy link

mattdw commented Nov 5, 2024

Here's my build with updated driverkit dependency - it worked for me on 15.1, M1 Apple Silicon. (With the 5.0.0 Karabiner driver .pkg installed.)

https://www.dropbox.com/scl/fi/4bsz4a2qih35ui9gp1fhe/kanata_w_kdk_5.0.0.zip?rlkey=g6139xiug7zcr1b9ccie15xwd&dl=0

Took me a while to figure out I also needed to run the Karabiner daemon separately, e.g.

# in one tab
sudo '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-VirtualHIDDevice-Daemon.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Daemon'

# in another tab
sudo ./kanata --cfg ~/.config/kanata.kb

@fearlessgeekmedia
Copy link

fearlessgeekmedia commented Nov 5, 2024 via email

@jcger
Copy link

jcger commented Nov 5, 2024

We can leave this open until we bump the dependency version in Kanata.

When do you expect this to happen?

@fearlessgeekmedia
Copy link

I didn't specify earlier. I'm using one of the Intel Macs.

@jtroo
Copy link
Owner

jtroo commented Nov 5, 2024

We can leave this open until we bump the dependency version in Kanata.

When do you expect this to happen?

You're asking for a time estimate from a free, donations-not-accepted, open source project 😂. Within [0, ∞) seconds.

@jcger
Copy link

jcger commented Nov 6, 2024

We can leave this open until we bump the dependency version in Kanata.

When do you expect this to happen?

You're asking for a time estimate from a free, donations-not-accepted, open source project 😂. Within [0, ∞) seconds.

Sorry, my intention wasn't to create any pressure or push. Just wanted to check if this is something you're planning to implement soon, so I can wait for it, or if not, I will try to do so locally. My bad for not taking enough time to write this properly 🙏

@jtroo
Copy link
Owner

jtroo commented Nov 6, 2024

There's not much work to do in the Kanata repo. The blocker is having the updated dependency consumable via crates.io for use with cargo install. I'm not sure how active @psych3r is so it might be a while to get the pr merged and crate published. It may be desirable to: have a new maintainer for the dependency or vendor and maintain the dependency within the Kanata repo.

@psych3r
Copy link
Contributor

psych3r commented Nov 6, 2024

I've been quite busy for the last month.
I'll work on merging the PR and uploading a new version of the crate by this weekend if not sooner.

@newsve
Copy link

newsve commented Nov 12, 2024

I must have missed something but I couldn't get it to work. I git pulled and cargo build the latest kanata, installed Karabiner-DriverKit-VirtualHIDDevice-5.0.0.pkg, activated latter and still have given Terminal permission for Input Monitoring. But it is still not working, before my installation worked.

Edit:
I get continuous connect_failed asio.system:2
I am on macOS 14.6.1 (updating now, maybe it is related...)

@fearlessgeekmedia
Copy link

fearlessgeekmedia commented Nov 12, 2024 via email

@Lawrence-of-AnKing
Copy link

While I run kanata, my keyboard and mouse not work anymore, I can only exit by Ctrl + Space + Esc. I tried Karabiner-VirtualHIDDevice-Manager 3.1 and 5.0, nothing changed. I do real not want turn back to karabiner, the terrible config...

@fearlessgeekmedia
Copy link

fearlessgeekmedia commented Nov 13, 2024 via email

@jtroo
Copy link
Owner

jtroo commented Nov 13, 2024

If you're compiling the latest main then the assumption is it should work now. The dependency bump was merged. But something else might be broken; perhaps something specific to intel mac

@newsve
Copy link

newsve commented Nov 13, 2024

While I run kanata, my keyboard and mouse not work anymore, I can only exit by Ctrl + Space + Esc.

I have exactly the same paired with this contiunous connect_failed asio.system:2

perhaps something specific to intel mac

I am running it on a Silicon Mac (M2). My config again:

  • very latest kanata, d932574
  • now, macOS 15.1 on Apple Silicon
  • installed Karabiner-DriverKit-VirtualHIDDevice-5.0.0.pkg, activated it and removed the older one before
  • Terminal has permission for input monitoring

Please let me know if I can do/test anything more in order to help to find the cause.

@newsve
Copy link

newsve commented Nov 13, 2024

Sorry for spamming this thread but I found the issue. Contrary to the past versions, we need now to run that Karabiner daemon as well, another user gave that hint in #1317 (comment)

So, all works fine now with the config I gave in the last comment.

@santhosh2011
Copy link

running the daemon in a seperate window works but should we keep one terminal always running for it?

@santhosh2011
Copy link

Is this fixed? or should we still keep running the daemon in another terminal?

@jtroo
Copy link
Owner

jtroo commented Nov 16, 2024

Is this fixed? or should we still keep running the daemon in another terminal?

Is this something broken that needs to be "fixed" in the first place? I would guess running the daemon is the intended use case for working with the new karabiner. Seems there might be some improvements here though.

  • Perhaps kanata in macOS should try to detect that the daemon is running and if not, do one of:
    • display a useful error message then abort
    • start up the daemon
    • something else?
  • Any further updates required to docs?

@psych3r
Copy link
Contributor

psych3r commented Nov 16, 2024

I believe we need to update the docs.
Karabiner-DriverKit Updated their usage instructions.
While it used to be enough to activate the driver, now users should run the daemon as well.
Activating the driver is mentioned in Kanata's docs, we should add running the daemon as well.
I believe it won't be hard to figure out a way to have the daemon run automatically instead of running it manually.
Maybe using macOS's launch agents or launch daemons, I am not that familiar with them tbh.
So if someone can share a way to do this, that would be awesome!
Then we'll just need to update the docs with how to automatically run the daemon.

@Lawrence-of-AnKing
Copy link

Is there a hero write a applescript to run all of them? I try to run kanata by applescript, faild.

@newsve
Copy link

newsve commented Nov 19, 2024

start up the daemon

This options would be actually pretty nice and would remove some friction in the UX.

Edit: Or display an error if the daemon isn't installed.

@thomastthai
Copy link

I experienced the issue with the keyboard not working when using the Kanata v1.7.0 release. I can confirm the fix:

  • Compiling from source (as of two days ago at commit fc1b95d)
  • Installing Karabiner-DriverKit-VirtualHIDDevice v5.0.5
    • Running Karabiner-VirtualHIDDevice-Manager with the command:

      /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
      
    • Running Karabiner-VirtualHIDDevice-Daemon: with the command:

      sudo '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-VirtualHIDDevice-Daemon.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Daemon'
      

@newsve
Copy link

newsve commented Nov 23, 2024

I asked ChatGPT to write a shell script kanata.sh (advantage is that you have to run and terminate only one thing):

#!/bin/zsh

# Quick help/full install process:
#   - Install Rust from rustup.rs 
#   - `git clone https://github.com/jtroo/kanata.git` in home (`~/`), then `cd kanata` and `cargo build`
#   - Install https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice version: ^5.0.0
#   - Allow Input Monitoring for latter somewhere in macOS' settings
#   - `chmod +x kanata.sh` this file after creation!

# Checking if a parameter was provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <path_to_kbd_file>"
    exit 1
fi

# Activate Karabiner-VirtualHIDDevice-Manager (actually needs to be done only once but yeah)
sudo /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate

# Run Karabiner-VirtualHIDDevice-Daemon
sudo '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-VirtualHIDDevice-Daemon.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Daemon' &

# Execute kanata with the provided parameter
sudo ~/kanata/target/debug/kanata -nc "$1"

Then, once...

chmod +x kanata.sh

...and execute with...

./kanata.sh <path_to_kbd_file>

Edit: Check ofc if your kanata install folder is the same as in the script! It is just the one when you do a git clone of the kanata repo in your home folder ~.

Edit2, Alternative: You could also just cram the last two lines into one, have a hard-coded kbd-file and run that super long line every time (and since in the shell history you can easily access it with the arrow up or ctrl-r too, actually not much worse solution but this script is a bit cleaner and in case the history is not accessible nor available also much easier to remember).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for it.
Projects
None yet
Development

No branches or pull requests