Skip to content

fix: honour selected desktop icons in User Menu and Button Bank launches - #167

Merged
midwan merged 2 commits into
masterfrom
issue-155-desktop-icon-selection
Aug 3, 2026
Merged

fix: honour selected desktop icons in User Menu and Button Bank launches#167
midwan merged 2 commits into
masterfrom
issue-155-desktop-icon-selection

Conversation

@midwan

@midwan midwan commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

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.
  • Both launch sites (User Menu in event_loop.c, Button Bank in buttons_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)

  • Behavioural target: match the icon context menu.
  • Launch scope: User Menu + Button Bank only (hotkey/ARexx launches are deferred).
  • Precedence: desktop is a fallback; a lister's selection wins when present.
  • Mechanism: launch-time snapshot (not an engine-level source-resolution change).

Plan: docs/plans/2026-08-03-001-fix-desktop-icon-selection-plan.md (requirements R1–R6; the plans directory is gitignored).

Testing

  • New static test source/Program/tests/test_desktop_selection_fallback.py (3 tests), written red-first, now green.
  • Full static suite: 113 passed, no regressions.
  • Builds verified for os3, os4, mos, i386-aros, x86_64-aros. (The local ppc-morphos tag image is the broken 2026-07-04 rebuild, so MorphOS was built with the known-good digest pinned in CI.)
  • No new compiler warnings introduced (the remaining function_launch.c warning is pre-existing, in untouched code).

Runtime acceptance (manual — not covered by CI)

On a built AmigaOS target:

  • Select a drive icon on the desktop, run C:List {f} from the User Menu (output to window) → a shell lists the device contents.
  • With files selected in a lister, run the same from a button → the lister selection is used, not the drive.
  • Lister open but nothing selected → falls back to the drive icon.
  • The drive icon remains selected after the function runs.
  • A selected left-out icon is honoured too.

Notes

  • source/Program/tests/__pycache__/ is generated by pytest and is intentionally not committed; consider adding __pycache__/ to .gitignore as a follow-up.

midwan added 2 commits August 3, 2026 21:21
…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.
@midwan midwan self-assigned this Aug 3, 2026
@midwan
midwan merged commit 0f94a80 into master Aug 3, 2026
16 checks passed
@midwan
midwan deleted the issue-155-desktop-icon-selection branch August 3, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selected desktop drive icons not recognized by User Menu or Buttons

1 participant