Skip to content

Take the login shell, and one whole process, out of the bar's Hyprland calls - #9419

Open
VykosMolt wants to merge 8 commits into
omacom:quattrofrom
VykosMolt:fix/exec-login-shell-latency
Open

VykosMolt wants to merge 8 commits into
omacom:quattrofrom
VykosMolt:fix/exec-login-shell-latency

Conversation

@VykosMolt

@VykosMolt VykosMolt commented Aug 31, 2026 •

Copy link
Copy Markdown

Workspace and keyboard-layout clicks launch hyprctl through the bar's login shell on the base implementation. Workspace focus now dispatches over the widget's existing Hyprland connection. Keyboard-layout switching uses bar.runProgram() and Util.execProgram() to pass literal arguments directly to Quickshell. The plugin bar facade exposes the same validated array-of-strings operation to cloned widgets. Commands that require the login environment keep their existing path.

Merged current quattro, which added per-monitor workspaces (#15655). Workspace focus keeps its block/slot logic and goes over the Hyprland socket. Clicking the layout glyph on another monitor's bar now also focuses that monitor over the socket, and runs the layout toggle once Hyprland reports that monitor focused; if focus doesn't arrive within a second, the toggle is dropped. At this head the bar (252), keyboard-layout (75), hyprland-floating-workspaces (44) and hyprland-monitor-workspaces (15) checks pass. Not run in a live Hyprland session.

A keyboard-layout click continues to synchronize every device sharing the selected layout list to the same wrapped absolute index. Each device name remains a literal argument, including shell syntax. This revision also retains current Quattro's cycleBackground control and background-mode behavior while resolving the Bar.qml conflict.

Validation against Quattro 60cb9bf: 240 bar checks and 75 keyboard-layout checks pass (233 and 71 on clean Quattro), as does git diff --check. The tests no longer search the source; a workspace click is checked by running focusWorkspace against a fake Hyprland connection. Tests execute the facade → Bar → Util → Quickshell path, reject malformed arrays, preserve literal arguments and verify synchronized devices and wrapping.

Earlier native validation on October 9 clicked a cloned keyboard-layout widget through QMP, switched both guest keyboards from English (US) to German, and showed DE in the cloned bar. The capture and compositor state were inspected and the original configuration restored. That evidence covers the direct-dispatch mechanism; it is historical validation, not a full native run of this newly merged head.

@VykosMolt
VykosMolt force-pushed the fix/exec-login-shell-latency branch from cd3ed85 to 3b74be8 Compare August 31, 2026 19:07
@VykosMolt VykosMolt changed the title Stop sourcing a login shell to run hyprctl from the bar Take the login shell, and one whole process, out of the bar's Hyprland calls Aug 31, 2026
…d calls

`bar.run()` hands its command to `Util.execDetached()`, which runs it as
`bash -lc`. A login shell sources /etc/profile and every script in
/etc/profile.d before the command it was given starts. That is the right trade
for most `bar.run()` callers, which launch `omarchy-*` scripts and GUI
applications that want the session environment, and `execArgv` already documents
why it keeps it.

Two callers get nothing from it, and they are the two that run hyprctl.

Clicking a workspace does not need hyprctl at all. The widget already holds a
Hyprland socket open for `Hyprland.workspaces`, so the focus request goes down
that instead of spawning a login shell that execs a client to open a second
socket. The dispatched expression is the one tiling.lua binds, so a click and
the keybinding cannot drift apart. This is also why SUPER+N felt instant and
clicking the bar did not: the keybinding is compiled into Hyprland at config
load and dispatched in-process.

Clicking the keyboard layout does need a process, because switchxkblayout is a
hyprctl command rather than a dispatcher and does not go over the dispatch
socket. It gets `Util.execProgram()`, which runs an argv with no shell in
between, exposed to widgets as `bar.runProgram()` alongside `bar.run()`. `run`,
`execDetached` and `execArgv` are untouched.

Passing an argv also means the keyboard device name is no longer pasted into a
command line and quoted back out of it. The argv that reaches hyprctl is
identical; there is just no longer a string for the quoting to have to be right
about.

On this machine `bash -lc true` is 110ms against 2ms for `bash -c true`, and it
is not the user's dotfiles: with an empty HOME it is still 110ms, because the
cost is /etc/profile.d. One script there accounts for 85ms of that, and dropping
it still leaves 42ms in front of a bar click.
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no new actionable issues found.

Summary

Removes the login shell from the bar’s direct Hyprland actions.

  • Workspace clicks send focus through the existing Hyprland connection.
  • Keyboard clicks switch every matching device with literal arguments.
  • Other-monitor layout clicks wait for focus before toggling.

No new actionable issues were found. The previous source-text test finding is addressed. Review was based on source inspection; no tests or live Hyprland checks were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  W[Workspace click] --> H[Hyprland.dispatch]
  H --> C[Hyprland]
  K[Keyboard-layout click] --> B[Bar.runProgram]
  P[Cloned keyboard widget] --> F[PluginBarApi.runProgram]
  F --> B
  B --> U[Util.execProgram]
  U --> Q[Quickshell.execDetached]
  Q --> T[hyprctl switchxkblayout]
  T --> C
Loading

Reviews (4) · Last reviewed commit: "Drop source greps from the bar click tes..." · Reviewed by Greptile

Comment thread bin/omarchy-agent-account-add Resolved
@greptile-apps

greptile-apps Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

VykosMolt and others added 3 commits October 14, 2026 22:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The layout click focuses the monitor over the Hyprland socket instead of
hyprctl, and runs the toggle on the monitor's focus change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread test/shell.d/bar-test.sh Resolved
VykosMolt and others added 2 commits November 13, 2026 19:49
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants