Skip to content

fix: use the current login shell for desktop app launches - #11965

Open
r4lphio wants to merge 5 commits into
omacom:quattrofrom
r4lphio:fix/launcher-login-shell
Open

r4lphio wants to merge 5 commits into
omacom:quattrofrom
r4lphio:fix/launcher-login-shell

Conversation

@r4lphio

@r4lphio r4lphio commented Sep 15, 2026

Copy link
Copy Markdown

What this fixes

After changing the login shell with chsh, the running desktop launcher can keep its old SHELL. Applications such as T3 Code use that inherited value to select their terminal shell, so quitting and reopening the application from Apps still starts Bash after the account has switched to Zsh.

Read the account's current login shell for each Apps launch. Pass it inside the UWSM command so it reaches both scope and service launches. GTK still resolves the desktop entry, including names with spaces and IDs ending in .desktop. If the account lookup fails or the shell is unavailable, retain the previous launch behavior.

This treats the account login shell as authoritative for Apps launches. A desktop entry can still override SHELL in its own command. It does not change existing app processes, the desktop session environment, or other launch paths.

Verification

  • Reproduced on Omarchy 4.0.3-1 with an account using Zsh and a caller carrying SHELL=/bin/bash. A temporary desktop entry launched through the old UWSM/GTK path received /bin/bash; the new helper received /usr/bin/zsh. Verified both real UWSM scope and service launches.
  • Focused launcher and app-search tests pass. Coverage includes repeated shell changes, literal desktop IDs and URI arguments, unavailable shells, stale service-manager environments, and error propagation. Bash syntax and diff checks pass.
  • Independent scenario review found no remaining issues after fixing the service-launch case.
  • Ran ./test/all. CLI passed; 4 of 242 shell test files failed: launch-about-test.sh, locate-test.sh, omarchy-kernel-migration-test.sh, and update-pacman-test.sh. Each failure also reproduces on unmodified upstream 6ea32155. The locate failure occurs after the agent scanner tests leave Python bytecode under bin/, which locate's test reads as UTF-8. These unrelated failures are outside this patch.

Created with GPT-6 Astra through the Codex harness in T3 Code.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@llstrk

llstrk commented Sep 28, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: in stubbed tests and in the UWSM, systemd and GLib source, the new omarchy-launch-desktop helper gives the app the account's current passwd shell in both UWSM scope and service mode. Desktop IDs reach gtk-launch exactly as before, and URI arguments pass through unchanged. No functional defect was found in the tested scope. The notes below cover scope boundaries, one small test gap and overlapping open PRs.

Apps launch, caller has stale SHELL=/bin/bash, passwd shell is zsh (stubbed) Merge base PR head
UWSM scope mode /bin/bash passwd shell
UWSM service mode (manager environment only) /bin/bash passwd shell
Lookup fails, shell missing, empty or relative inherited SHELL inherited SHELL (unchanged launch)

Verified details:

  • The change to AppLibrary.qml still goes through Util.shellQuote and Util.execDetached, so quoting is as safe as before. IDs with spaces, org.telegram.desktop (an ID that itself ends in .desktop, which reaches gtk-launch as org.telegram.desktop.desktop, as on the merge base) and an ID containing $(...), backticks and ; each reached gtk-launch as one exact argument, and nothing in them was executed.
  • Setting SHELL inside the uwsm-app command (commit c65c5d4) is what makes service mode work: UWSM's service mode passes only the XDG seat/session variables with --setenv, so the service otherwise starts with the user manager's environment. That environment has SHELL fixed from passwd when the user manager starts, which confirms the stale-shell premise.
  • The launch's exit status reaches the caller in scope mode (a gtk-launch exit of 17 and a uwsm-app exit of 3, with stubs). In service mode UWSM starts the unit without waiting, so only the start status comes back, as before.
  • getent passwd <uid> | cut -d: -f7 always yields the shell field: glibc's putpwent rejects colons in every field except GECOS and rewrites them there.
  • desktop-login-shell-test.sh, app-search-test.sh and desktop-entry-launch-test.sh pass on the head and on the head merged onto the current quattro tip, and omarchy commands --check passes. On the merge base, the updated app-search-test.sh fails as expected.

Other launch paths still pass the stale shell

Only the Apps menu (AppLibrary.qml:85) uses the helper. Nine lines in eight scripts on quattro still run setsid uwsm-app -- gtk-launch directly, including bin/omarchy-install-ai-t3-code:28 (T3 Code, the app named in the PR) and bin/omarchy-install-and-launch:27, which serves the menu's install-and-launch entries. Keybinding and terminal launches are unchanged too. The PR description says other launch paths are out of scope.

Impact: after chsh in the same session, T3 Code launched from Apps gets the new shell, but T3 Code launched right after installing it from the menu still gets the stale one.

Suggested change: switch these call sites to omarchy-launch-desktop, here or in a follow-up. test/shell.d/desktop-entry-launch-test.sh:67-69, :85 and :93 assert the literal uwsm-app -- gtk-launch commands and would need to change with them.

