Can't override windows key with tauri window focused
08:08 19 Feb 2024

I want to install a windows hook for overriding the windows key. This is the code I have written.

// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use mki::{bind_key, Action, InhibitEvent, Keyboard};

fn main() {

  bind_key(Keyboard::LeftWindows, Action {
    callback: Box::new(|_event, _state| {
      println!("Left Windows key pressed");
    }),
    inhibit: InhibitEvent::Yes,
    sequencer: false,
    defer: false,
  });

  bind_key(Keyboard::RightWindows, Action {
    callback: Box::new(|_event, _state| {
      println!("Right Windows key pressed");
    }),
    inhibit: InhibitEvent::Yes,
    sequencer: false,
    defer: false,
  });


  tauri::Builder::default()
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

This works everywhere, except when the Tauri app is in focus, what could be the issue? Does the Tauri windows itself capture the Windows key?

windows rust tauri