Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
feat(menu): Minimize and Close Window in the desktop menu
Grouped with Window Mode: all three act on the focused window the
compositor passes as -i, and are omitted when there is none. Both verbs
refocus that window first, since the background right-click dropped focus.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
scripts/cce-desktop-menu | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/scripts/cce-desktop-menu b/scripts/cce-desktop-menu
index a362957..f850bf9 100755
--- a/scripts/cce-desktop-menu
+++ b/scripts/cce-desktop-menu
@@ -5,9 +5,9 @@
# compositor (cursor.rs, the background right-click) passes the FOCUSED
# window as `-i <id> -a <app_id>` when there is one whose mode can be set:
# it drops focus right after the spawn so the popup can take the keyboard,
-# so the script cannot ask for it. With a window named, the menu gains a
-# "Window Mode" page — the same page cce-app-menu shows — whose picks go
-# through `ccectl set-mode <mode> <id>`.
+# so the script cannot ask for it. With a window named, the menu gains the
+# window verbs cce-app-menu has: a "Window Mode" page whose picks go through
+# `ccectl set-mode <mode> <id>`, plus Minimize and Close Window.
CCE_CTL="$HOME/.local/bin/ccectl"
CLEAR_CLOUD="$HOME/.local/bin/cce-cloud"
@@ -95,7 +95,10 @@ main = [
]
pages = [{"title": "Desktop Context Menu", "justify": "left", "widgets": main}]
if current:
+ # The focused-window verbs, together, the same three cce-app-menu has.
main.append({"type": "button", "text": "Window Mode >", "id": "mode_page", "target_page": 1})
+ main.append({"type": "button", "text": "Minimize", "id": "minimize"})
+ main.append({"type": "button", "text": "Close Window", "id": "close"})
pages.append({"title": app_id, "justify": "left", "widgets": [
mode("Floating", "floating"),
mode("Tiled", "tiled"),
@@ -163,6 +166,14 @@ case "$btn" in
$CCE_CTL focus-window "$window_index"
fi
;;
+ "minimize"|"close")
+ # Both act on the focused window, and focus was dropped: refocus
+ # the named window first.
+ if [[ -n "$window_index" ]]; then
+ $CCE_CTL focus-window "$window_index"
+ $CCE_CTL "$btn"
+ fi
+ ;;
"reload")
$CCE_CTL reload
;;