Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tauri/src-tauri/src/hotkey_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ fn apply_effect(app: &AppHandle, effect: Effect) {
let _ = window.set_position(tauri::PhysicalPosition::new(x, y));
}
}
// Undoes the click-through toggle from the hide-cycle.
// Skipped on Linux/X11: this is the very first call on a
// freshly-built window on a cold-start hotkey trigger, and
// tao's set_ignore_cursor_events unwraps a None GDK window
// for an unrealized window, aborting the process (#873).
// Linux never sets click-through in the first place, so
// there's nothing to undo.
#[cfg(not(target_os = "linux"))]
let _ = window.set_ignore_cursor_events(false);
// Deliberately no set_focus() — taking key focus would yank
// it out of whatever app the user was typing in, which is
Expand Down
28 changes: 28 additions & 0 deletions tauri/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ pub fn show_dictate_window(app: &tauri::AppHandle) {
let _ = window.set_position(PhysicalPosition::new(x, y));
}
}
// Undoes the click-through toggle set by the `dictate:hide` handler.
// Skipped on Linux/X11: this can be the very first call on a
// freshly-built (unrealized) window, and tao's set_ignore_cursor_events
// unwraps a None GDK window there, aborting the process (#873). Linux
// never sets click-through in the first place (see the hide handler),
// so there's nothing to undo.
#[cfg(not(target_os = "linux"))]
let _ = window.set_ignore_cursor_events(false);
let _ = window.show();
}
Expand Down Expand Up @@ -1421,6 +1428,16 @@ pub fn run() {
let handle_for_hide = app.handle().clone();
app.handle().listen("dictate:hide", move |_event| {
if let Some(window) = handle_for_hide.get_webview_window(DICTATE_WINDOW_LABEL) {
// tao's set_ignore_cursor_events unwraps the GDK
// window on Linux/X11, which is None for a
// transparent window that hasn't been realized (or,
// per upstream #873, sometimes even after) — calling
// it aborts the whole process. Skip it there; the
// off-screen parking below plus `hide()` already
// stop the pill from being a click target, so the
// click-through toggle (a macOS-only workaround, see
// above) is unnecessary on Linux anyway.
#[cfg(not(target_os = "linux"))]
let _ = window.set_ignore_cursor_events(true);
let _ = window.set_position(PhysicalPosition::new(-10_000, -10_000));
let _ = window.hide();
Expand Down Expand Up @@ -1648,5 +1665,16 @@ pub fn run() {
}

fn main() {
// WebKitGTK's DMA-BUF renderer cannot allocate GBM buffers on the
// NVIDIA proprietary driver (DRM_IOCTL_MODE_CREATE_DUMB is denied),
// which leaves every webview permanently blank. Disable it before
// any webview is created, unless the user has set it themselves.
#[cfg(target_os = "linux")]
if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none()
&& std::path::Path::new("/proc/driver/nvidia/version").exists()
{
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
}

run();
}