diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-16 11:18:31 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-16 11:18:31 +0200 |
| commit | 31a6293e982e212ea5136659dcccce271fe37be1 (patch) | |
| tree | a4e013f5a3298f5af0c7bcea001637423cdc2eac | |
| parent | b81fe900056e4c14738d4ceb4e2dfe80ae2e4bff (diff) | |
| download | quickshell-31a6293e982e212ea5136659dcccce271fe37be1.tar.gz quickshell-31a6293e982e212ea5136659dcccce271fe37be1.zip | |
feat(desktop): pages can open other pages and step back to them
Page gains go(name), wired to the drawer's show(). Module gains up, the
page back() returns to, empty for the grid as before. The back arrow now
calls back() instead of clearing the page itself, so the arrow, Escape
and the mouse's back button agree. For the git page, opened from the
user page.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| -rw-r--r-- | desktop/Drawer.qml | 16 | ||||
| -rw-r--r-- | desktop/Module.qml | 4 | ||||
| -rw-r--r-- | desktop/Page.qml | 3 |
3 files changed, 16 insertions, 7 deletions
diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml index 27b90fc..7855823 100644 --- a/desktop/Drawer.qml +++ b/desktop/Drawer.qml @@ -69,11 +69,12 @@ Scope { root.open = true; } - // One step out: history, then a page, then the drawer itself. Escape - // and the mouse's back button. + // One step out: history, then a page (to its module's `up`, the grid by + // default), then the drawer itself. Escape, the mouse's back button and + // a page's back arrow. function back() { if (root.history) root.history = false; - else if (root.page) root.page = ""; + else if (root.page) root.page = root.current?.up ?? ""; else root.close(); } @@ -238,12 +239,13 @@ Scope { active: root.current !== null sourceComponent: root.current?.page ?? null - // The Page's back arrow returns to the grid. Without this - // the header button is inert, since the page only emits - // `back` and does not know who hosts it. + // The Page's back arrow steps out as Escape does. Without + // this the header button is inert, since the page only + // emits `back` and does not know who hosts it. onLoaded: { - if (item && item.back) item.back.connect(() => root.page = ""); + if (item && item.back) item.back.connect(root.back); if (item && item.dismiss) item.dismiss.connect(root.close); + if (item && item.go) item.go.connect(root.show); } // The page header shows the module's tile glyph. A Binding, diff --git a/desktop/Module.qml b/desktop/Module.qml index 2ce2939..50b4235 100644 --- a/desktop/Module.qml +++ b/desktop/Module.qml @@ -42,6 +42,10 @@ QtObject { // some other way: the user page opens from the drawer's header row. property bool tiled: true + // The page back() returns to from this module's page. Empty is the grid. + // The git page sets "user", the page it is opened from. + property string up: "" + // Rendered inside the tile, below the icon: a short state line. Null for // a tile that says nothing beyond its label. property Component tileContent: null diff --git a/desktop/Page.qml b/desktop/Page.qml index cb717e8..8365c51 100644 --- a/desktop/Page.qml +++ b/desktop/Page.qml @@ -23,6 +23,9 @@ Item { // Closes the whole drawer, for a page whose action is finished once done // (the clipboard copies and gets out of the way). signal dismiss + // Opens another module's page by name, for a page that links to one (the + // user page opens the git page). + signal go(string name) Item { id: header |
