Repository navigation
feat: show or hide layout blocks by a field's value - #723
Conversation
A block could only hide while a field was empty. showWhen and hideWhen take a condition as a rule's when does, or a list of them, so a meeting widget can show the start time, a countdown or the time left by its phase, and a popup can show Calendar access only without access. In a list row they read the row's fields, and a widget whose blocks they all hide leaves the bar. Closes #720
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Before and after
|
…ions # Conflicts: # Sources/StableBar/PopupConfiguration.swift # docs/popups.md
## [0.18.0](v0.17.0...v0.18.0) (2026-11-20) ### Features * add a Label, value and meter display choice ([#785](#785)) by @M4n0x ([36c9f85](36c9f85)), closes [#783](#783) * add a today-only option to the calendar widget ([#735](#735)) by @Seb-GRAF ([4486b8c](4486b8c)) * add an http provider so network widgets need no commands ([#744](#744)) ([a7a080c](a7a080c)) * add each agenda event's phase, the meeting's service and today's date ([#722](#722)) by @M4n0x ([3262460](3262460)), closes [#721](#721) * adjust workspace app icon size in the theme creator ([#779](#779)) ([0941350](0941350)), closes [#778](#778) * check whether a bar runs, print its version and quit it from the command line ([#740](#740)) by @Seb-GRAF ([be2729b](be2729b)) * choose which calendars a calendar widget shows in Settings ([#741](#741)) by @Seb-GRAF ([471bde4](471bde4)) * collapse the Theme page's sections and show the theme's changes as a table by @Seb-GRAF ([fe9a2f7](fe9a2f7)) * create, join and style widget groups in Settings and the edit bar ([#784](#784)) by @M4n0x ([bd120ed](bd120ed)), closes [#648](#648) * decode a group's members, selectors by widget type, role or ID by @Seb-GRAF ([40b6bf5](40b6bf5)) * draw a one-color image in its text color with tinted by @Seb-GRAF ([db3fd16](db3fd16)) * edit the look with the same sections in Theme and the bar editor by @Seb-GRAF ([bb60757](bb60757)) * edit the theme from one Editing menu and show the gallery in sections ([8170aa9](8170aa9)) * give every group a base style in themes and Settings, and fix the color popover ([#814](#814)) by @Seb-GRAF ([51fbfea](51fbfea)) * give widget commands the path of StableBar and of their configuration ([#734](#734)) by @Seb-GRAF ([f232d25](f232d25)) * group profiles by where they come from in Settings by @Seb-GRAF ([dd3b465](dd3b465)) * hide and show the bar from the command line, its menu and profiles ([#736](#736)) by @Seb-GRAF ([16ae6df](16ae6df)) * keep edits to the look with the theme they were made on by @Seb-GRAF ([dd84343](dd84343)) * keep the Theme page's sections in one card and open each in place by @Seb-GRAF ([63b4b71](63b4b71)) * let one side of a light/dark color pair be a theme color ([f7d5c97](f7d5c97)) * let themes style sliders without replacing layouts ([#786](#786)) by @M4n0x ([4408bc9](4408bc9)), closes [#782](#782) * line up light and dark colors under one header, and edit padding in one row by @Seb-GRAF ([1c959a2](1c959a2)) * list the theme's changes with its own values, and every-theme values in an inset box by @Seb-GRAF ([4248141](4248141)) * make right-clicking menu bar items as in the menu bar opt-in and experimental ([#768](#768)) by @Jonathanm10 ([211e285](211e285)) * match profiles to a monitor, a Wi-Fi network or a call, and edit their conditions as rows ([#817](#817)) ([6398679](6398679)) * move the Animation settings from Theme to General by @Seb-GRAF ([5569734](5569734)) * offer each StableBar the newest Store version it can run ([#776](#776)) by @M4n0x ([24cb364](24cb364)), closes [stablebox/stablebar-packages#53](stablebox/stablebar-packages#53) [#775](#775) * open or close a popup from the command line instead of only toggling it ([#732](#732)) by @Seb-GRAF ([8a78e88](8a78e88)) * open the Theme page's sections as groups and keep the closed ones as rows of one card by @Seb-GRAF ([e2d8c0d](e2d8c0d)) * open the window manager's configuration from the gap warning ([#847](#847)) ([40ae48f](40ae48f)) * put a popup view's title beside its back arrow ([2db893f](2db893f)), closes [#763](#763) * put each widget without a group in the group whose members match it best by @Seb-GRAF ([2b03347](2b03347)) * right-click a menu bar item on the bar as in the macOS menu bar ([93b289b](93b289b)), closes [#760](#760) * say where an installed theme came from, and delete your themes from the gallery by @Seb-GRAF ([ec6056e](ec6056e)) * share an image of the bar over your wallpaper by @Seb-GRAF ([c1f08e3](c1f08e3)) * share your bar from a borderless panel, with StableBar's badge in the image by @M4n0x ([f8cd612](f8cd612)), closes [#858](#858) * share your bar from a floating panel, and bring it over as it was sent ([#844](#844)) ([b8ff5a0](b8ff5a0)) * share your bar's look and widgets with a bar link by @Seb-GRAF ([da7455a](da7455a)) * show a color's light and dark values side by side in Settings by @Seb-GRAF ([d7e1689](d7e1689)) * show app icon in app menu widget ([#812](#812)) ([34b5afa](34b5afa)) * show or hide layout blocks by a field's value ([#723](#723)) by @M4n0x ([b455b2f](b455b2f)), closes [#720](#720) * show the yabai space's layout and stacked windows in the workspace widget ([#745](#745)) by @Seb-GRAF ([f56b892](f56b892)) * show your themes' origins, edits and Delete on the Theme page's cards by @Seb-GRAF ([4d4b6a5](4d4b6a5)) * start a widget's Style tab with whether it follows the theme by @Seb-GRAF ([6e415a1](6e415a1)) * suggest Store packages for tools found on the Mac during setup ([#743](#743)) by @Seb-GRAF ([4fd9d36](4fd9d36)) * sync the configuration across Macs with iCloud Drive ([5a8b599](5a8b599)), closes [#700](#700) * use the shared look sections on the Theme page and name them alike in Show changes by @Seb-GRAF ([b27ae46](b27ae46)) * warn when a window manager leaves windows under the bar ([#739](#739)) by @Seb-GRAF ([52aef29](52aef29)) ### Bug Fixes * accept a package that needs a beta on that beta's own release ([#764](#764)) by @M4n0x ([c82c27b](c82c27b)), closes [#762](#762) * call Accessibility Device Control and Data Access on macOS 27 ([#738](#738)) ([3c0b637](3c0b637)) * check the folder of each bar's file too, as a save writes into it by @Seb-GRAF ([527624a](527624a)) * draw live menu bar items from the right place after a display change ([#822](#822)) by @Jonathanm10 ([0cb0f1a](0cb0f1a)), closes [#820](#820) * draw the Apple menu widget's own symbol when it has one ([#849](#849)) by @Jonathanm10 ([765d475](765d475)), closes [#828](#828) * find saved values in the main file's theme edits, and select theme edits in Profiles by @Seb-GRAF ([75a951d](75a951d)) * hide theme edits while trying a linked theme, and keep themes in use from Delete by @Seb-GRAF ([4be7ee8](4be7ee8)) * keep a theme that one kind of screen uses from Delete too by @Seb-GRAF ([32cff70](32cff70)) * keep a theme's widget edits when it's saved again, in a profile of its own by @Seb-GRAF ([79de4a9](79de4a9)) * keep search unfocused when opening settings ([d3453be](d3453be)), closes [#780](#780) * keep Skip setup from applying a placement once Automation access is allowed ([#789](#789)) by @M4n0x ([28138bb](28138bb)), closes [#788](#788) * keep the back arrow when a view that starts with its title hides itself by @M4n0x ([b29b1df](b29b1df)) * keep the bar running when a notification for a script carries a date ([#749](#749)) by @Seb-GRAF ([62b68f3](62b68f3)) * let a tiling window manager make Settings as narrow as before [#609](#609) ([#746](#746)) by @Seb-GRAF ([aea7fc6](aea7fc6)) * move Share My Bar's panel by dragging its background by @M4n0x ([b28e36a](b28e36a)), closes [#868](#868) * recognise Store widget packages from stablebox/stablebar-packages by @Seb-GRAF ([a4cc3ae](a4cc3ae)) * reject a group member selector whose keys are all null in the schema ([acb6591](acb6591)) * right-click a menu bar item on a notched display without moving the pointer ([#774](#774)) by @Jonathanm10 ([d23931c](d23931c)), closes [#771](#771) * save no bar when an All setups change can't write one of them by @Seb-GRAF ([9211fd8](9211fd8)) * settle group members again on a screen with its own layout ([3988d3a](3988d3a)) * show one card per theme, fit themed sliders to their row and keep morphing tooltips round ([#815](#815)) by @Seb-GRAF ([95a3024](95a3024)) * show Tab focus on every popup control and skip disabled menu rows ([#747](#747)) by @Seb-GRAF ([408bf5e](408bf5e)) * stop a click on a menu bar item from crashing StableBar when its anchor has left the window ([54c8854](54c8854)), closes [#596](#596) [#827](#827) ### Performance Improvements * keep a widget's width change from rebuilding every widget on the bar by @Seb-GRAF ([dd25036](dd25036)) * look widgets up in each screen look by id instead of scanning the look's widgets ([6d02ab3](6d02ab3))
|
🎉 This PR is included in version 0.18.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |




