diff --git a/src/main.rs b/src/main.rs index fcc9f14c7..a3a258de1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,11 +35,7 @@ mod cli { std::process::exit(0); } - #[cfg(all( - target_os = "windows", - feature = "interception_driver", - not(feature = "gui") - ))] + #[cfg(all(target_os = "windows", feature = "interception_driver"))] if args.list { main_lib::list_devices_windows(); std::process::exit(0); diff --git a/src/main_lib/args.rs b/src/main_lib/args.rs index df48decc6..b991c33ba 100644 --- a/src/main_lib/args.rs +++ b/src/main_lib/args.rs @@ -61,11 +61,7 @@ kanata.kbd in the current working directory and #[cfg(any( target_os = "macos", any(target_os = "linux", target_os = "android"), - all( - target_os = "windows", - feature = "interception_driver", - not(feature = "gui") - ) + all(target_os = "windows", feature = "interception_driver") ))] #[arg(short, long)] pub list: bool, diff --git a/src/main_lib/mod.rs b/src/main_lib/mod.rs index bf286a76e..36c860b2e 100644 --- a/src/main_lib/mod.rs +++ b/src/main_lib/mod.rs @@ -121,22 +121,14 @@ pub(crate) fn list_devices_linux() { println!(" )"); } -#[cfg(all( - target_os = "windows", - feature = "interception_driver", - not(feature = "gui") -))] +#[cfg(all(target_os = "windows", feature = "interception_driver"))] struct WindowsDeviceInfo { display_name: String, // For user display raw_wide_bytes: Vec, // For kanata configuration (original wide string bytes) hardware_id: Option, // Parsed hardware ID (e.g., "HID#VID_046D&PID_C52B") } -#[cfg(all( - target_os = "windows", - feature = "interception_driver", - not(feature = "gui") -))] +#[cfg(all(target_os = "windows", feature = "interception_driver"))] fn get_device_info(device_handle: winapi::um::winnt::HANDLE) -> Option { use std::ffi::OsString; use std::os::windows::ffi::OsStringExt; @@ -197,11 +189,7 @@ fn get_device_info(device_handle: winapi::um::winnt::HANDLE) -> Option Option { // Windows device names typically look like: // \\?\HID#VID_046D&PID_C52B&MI_01#7&1234abcd&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd} diff --git a/src/main_lib/win_gui.rs b/src/main_lib/win_gui.rs index eba06bdb7..6ee973fd7 100644 --- a/src/main_lib/win_gui.rs +++ b/src/main_lib/win_gui.rs @@ -69,6 +69,14 @@ fn cli_init() -> Result { } }; + #[cfg(feature = "interception_driver")] + { + if args.list { + super::list_devices_windows(); + std::process::exit(0); + } + } + let cfg_paths = args.cfg.unwrap_or_else(default_cfg); let log_lvl = match (args.debug, args.trace) {