Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

VK_LOADER_LAYERS_DISABLE=~implcit~ default on windows (#2053)

CJ Pais2c5c7601d8db
diff --git a/AGENTS.md b/AGENTS.md
index daeea5f4..60bd6cd8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -197,7 +197,7 @@ Access debug features: `Cmd+Shift+D` (macOS) or `Ctrl+Shift+D` (Windows/Linux)
## Platform Notes
- **macOS**: Metal acceleration, accessibility permissions required for keyboard shortcuts
-- **Windows**: Vulkan acceleration, code signing
+- **Windows**: Vulkan acceleration, code signing. Implicit Vulkan layers (overlays, capture hooks) are disabled for the Handy process via `VK_LOADER_LAYERS_DISABLE=~implicit~` set in `main.rs`; opt out with `HANDY_KEEP_VULKAN_IMPLICIT_LAYERS=1` or by setting `VK_LOADER_LAYERS_DISABLE` yourself
- **Linux**: OpenBLAS + Vulkan, limited Wayland support, overlay uses GTK layer shell (disable with `HANDY_NO_GTK_LAYER_SHELL=1`)
- **Nix/NixOS**: the Nix package sets `HANDY_DISABLE_UPDATER=1` to force-disable the self-updater at runtime without touching the persisted setting (self-update can't work against an immutable `/nix/store`)
diff --git a/README.md b/README.md
index 6b9fe008..4d5573bb 100644
--- a/README.md
+++ b/README.md
@@ -493,6 +493,19 @@ Exec=env HANDY_NO_GTK_LAYER_SHELL=1 handy
If a workaround helps you, please [open an issue](https://github.com/cjpais/Handy/issues) describing your distro, desktop environment, and session type — that information helps us narrow down the underlying bug.
+### Vulkan Overlays and Capture Tools on Windows (`HANDY_KEEP_VULKAN_IMPLICIT_LAYERS`)
+
+On Windows, Handy asks the Vulkan loader to skip implicit layers to avoid crashes caused by overlay and capture hooks ([#2049](https://github.com/cjpais/Handy/issues/2049)). GPU acceleration remains enabled; this does not change system-wide settings.
+
+To opt out for GPU selection or debugging tools, fully quit Handy (including the tray icon), then run both commands in the same PowerShell window:
+
+```powershell
+$env:HANDY_KEEP_VULKAN_IMPLICIT_LAYERS = "1"
+& "$env:ProgramFiles\Handy\handy.exe"
+```
+
+Adjust the executable path if needed. This override only applies to apps launched from that PowerShell session, not the Start menu. Handy also preserves any existing `VK_LOADER_LAYERS_DISABLE` value.
+
### Handy Starts or Stops Recording on Its Own (Linux)
Handy 0.9.4 and earlier listened for `SIGUSR1` as a remote-control trigger. WebKitGTK — the webview engine embedded in Handy on Linux — uses that same signal internally to coordinate JavaScript garbage collection, so GC cycles were misread as hotkey presses: recordings started on their own, or real dictations were cut off mid-sentence (typically ~2 minutes in). See [#1660](https://github.com/cjpais/Handy/issues/1660).
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 81e8dde8..8677ae3a 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -29,6 +29,7 @@ pub use cli::CliArgs;
#[cfg(debug_assertions)]
use specta_typescript::{BigIntExportBehavior, Typescript};
use tauri_specta::{collect_commands, collect_events, Builder};
+pub use utils::env_flag_enabled;
use env_filter::Builder as EnvFilterBuilder;
use managers::audio::AudioRecordingManager;
@@ -886,6 +887,13 @@ pub fn run(cli_args: CliArgs) {
))
.manage(cli_args.clone())
.setup(move |app| {
+ #[cfg(target_os = "windows")]
+ log::info!(
+ "Vulkan layer policy: VK_LOADER_LAYERS_DISABLE={:?}, HANDY_KEEP_VULKAN_IMPLICIT_LAYERS={}",
+ std::env::var_os("VK_LOADER_LAYERS_DISABLE"),
+ utils::env_flag_enabled("HANDY_KEEP_VULKAN_IMPLICIT_LAYERS"),
+ );
+
specta_builder.mount_events(app);
// Headless one-shot path (`--transcribe-file` / `--list-devices` /
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 29362594..5322eb5b 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -14,5 +14,16 @@ fn main() {
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
}
+ #[cfg(target_os = "windows")]
+ {
+ // Avoid overlay/capture layer crashes (#2049). Set before backend
+ // initialization, preserving user overrides.
+ if std::env::var_os("VK_LOADER_LAYERS_DISABLE").is_none()
+ && !handy_app_lib::env_flag_enabled("HANDY_KEEP_VULKAN_IMPLICIT_LAYERS")
+ {
+ std::env::set_var("VK_LOADER_LAYERS_DISABLE", "~implicit~");
+ }
+ }
+
handy_app_lib::run(cli_args)
}