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

Keyboard shortcuts never trigger on Linux under X11 #501

Closed
rscarson opened this issue Jul 27, 2022 · 1 comment
Closed

Keyboard shortcuts never trigger on Linux under X11 #501

rscarson opened this issue Jul 27, 2022 · 1 comment

Comments

@rscarson
Copy link

rscarson commented Jul 27, 2022

Tested in Ubuntu 22.04 under X11 and Wayland.

Shortcut gets bound successfully, but handler never triggers. According to tauri-apps/global-hotkey#28, X11 support should be available in the current version (0.9.1 is what my application is pulling, through Tauri 1.0.0-rc.13).

Bug seems identical to #307, which while still open, was labelled fixed by #313 and #333.

So what is the status of the issue described in #307?

Code below works on Windows platforms, but not in Ubuntu 22.04, neither X11 or Wayland

fn handle_shortcut() {
    // Never triggered
    println!("in");
}

pub fn bind_shortcut(app_handle: tauri::AppHandle, shortcut: &str, handler: fn(AppHandle)) -> Option<String> {
	let mut gsm = app_handle.global_shortcut_manager();
	gsm.unregister_all().ok()?;
	match gsm.register(shortcut, || { handle_shortcut(); }) {
		Ok(_) => {
                    println!("Registered shortcut: {}", shortcut);
                    None
                },
		Err(e) => {
			// Error
                        println!("Could not register shortcut: {}", e);
			Some("invalid shortcut".to_string())
		}
	}
}
@FabianLars
Copy link
Member

Copy pasting my discord message:

It's open because it's not fixed. And about the relation to tauri-apps/global-hotkey#28, tauri-apps/global-hotkey#28 was opened march 1, and #307 was reopened march 10. tauri-apps/global-hotkey#28 is about the wayland limitation and #307 is open because x11 doesn't work due to a bug. Unfortunately #307 does work for many, including the main maintainers of tao, which makes it harder to fix.

Therefore closing this as a duplicate of #307. And a headsup: this may only be fixed in the context of the winit migration :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants