Skip to content

feat: install the stablebar command from Settings - #256

Merged
M4n0x merged 1 commit into
mainfrom
feat/255-stablebar-command
Oct 23, 2026
Merged

M4n0x merged 1 commit into
mainfrom
feat/255-stablebar-command

Conversation

@M4n0x

@M4n0x M4n0x commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

The command line is the app's own executable, StableBar.app/Contents/MacOS/StableBar, and nothing puts it on PATH, so the guide's StableBar --query examples fail with command not found. Closes #255.

Changes

  • Settings → General → Command line (CommandLineToolSettings.swift), below Configuration file:
    • Installed when the first stablebar on the login shell's PATH runs this app, whether StableBar wrote it or it links to the app.
    • Install otherwise. It writes /usr/local/bin/stablebar, a marked two-line script that runs this app's executable with every argument. A script rather than a link, so the app runs from its bundle as it does now.
    • When StableBar's script opens another copy, such as an old download, the row names that copy and Install points it at this one.
    • Name in use for a stablebar that StableBar didn't write; it is never replaced, and install checks that again before writing.
    • Like Open at login, Install needs StableBar in Applications, so the command doesn't point at a copy that moves.
    • The status refreshes whenever the app becomes active.
  • Installing (CommandLineTool.swift) writes directly when the folder is writable. Otherwise it runs mkdir -p and install -m 755 through osascript's do shell script … with administrator privileges, with the command and prompt passed as arguments rather than spliced into the AppleScript. Cancelling the password prompt (-128) does nothing; other failures show in red under the row.
  • Search: "Install the stablebar command" is found by terminal, shell, PATH or CLI. "command line" moved off the Configuration file entry so it lands here.
  • Docs: a new "Install the command" section in docs/command-line.md, linked from its intro and from the General paragraph in docs/settings.md.

No configuration properties change, so decoding, layers, editing and examples don't apply.

Testing

  • swift test --filter CommandLineTool: 14 new tests.
    • The script runs the app with arguments containing spaces, quotes and $HOME unchanged, and names the app it runs, including paths with spaces and quotes.
    • Status: missing; its own script; a link to the app; another copy; another command; the first match on PATH wins; directories and non-executable files are skipped; the install folder is checked when it isn't on PATH.
    • Install: writes a runnable script, repoints an old script, refuses another command, and the privileged shell command creates a missing folder with spaces and quotes in its path.
  • swift test: 314 XCTest and 448 Swift Testing tests pass.
  • Checked separately: writing into the root-owned /usr/local/bin and /usr/local fails with CocoaError.fileWriteNoPermission, which leads to the prompt; the AppleScript compiles with osacompile; a cancel reports (-128).
  • Not checked: the real password prompt from an Applications build, because it writes /usr/local/bin/stablebar on the developer's Mac.

Screenshots were drawn offscreen from scratch files, so paths are under /tmp; a real install shows /usr/local/bin/stablebar. The test runner isn't in Applications, so Install shows disabled with its hint.

Before After
Light
Dark

Each state: installed, another copy, another command, and not installed outside Applications.

Light Dark

Merging

One commit whose message matches the title, so any merge method works.

Claude Opus 5.5 via Claude Code

Settings → General → Command line shows whether the first stablebar on the login shell's PATH
runs this app. Otherwise Install writes /usr/local/bin/stablebar, a script that runs the app's
executable, and asks for an administrator password only when the folder needs one. A command
that StableBar didn't write is never replaced. The guide explains it and how to remove it.

Closes #255
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner October 23, 2026 07:24
@M4n0x
M4n0x merged commit 28ee7e6 into main Oct 23, 2026
7 checks passed
@M4n0x
M4n0x deleted the feat/255-stablebar-command branch October 23, 2026 07:46
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install a stablebar command from Settings

1 participant