Problem
A layout block could hide only while a field was empty (
hideWhenEmpty). It couldn't follow what a field says, such as a calendar widget'sphase, so a meeting widget couldn't swap its symbol for a live dot, show the start time, a countdown or the time left by phase, or show Calendar access only without access. Closes #720.Changes
showWhenandhideWhenon any layout block: a widget'slayout,hoverLayoutandoverlay, popups and list rows.whentakes ({ "field": "phase", "equals": "live" }or{ "value": "remaining", "below": 0.2 }), or a list of them, any of which matches. The same decoder checks them, so a condition rules reject is rejected here too, and an empty list is an error.showWhenshows the block only while one condition matches;hideWhenhides it while one does.hideWhenEmptystill applies beside them.hideWhenEmpty. In a list row, conditions read the row's fields and the widget's values.PopupBlock.isHidden(fields:values:)replaces the twohideWhenEmptychecks, in the block view and in the check that hides a widget with nothing to show (A widget with no visible output yet shows an empty pill, or only a red dot when its script fails #379). A provider widget can now hide when there are no meetings and still showNo calendar access.RuleConditiongainsmatches(fields:values:)for rows, which have no output of their own.showWhenandhideWhenon blocks, through ablockConditionsdefinition overruleCondition.docs/popups.mdexplains both with a meeting widget's countdown;docs/create-a-widget.mdsays they also empty a widget.meeting-live-popup(live dot, time left, the popup's live line, no Calendar access button with access) andmeeting-soon-bar(calendar symbol and countdown).maincan't load them, as it rejects the new keys.The keys are new, so existing configurations, packages and themes don't change.
Testing
swift build --build-tests, and the whole suite withswift test --skip-build: 1177 Swift Testing and 299 XCTest tests pass.BlockConditionTestscovers one condition or a list, an empty list and conditions rules reject,showWhenneeding one match,hideWhenhiding on any, a missing value never matching,hideWhenEmptybeside them, and a script widget leaving the bar whenhideWhenhides its whole layout whileNo calendar accessstays.hiddenBlocksAddNoSpacingnow also draws a row and a column with a block hidden byshowWhenand by ahideWhenlist.listRowConditionsReadEachRowsFieldschecks a list row reads its own fields.schemaListsTheSamePropertiesAsTheDecodersandeverySceneInTheRepositoryLoadspass.--render-scenes.Open PR #707 also adds keys to
PopupBlockand editsdocs/popups.md; whichever merges second needs a small rebase there.Merging
One commit; a merge commit or squash both work.
Claude Opus 5.5 via Claude Code