diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a5cd53475..3455a9eb3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -35,30 +35,24 @@ jobs: - name: Check fmt run: cargo fmt --all --check - build-test-clippy-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: "persist-cross-job" - workspaces: ./ - - run: rustup component add clippy - - name: Run tests - run: cargo test --all - - name: Run tests all features - run: cargo test --all --all-features - - name: Run clippy no features - run: cargo clippy --all -- -D warnings - - name: Run clippy all features - run: cargo clippy --all --all-features -- -D warnings - - build-test-clippy-windows: - runs-on: windows-latest + build-test-clippy: + runs-on: ${{ matrix.os }} strategy: matrix: - target: - - x86_64-pc-windows-msvc + # You can add more, for any target you'd like! + include: + - build: linux + os: ubuntu-latest + target: x86_64-unknown-linux-musl + + - build: windows + os: windows-latest + target: x86_64-pc-windows-msvc + + - build: macos + os: macos-latest + target: x86_64-apple-darwin + steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 diff --git a/cfg_samples/kanata.kbd b/cfg_samples/kanata.kbd index 246d4f844..48b27967d 100644 --- a/cfg_samples/kanata.kbd +++ b/cfg_samples/kanata.kbd @@ -232,6 +232,10 @@ If you need help, please feel welcome to ask in the GitHub discussions. ì 13 ) +(deflocalkeys-macos + ì 13 +) + ;; Only one defsrc is allowed. ;; ;; defsrc defines the keys that will be intercepted by kanata. The order of the diff --git a/parser/src/cfg/tests.rs b/parser/src/cfg/tests.rs index 7f01be181..f23d0f138 100644 --- a/parser/src/cfg/tests.rs +++ b/parser/src/cfg/tests.rs @@ -1129,6 +1129,25 @@ yen 314 ¥ 315 new 316 ) +(deflocalkeys-macos ++ 300 +[ 301 +] 302 +{ 303 +} 304 +/ 305 +; 306 +` 307 += 308 +- 309 +' 310 +, 311 +. 312 +\ 313 +yen 314 +¥ 315 +new 316 +) (defsrc + [ ] { } / ; ` = - ' , . \ yen ¥ new) (deflayer base + [ ] { } / ; ` = - ' , . \ yen ¥ new) "#; diff --git a/src/kanata/macos.rs b/src/kanata/macos.rs index a9e97051f..ae42046db 100644 --- a/src/kanata/macos.rs +++ b/src/kanata/macos.rs @@ -31,7 +31,7 @@ impl Kanata { let mut kanata = kanata.lock(); kanata .kbd_out - .write(event.clone()) + .write(event) .map_err(|e| anyhow!("failed write: {}", e))?; continue; } @@ -44,7 +44,7 @@ impl Kanata { let mut kanata = kanata.lock(); kanata .kbd_out - .write(event.clone()) + .write(event) .map_err(|e| anyhow!("failed write: {}", e))?; continue; } diff --git a/src/oskbd/macos.rs b/src/oskbd/macos.rs index 40962e521..c14fa1c9d 100644 --- a/src/oskbd/macos.rs +++ b/src/oskbd/macos.rs @@ -54,8 +54,8 @@ impl KbdIn { )); } - let device_names = if include_names.is_some() { - validate_and_register_devices(include_names.unwrap()) + let device_names = if let Some(names) = include_names { + validate_and_register_devices(names) } else { vec![] };