Clicking workspaces in BarWidget is sluggish vs keybinds
System details
Omarchy 4.0.0-1, Thinkpad Carbon X1 gen 13
What's wrong?
What happened
Commons/Util.qml's execDetached wraps every dispatched command in a login shell:
function execDetached(command) {
Quickshell.execDetached(["bash", "-lc", command])
}
bash -lc sources /etc/profile and the user's ~/.bash_profile/~/.profile on every single invocation, on top of the fork/exec itself. Any bar interaction that goes through Bar.run() → execDetached pays this cost on every call — most noticeably Workspaces.qml's focusWorkspace, which shells out to hyprctl dispatch on every click:
function focusWorkspace(id) {
if (!root.bar) return
root.bar.run("hyprctl dispatch " + Util.shellQuote("hl.dsp.focus({ workspace = \"" + id + "\" })"))
}
Clicking a workspace pill in the bar is perceptibly slower than switching workspaces via a native Hyprland keybind, which is handled entirely inside the compositor with no IPC round trip and no shell involved at all.
Expected
Bar-driven Hyprland dispatches (workspace switching, and likely other Bar.run() call sites) should feel as instant as the equivalent keybind, since Quickshell already maintains a live IPC connection to Hyprland via the Quickshell.Hyprland import.
Steps to reproduce
- Fresh Omarchy 4.0.0 install, default Quickshell bar
- Switch workspaces via a keybind (e.g.
SUPER + 2) — instant - Switch workspaces by clicking a workspace pill in the bar — noticeably slower, subjectively closer to ~100ms+ than the keybind's near-zero latency
Evidence
Traced the call path from the bar widget down to the actual spawn:
Workspaces.qml→root.bar.run(...)Bar.qml'srun():
function run(command) {
if (!command) return
Util.execDetached(command)
}
Util.qml'sexecDetached():
function execDetached(command) {
Quickshell.execDetached(["bash", "-lc", command])
}
So every workspace click is: bar widget → bash -lc (login shell, sources profile files) → hyprctl (separate process, parses args, opens its own connection to Hyprland's IPC socket) → dispatch. The keybind path skips all of this — it's handled natively inside Hyprland.
Confirmed the fix locally by cloning the plugin (omarchy-plugin-clone omarchy.workspaces --edit) and replacing the function:
Before:
function focusWorkspace(id) {
if (!root.bar) return
root.bar.run("hyprctl dispatch " + Util.shellQuote("hl.dsp.focus({ workspace = \"" + id + "\" })"))
}
After:
function focusWorkspace(id) {
Hyprland.dispatch("hl.dsp.focus({ workspace = \"" + id + "\" })")
}
Hyprland.dispatch() (already available via the Quickshell.Hyprland import at the top of Workspaces.qml) reuses Quickshell's existing persistent socket connection instead of spawning a shell + hyprctl process. After this change, clicking a workspace pill feels identical to using the keybind.
Suggested fix
Two independent fixes, either of which helps:
- In
Workspaces.qml: useHyprland.dispatch(...)directly instead of routing throughBar.run()/execDetached, as shown above. - In
Util.qml:execDetacheddefaulting to a login shell (bash -lc) for arbitrary commands adds unnecessary profile-sourcing overhead to every bar-triggered command, not just Hyprland dispatches. A non-login shell (bash -c) would avoid this for the general case, though callers that specifically need Hyprland IPC are better served byHyprland.dispatch()regardless.
Confirmed a second, related fix — the main menu button (menu/BarWidget.qml) had the same latency problem via a slightly different path: its onPressed built a shell command string and ran it through Bar.run()/execDetached:
onPressed: function(button) {
if (!root.bar) return
if (button === Qt.RightButton) root.bar.run("xdg-terminal-exec")
else root.bar.run("omarchy-shell shell toggle omarchy.menu '{\"menu\":\"root\"}'")
}
That resolves to: bash -lc (login shell) → omarchy-shell (bash script) → parses argv → forwards to Quickshell's own IpcHandler { target: "shell" }, whose toggle method just calls shell.toggle(pluginId, payloadJson) on the root shell object (shell.qml:510).
Since Bar.qml already exposes property var shell: null (populated from the root shell instance), that same shell.toggle(...) function is reachable directly from any bar widget via root.bar.shell, skipping the login shell, the bash script, and the IPC round-trip entirely:
onPressed: function(button) {
if (!root.bar) return
if (button === Qt.RightButton) root.bar.run("xdg-terminal-exec")
else if (root.bar.shell && typeof root.bar.shell.toggle === "function")
root.bar.shell.toggle("omarchy.menu", JSON.stringify({ menu: "root" }))
else
root.bar.run("omarchy-shell shell toggle omarchy.menu '{\"menu\":\"root\"}'")
}
(kept the old path as a fallback in case root.bar.shell is ever unset). Verified locally via omarchy-plugin-clone omarchy.menu --edit — clicking the menu button now feels as instant as SUPER+SPACE, where before there was a clear, repeatable delay versus the keybind.
Given the IpcHandler { target: "shell" } wrapper exists specifically so external tools can reach shell.toggle()/shell.hide()/etc. without the shell already running in-process, any first-party bar widget that's dispatching through omarchy-shell/omarchy-menu purely to talk to its own already-running shell instance is very likely paying this same avoidable cost — the CLI wrappers make sense for external callers (keybinds, scripts), but a bar widget calling back into the process it's already part of shouldn't need to leave the process at all.
Confirming this on a second machine (Omarchy 4.0.0-1), and adding a data point: the same cost applies to menu actions, not only bar clicks. Menu.qml's runAction goes through the same Util.execDetached, so every row in the Omarchy menu pays it too.
Measured here, best of five runs each:
bash -c true |
1ms |
bash -lc true |
73ms |
source /etc/profile |
69ms |
So essentially the whole difference is /etc/profile. What makes that worth flagging is why it costs 69ms here:
/etc/profile.d/vapoursynth.sh: export VSSCRIPT_PATH=$(vapoursynth get-vsscript)
A single third-party package drops one line into /etc/profile.d that shells out to a Python program, and it accounts for ~69 of the 73ms. Under load I measured the same bash -lc true at 170–310ms. The per-action cost is therefore unbounded and outside Omarchy's control — any package the user installs can add to it, and every menu row and bar click pays it again.
Concretely, in a third-party bar plugin whose menu row summons a picker, the path from row to visible picker measures ~0.51s: roughly 230ms of menu summon and draw, ~75–300ms of profile sourcing, and the rest actual work. The profile share is pure overhead repeated on every invocation.
One suggestion that keeps the reason -l is there in the first place — user PATH edits in a profile applying to dispatched commands — while paying for it once rather than per action: snapshot the login environment at shell start (or lazily on first dispatch), then dispatch with bash -c under that environment. Something like running bash -lc 'export -p' once, caching the result, and reusing it. Users who edit their profile mid-session would need a shell restart to pick it up, which seems a fair trade against a fixed tax on every interaction.
I hit the same lag on 4.0.0, cloned omarchy.workspaces as a third-party plugin, and changed only focusWorkspace — bar.run("hyprctl dispatch ...") → Hyprland.dispatch(...) — which matches #7151's hunk to that file verbatim. Workspace clicks now feel instant, on par with keybinds. No regressions after daily use. Happy test case for either PR.
The mechanism is still present on quattro (902fd8aeb). A workspace pill click goes from focusWorkspace() (shell/plugins/bar/widgets/Workspaces.qml:35) to Bar.run() and then Util.execDetached() (shell/Commons/Util.qml:57), which starts a new bash -lc and a separate hyprctl process on every click. The menu button (shell/plugins/menu/BarWidget.qml:22) does the same to reach omarchy-shell shell toggle, which ends up back in the shell process that sent it. Keyboard layout, microphone middle-click, system update and menu actions use the same path.
Measured on a fresh Omarchy worker VM from the ISO, best of seven runs: bash -lc true takes about 4ms against 1ms for bash -c true, and the whole click-path dispatch (bash -lc "hyprctl dispatch …") takes about 7ms. On a stock install the overhead is real but small. It grows with whatever is in /etc/profile.d and the user's profile. On this worker, vapoursynth.sh (a dependency of ffmpeg and mpv, so present everywhere) exports a fixed path. Running vapoursynth get-vsscript, the lookup the script used in the earlier measurement here, takes about 50ms each time. That fits the 69–73ms reported above. I did not reproduce a 100ms stall on a stock install.
Three open pull requests address this, all against quattro:
- #7011 is the oldest. It uses
Hyprland.dispatchfor workspace focus and calls the shell's in-processtogglefor the menu button, falling back to the CLI. It fixes both symptoms in this issue without changing the environment external commands run in, and it merges cleanly withquattrotoday. - #7231 switches
execDetachedand the menu's provider and guard scripts tobash -c. It still spawns the shell andhyprctl. Its premise that the session already has the login-shellPATHconflicts with d2fd2e11c, which restored the login shell forexecArgvbecause GUI actions stopped resolving without it. - #9419 covers workspace focus and keyboard layout but not the menu button.
#7011 is the fix this issue points to. I tried to link it so that merging it would close this issue, and the bot's tooling refused: #7011 is currently classified as a feature that has not been assigned to it.
Reviewed by Claude Opus 5.5 and, as a second opinion, Codex Medium. Codex reached the same diagnosis and the same choice of #7011. It also listed the other call sites and noted that d2fd2e11c changed execArgv rather than these paths. The two reviews are not guaranteed to be independent. This is waiting on the maintainer to choose between the pull requests.