Behaviour notes for maintainers

  • A deliberately set SHELL is overridden for Apps launches. A SHELL set without chsh (for example through environment.d or a compositor environment setting) now loses to the passwd shell for Apps launches only, while every other launch path keeps it. The PR calls the login shell "authoritative", so this is intended. How often such setups occur is unknown.
  • D-Bus-activated apps do not receive the new SHELL. GIO starts entries with DBusActivatable=true over the session bus instead of spawning them, so the SHELL set on gtk-launch never reaches the process. Nautilus, installed by default, is such an entry. Already running single-instance apps are also unaffected. Behaviour matches the merge base for these apps, so this is a limit of the fix, not a regression.

Optional test improvement: no test case uses a relative shell path, so removing the $login_shell == /* check leaves desktop-login-shell-test.sh passing (a surviving mutation). The case needs a relative path that points to an existing executable from the helper's working directory, because -x resolves it there. For example, (cd "$scratch" && PASSWD_SHELL=bin/gtk-launch SHELL=/bin/bash "$ROOT/bin/omarchy-launch-desktop" example.desktop) should keep /bin/bash; it passes with the current helper and fails once the check is removed.

Overlapping open PRs: #8978 (failed-launch reporting), #10570 (uwsm-app -t service for GDK_SCALE sync) and #9479 (workspace pinning) each rewrite the same AppLibrary.qml launch line, and a three-way merge of each with this PR conflicts there and in app-search-test.sh. Their goals are compatible, so whichever merges later has to keep both behaviours. In particular, #9479's wrapper still contains the direct uwsm-app -- gtk-launch command.


Review information

Test scope: source review of the PR against the merge base and the current quattro tip, plus UWSM v0.27.0, GLib, GTK3 gtk-launch, glibc, systemd, foot, Nautilus and T3 Code source (current upstream, not necessarily the exact Arch package versions). Isolated command-only runs used stubbed getent, uwsm-app and gtk-launch, with the service-mode stub keeping only a manager environment. No real UWSM, systemd, D-Bus or desktop launches were made, so the author's live test was not reproduced. The full ./test/all suite was not run, so the reported unrelated failures were not checked.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

The fallback cases read the log the service-mode case left behind, so they passed even if the helper launched nothing when the lookup failed. Clear it first and check the desktop id was passed too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on an Omarchy worker VM built from the ISO, with the shell linked to this branch.

Reproduction. After chsh -s /usr/bin/sh in a running session, an app started from the Apps launcher (opened with omarchy-menu toggle apps, the entry typed and launched) recorded SHELL=/usr/bin/bash with the AppLibrary.qml change reverted, and SHELL=/usr/bin/sh with it in place. Called directly from the shell's environment, the old uwsm-app -- gtk-launch gave /usr/bin/bash in both scope and service mode, and the helper gave /usr/bin/sh. So the bug is real and this fixes it for the Apps launcher.

Pushed c620e92 to your branch: in test/shell.d/desktop-login-shell-test.sh the two fallback cases read the log the service-mode case had just written, so they passed even if the helper launched nothing when the lookup failed. They now clear the log first and check the desktop id too. With the helper's else branch replaced by exit 0, the test now fails; before, it passed.

Tests on the worker. ./test/cli passes. desktop-login-shell-test.sh, app-search-test.sh and desktop-entry-launch-test.sh pass. The full shell suite had 4 failing files, none of them from this change: ascii-test.sh, branding-about-animation-test.sh and omarchy-kernel-migration-test.sh fail the same way on the merge base 6ea32155. locate-test.sh fails only because an earlier test leaves bin/__pycache__ behind, and it passes once that is removed. runtime-smoke-test.sh passes when run on its own. Because the suite isn't green, this isn't marked ready.

Scope. The change is proportionate: a 15-line hidden helper and a one-line change to the launcher. It covers the Apps launcher only. The installer scripts that launch apps after installing them (omarchy-install-and-launch, omarchy-install-ai-t3-code and others) still call uwsm-app -- gtk-launch directly, so they keep the old shell. A SHELL set on purpose without chsh is now overridden for Apps launches. Both match what the description says.

Second opinion. Codex Medium reviewed the diff in two rounds. The first found the test gap above. The second, on c620e92, found nothing open and agreed the helper is correct and proportionate. Its independence from this review isn't guaranteed.

No open issue for this was found to link. Waiting on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous test-layout issue is fixed, and no new actionable issues were found.

Summary

Apps launches now read the account’s current login shell instead of relying on the desktop’s inherited SHELL.

  • Ordinary app launches use the account’s current login shell.

No new actionable issues were found in the changes since the previous review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User selects an app] --> B[omarchy-launch-desktop]
  B --> C[Read current account shell]
  C --> D{Absolute executable path?}
  D -->|Yes| E[UWSM runs env SHELL=current gtk-launch]
  D -->|No| F[UWSM runs gtk-launch unchanged]
  E --> G[GTK resolves the desktop entry]
  F --> G
Loading

Reviews (3) · Last reviewed commit: "Move launch-desktop tests into the deskt..." · Reviewed by Greptile

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 31, 2026
quattro removed the AppLibrary.qml source regexes from app-search-test.sh in omacom#16334, including the one this branch had rewritten to match the helper, so the conflict resolves to quattro's version of that file. The launch change itself merges cleanly beside quattro's new terminal-entry path through omarchy-launch-tui.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch had stopped merging cleanly into quattro, so I merged quattro into it and pushed bf76728. The only conflict was test/shell.d/app-search-test.sh: #16334 removed the AppLibrary.qml source regexes from that file, including the assertion this branch had rewritten, so the merge takes quattro's version. AppLibrary.launch now sends terminal entries to omarchy-launch-tui first, and your helper call sits on the path for every other entry, unchanged.

Re-verified on quattro on an Omarchy worker VM built from the ISO, with the shell linked to each tree. Each session started with bash as the login shell. I then ran chsh -s /usr/bin/sh and launched a probe entry from the Apps launcher (omarchy-menu toggle apps, typed, Enter). On quattro 5df8f9e and on this head with the AppLibrary.qml line reverted, the app got SHELL=/usr/bin/bash. On bf76728 it got SHELL=/usr/bin/sh.

Tests on the worker. ./test/cli passes. desktop-login-shell-test.sh, app-search-test.sh and desktop-entry-launch-test.sh pass. The full shell suite has 5 failing files out of 414: agent-account-exec-test.sh, ascii-test.sh, branding-about-animation-test.sh, first-run-test.sh and runtime-smoke-test.sh. All five fail the same way on quattro 5df8f9e, so none come from this change, but the suite isn't green.

Second opinion. Codex Medium and muse-wonder via pi, thinking high, reviewed the merged head. Neither found a defect in the merge or the helper, and their agreement with this review isn't guaranteed independent. They raised three points:

  • quattro's AGENTS.md now asks for tests to extend the area's existing file and stay in proportion to the change. This adds a 61-line desktop-login-shell-test.sh for a 15-line helper, next to the existing desktop-entry-launch-test.sh. Folding a shorter version of the helper's cases into that file would fit the current rules better. I've left that to you rather than rewriting your test.
  • Terminal entries now go through omarchy-launch-tui and don't pass through the helper, so a shell opened from inside one (:terminal in Neovim, say) still gets the stale SHELL.
  • Entries with DBusActivatable=true are started over D-Bus by gtk-launch, so the env SHELL= never reaches them either.

The last two are outside what this PR sets out to fix.

#8978 and #9479 also rewrite the same AppLibrary.qml launch line, for different goals. Whichever lands later needs to keep both.

Waiting on the maintainer to decide whether Apps launches should take the passwd shell over the session's SHELL, and on the suite failures quattro already has.

AGENTS.md asks tests to extend the area's existing file and stay in
proportion to the change. Keep the two cases that catch a real
regression: the login shell surviving a UWSM service launch, and a
launch still happening when the lookup fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 4, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for moving the tests, @r4lphio. Your new commit 8a1b3f9 drops desktop-login-shell-test.sh and adds two cases to desktop-entry-launch-test.sh. That settles the test-size point from my last comment. The branch still merges cleanly into current quattro (3b36b9e), and the AppLibrary.qml launch line comes through the merge unchanged.

Re-verified on an Omarchy worker VM built from the ISO, with the shell linked to each tree. Each session started with bash as the login shell. I then ran chsh -s /usr/bin/sh and launched a probe entry from the Apps launcher. On quattro 3b36b9e, and on this head with the AppLibrary.qml line reverted, the app got SHELL=/usr/bin/bash. On 8a1b3f9, and on 8a1b3f9 merged into 3b36b9e, it got SHELL=/usr/bin/sh.

Tests on the worker. ./test/cli passes. desktop-entry-launch-test.sh (23 cases) and app-search-test.sh pass. Both new cases fail for the right reason when I break the helper on purpose: once with the plain uwsm-app -- gtk-launch launch restored, and once with the shell check removed. The full shell suite has 4 failing files: ascii-test.sh, branding-about-animation-test.sh, first-run-test.sh and runtime-smoke-test.sh. They fail the same way on this branch's base 5df8f9e and on the merge with quattro 3b36b9e, so none come from this change, but the suite isn't green.

Second opinion. Codex Medium and muse-wonder via pi, thinking high, reviewed 8a1b3f9 and found no defects. They agreed with this review, and their agreement isn't guaranteed independent. One thing they checked that I hadn't written down: the new getent, uwsm-app and gtk-launch stubs share the file's mock PATH, and they can't affect the later installer cases. Those cases go through the existing setsid stub, which logs its arguments and never runs them.

Still open, for the maintainer. Only Apps launcher entries get the account's current shell. Apps started from keybindings go through uwsm-app -- <command> in default/hypr/helpers.lua:173, and they still get the session's SHELL after a chsh. Whether launches should take the passwd shell over the session's SHELL at all, and if so whether only from Apps, is the maintainer's decision.

#8978, #9479 and #16097 all rewrite the same AppLibrary.qml launch line, for other goals. Whichever lands later needs to keep this helper call.

Waiting on the maintainer for that decision, and on the suite failures quattro already has.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants