Fix --no-open ignored on macOS and Windows in content-calendar viewer#92
Open
Osamaali313 wants to merge 1 commit into
Open
Conversation
The auto-open guard combined `and`/`or` without parentheses:
if not args.no_open and os.environ.get("DISPLAY", "") \
or sys.platform == "darwin" or sys.platform == "win32":
`and` binds tighter than `or`, so this parses as
`(not no_open and DISPLAY) or darwin or win32`. The two platform terms stand
alone and ignore `args.no_open`, so on macOS and Windows the browser
auto-opens even when the user passes --no-open (the documented "Don't auto-open
the browser" flag). Linux happened to honor the flag, which hid the bug.
Extract the decision into a small, testable `_should_auto_open(no_open,
platform, display)` helper that short-circuits on no_open first.
TheophilusChinomona
added a commit
to TheophilusChinomona/NotFair
that referenced
this pull request
Jun 29, 2026
…er picker, --no-open precedence Apply fixes from open upstream PRs that apply cleanly to our fork: - AbortSignal (nowork-studio#80, ErnestHysa): wire signal? parameter through pickFolder and pickFolderMac to execFile, enabling clean cancellation of osascript. Also extend to the new Linux execDialog helper. - Linux folder picker (nowork-studio#77, RohithVangalla1): implement pickFolderLinux using zenity (GTK) with kdialog (KDE) fallback, replacing the TODO stub. Linux users can now use the Browse button in the NotFair UI. - --no-open precedence (nowork-studio#92, Osamaali313): extract the auto-open guard in bin/notfair-content-calendar into a _should_auto_open helper that checks --no-open before platform. Fixes macOS/Windows ignoring the flag. Co-authored-by: Claude
TheophilusChinomona
added a commit
to TheophilusChinomona/NotFair
that referenced
this pull request
Jun 29, 2026
Three cases tested per platform: no-open suppresses; default opens on macOS/Windows/Linux-with-:0; headless Linux stays closed. Mirrors the original PR nowork-studio#92 test structure using importlib. Co-authored-by: Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The content-calendar viewer's
--no-openflag ("Don't auto-open the browser") is ignored on macOS and Windows.The auto-open guard in
bin/notfair-content-calendarcombinesand/orwithout parentheses:Since
andbinds tighter thanor, this parses as:The two platform terms stand alone and never consult
args.no_open. So on macOS and Windows — the two platforms where auto-open actually fires — the browser opens even when the user passes--no-open. (Headless Linux honored the flag, which is why it slipped through.)Demonstration with
--no-openset (correct result isFalseeverywhere):Fix
Extract the decision into a small, testable helper that short-circuits on
no_openfirst:Default-open behavior is preserved exactly: GUI platforms (macOS/Windows, or Linux with
$DISPLAY) still auto-open when--no-openis not passed; headless Linux still does not.Testing
Added
test/unit/test_content_calendar_auto_open.py(loads the bin script viaimportlib, matchingtest_broken_link_checker.py):--no-opensuppresses auto-open on darwin / win32 / linux (this is what regressed).$DISPLAY; headless Linux does not.