Skip to content

Only bind F9 to Voxtype if installed (#5882) - #5897

Merged
dhh merged 1 commit into
basecamp:devfrom
r3quie:dev
May 21, 2026
Merged

Only bind F9 to Voxtype if installed (#5882)#5897
dhh merged 1 commit into
basecamp:devfrom
r3quie:dev

Conversation

@r3quie

@r3quie r3quie commented May 18, 2026

Copy link
Copy Markdown
Contributor

Only bind F9 to Voxtype if installed (#5882)

Fixes #5882

Currently, F9 is globally bound to Voxtype dictation, which overrides default app bindings even for users who don't have it installed.

This PR:

  • Conditionally binds F9 in utilities.lua only if the voxtype command is present.
  • Adds an o.has_command helper in helpers.lua. Had to use io.popen instead of an inline if os.execute("omarchy-cmd-present voxtype")... for this because Hyprland intercepts the SIGCHLD signal. This causes os.execute to miss the child's exit code (returning nil with an ECHILD "No child processes" error), making it fail silently. Reading stdout via .popen solves this.

No migration needed.

This is my first proper PR, so I apologize for any oversights on contribution standards; couldn't really find any.

Copilot AI review requested due to automatic review settings May 18, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Conditionally bind the F9 push-to-talk dictation keys only when the voxtype command is available, using a new has_command helper.

Changes:

  • Added o.has_command helper that shells out to omarchy-cmd-present to detect installed commands.
  • Wrapped the F9 push-to-talk bindings in a has_command("voxtype") guard.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
default/hypr/helpers.lua Adds has_command helper for detecting available CLI commands.
default/hypr/bindings/utilities.lua Guards F9 voxtype bindings behind the new has_command check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread default/hypr/bindings/utilities.lua Outdated
Comment on lines +60 to +65
o.bind("SUPER + CTRL + X", "Toggle dictation", "voxtype record toggle")
o.bind("F9", "Start dictation (push-to-talk)", "voxtype record start")
o.bind("F9", "Stop dictation (push-to-talk)", "voxtype record stop", { release = true })

if o.has_command("voxtype") then
o.bind("F9", "Start dictation (push-to-talk)", "voxtype record start")
o.bind("F9", "Stop dictation (push-to-talk)", "voxtype record stop", { release = true })
end
Comment thread default/hypr/helpers.lua Outdated
local output = handle and handle:read("*a") or ""
if handle then handle:close() end
return output:match("1") ~= nil
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never wrote LUA, but I was wondering why this code is so complicated. Would this just work instead?

function o.has_command(cmd)
  return os.execute("omarchy-cmd-present " .. shell_quote(cmd)) == true
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work. Like I said in the PR comment, os.execute never receives the exit code of the command when run live in Hyprland. Your code works fine if you run it straight through Lua or the LuaJIT, just not when Hyprland runs it. I do not really know why but you are free to try on your machine.

@NicolasDorier

NicolasDorier commented May 18, 2026

Copy link
Copy Markdown
Contributor

I like this PR, as the bind on F9 is really inconvenient and I don't use voxtype. (F9 is the default for toggling a breakpoint in VSCode)

@dhh

dhh commented May 19, 2026

Copy link
Copy Markdown
Member

I think I'd rather that we add a lua rule as a toggle when voxtype is installed and remove it when uninstalled. Like we do for the single-window-aspect-ratio.lua. Then we don't need any runtime checks.

@axelfontaine

Copy link
Copy Markdown
Contributor

In general, Omarchy should probably namespace almost all its own binds behind SUPER or CAPS LOCK as otherwise the potential for conflict with individual applications is just too high. F9 is also used in mc, IntelliJ and many more...

@dhh

dhh commented May 20, 2026

Copy link
Copy Markdown
Member

This specific keybind needs a single key for activation, so that just is what it is. But it's your system, so you can always change how it works.

@r3quie

r3quie commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@dhh Reworked. Is this what you meant?

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

Successfully merging this pull request may close these issues.

F9 should not be bound to Voxtype dictation by default. Bare function keys must not be rebound.

5 participants