fix: honour selected desktop icons in User Menu and Button Bank launches - #167
Merged
Conversation
…hes (#155) Functions launched from the User Menu or a Button Bank passed no source lister and no arguments, so entry wildcards like {f} could not see a drive icon selected on the desktop and the command silently did nothing, while the same function worked from the icon context menu. Add a launch-time desktop selection fallback mirroring the context menu: a guard (lister_has_selection) that keeps lister selection precedence, and a collection helper (desktop_selection_argarray) that snapshots selected drives/assigns/left-out icons into an argument array. Both launch sites consult the guard and, when no lister provides a selection, launch the function externally with the snapshot and the desktop folder as source path. Covers R1-R6 of the desktop-icon-selection plan; verified by a new static test (test_desktop_selection_fallback.py) and builds for os3, os4, mos, i386-aros and x86_64-aros.
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
Fixes #155.
Functions launched from the User Menu or a Button Bank passed no source lister and no arguments, so entry wildcards like
{f}could not see a drive icon selected on the desktop and the command silently did nothing — while the same function worked from the icon context menu.This adds a launch-time desktop-selection fallback that mirrors the context menu:
lister_has_selection()— precedence guard. Returns true when any source-eligible lister already has a selection, in which case the desktop is not snapshotted (a lister's selection keeps precedence).desktop_selection_argarray()— collects the selected desktop objects into an argument array in the same form the icon context menu supplies them: drives/assigns contribute their device name (e.g.DH0:), left-out icons their name.event_loop.c, Button Bank inbuttons_run.c) consult the guard and, when no lister provides a selection, launch the function externally with the snapshot and the desktop folder as the source path.Result:
C:List {f}on a selected drive icon now lists that device's contents, as expected.Product decisions (from the brainstorm plan)
Plan:
docs/plans/2026-08-03-001-fix-desktop-icon-selection-plan.md(requirements R1–R6; the plans directory is gitignored).Testing
source/Program/tests/test_desktop_selection_fallback.py(3 tests), written red-first, now green.ppc-morphostag image is the broken 2026-07-04 rebuild, so MorphOS was built with the known-good digest pinned in CI.)function_launch.cwarning is pre-existing, in untouched code).Runtime acceptance (manual — not covered by CI)
On a built AmigaOS target:
C:List {f}from the User Menu (output to window) → a shell lists the device contents.Notes
source/Program/tests/__pycache__/is generated by pytest and is intentionally not committed; consider adding__pycache__/to.gitignoreas a follow-up.