beeware / beeware/toga

Per-window commands

Open
#2,210 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

If you want different menus for different windows, you currently need to detect when the active window changes and alter `App.commands` manually. This most obviously affects DocumentApp, where you might want to enable or disable commands depending on what the user has selected.

But it may also affect other multi-window apps which don't involve "documents" per se. For example:
* In Chrome, the Tab menu contains a list of tabs for the current window only.
* An app to control a robot might provide separate windows for different components of the robot, with content showing information about the component, and different menus for different component types.

### Describe the solution you'd like

Add a `Window.commands` property, which would work as follows:

* On macOS, the app menu would be a union of the commands from the App and the currently-active Window.
* On GTK and WinForms, each window’s menu would be a union of the commands from the App and that window.

Since each window has its own toolbar, this implies that toolbar commands should be automatically added to `Window.commands`, rather than `App.commands` at present.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing App.commands and toolbar command behavior, then compare the Window APIs across macOS, GTK, and WinForms. Done means Window.commands supports per-window menus, with the specified App union behavior on macOS and GTK/WinForms, and toolbar commands belong to the appropriate window.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.