# 170 — Per-widget context menu manager

Approved follow-up, 2026-10-03. Appearance correction: addon 2.1.12, skin 1.3.6.

- Each widget has an independent ordered action configuration: main, More and hidden.
- The manager uses the existing widget manager's Estuary layout, fonts and textures.
  Enter it from the selected widget, the section editor in appearance settings, or More.
- One configuration follows the widget into opened lists. Actions are filtered by actual
  item kind, account, ownership and availability; playlist defaults also suit child songs.
- More always ends with Edit widgets and Edit context menu. These management links cannot be hidden.
- Editing from a section saves into its existing draft; only the outer Save persists it.
  Cancel preserves the original. The direct More editor saves only the originating widget.
- Stable widget identity and configuration follow widget movement. Legacy widgets acquire
  identity on their next save; old settings remain usable.
- Main and More use Kodi's original `Dialog.contextmenu` with only our configured actions.
  The widget manager style applies to the editor only. Back from More returns to the main
  popup. The recursion guard stays active through both native menus; other addons keep theirs.
- Vinyl: open/play/queue/shuffle/play-from, favorites by media kind, album/artist navigation,
  create own playlist, add song, rename/delete owned playlist, remove/reorder owned playlist songs.
  Ownership is checked again on the server before edits. Deleting a playlist never deletes songs.
  All requests use the existing authenticated hosting proxy client; tokens are never in item URLs.
- MyTV/MyCinema: live/open/random and applicable channel modes, direct edit/rename/move/delete.
  Opened channel dialogs inherit the menu configuration. Channel playback stays in channel history;
  global library watched-state actions are excluded for channel content.
- Home main-menu C/menu and long Enter/OK invoke the same section widget manager as Info.
  Widget C opens the item's menu. Short Enter remains Select. The installer refreshes our Home keymap.

Implementation: `wcs/skin/context.py`, `context_dialogs.py`, `channel_actions.py`, existing
slots/listing/widget/installer paths, `wcs/vinyl/context.py`, item metadata and the menu editor XML.
Localization: addon 32600–32634, cs/sk/en. No new textures or fonts.

Verification: 83 targeted offline tests; changed Python compilation and XML parsing.
Real Kodi checks cover Home C/long Enter, per-section routing, both menu levels and Back,
draft versus saved widget configuration, and context inheritance in playlist tracks.
Film and channel popups also pass live checks. MyCinema honors a non-first selected cinema;
direct edit opens its matching grid (verified with two disposable empty cinemas).
The live probe `scripts/library_harness/context_probe.py` verifies actual proxy writes
on a disposable own playlist (create, rename, add, reorder both ways, remove, favorite both
ways, delete) and disposable MyTV/MyCinema channels (rename, move, delete). It removes its
temporary data and verifies existing channel order is preserved. It never outputs credentials.
Live frame artifacts are in `scripts/dialog_harness/out/live/`.
Appearance correction checks: native window 10106 for main and More, Back returns to main,
More opens the unchanged editor, and cancellation preserves the saved widget configuration.
Native geometry/fonts/textures/animations exactly match the installed original Estuary XML;
only addon dispatch/visibility guards differ. Frames: `context-native-main.png`, `context-native-more.png`.

These checks cover the implemented paths; they do not certify every remote library item,
every remote-control driver, or indefinite hosting availability. No commit. Distribution follows `/deploy`.


## Shared menus — 2.1.41 / skin 1.3.29

Search, ordinary addon browsing, details, legacy content dialogs, channel programmes
and source/download dialogs use the same item context menu manager. The 19 item
profiles live in `wcs/skin/context_profiles.py`; saved user choices live in the
addon setting `context_menu_profiles`. Shipped profiles are part of
`resources/defaults/skin.json`, and `scripts/snapshot_defaults.py` retains them.

On first use, an applicable configured widget menu seeds the shared profile;
otherwise the shipped profile is used. The editor's Restore Defaults uses the
shipped profile. Later widget edits do not silently change a saved shared menu.
Compatible widget navigation retains the original widget override and hidden
actions. An incompatible item uses its own shared profile. More always exposes
the manager with the scope named in its label. Existing widget and addon defaults
reset markers remain at V6 / 2.1.40; this release adds profiles without resetting
users' existing layouts or unrelated settings.

Legacy menu builders only describe item metadata and provider-specific actions;
a single resolver handles the menu order, availability and execution. Channel
playback retains channel history and excludes global watched-state actions.

Verification for this extension: 35 targeted offline checks in
`scripts/skin_harness/test_shared_context.py`, runtime packaging preflight,
manifest/dependency versions, shipped profiles and repository checksum checks.
No Kodi GUI or device tests were run for this extension.


### Direct dispatch from native context requests (2026-10-07)

`DialogContextMenu.xml` hides generated Kodi actions until `skin_context_native`
resolves the original window selection. The dispatcher closes the intermediate
dialog, reads that window's focused container and opens the shared Milionář menu
directly. The active-menu guard keeps our own native popup from being intercepted;
a separate native fallback flag retains unrelated items' original menus and is
cleared when they close. Home key dispatch uses the same focused-item reader.
The “Milionář actions…” wrapper is suppressed in skin.milionar; legacy descriptor
transport and fallback in other skins remain available. Cached untagged plugin
items use the existing descriptor builder instead of a second menu implementation.

Verified with 46 targeted offline checks, including search/browsing/Home dispatch,
modal versus parent focus, cached items, the recursion guard, XML visibility and
foreign-item fallback. No GUI/device checks were run.


### Native context-menu positioning (2026-10-07)

Removed the inherited Home-only `0,175` slide from `DialogContextMenu.xml`.
Both the main and More popups use Kodi's existing focus-based positioning and
screen-edge clamping, without a later skin translation that bypasses those bounds.
The native bounded, scrollable list remains unchanged. Targeted XML checks passed;
no GUI/device checks were run.
