From: Johan Malm Date: Wed, 13 Aug 2025 19:34:07 +0000 (+0100) Subject: menu: use client-send-to-menu as 'Workspace' submenu X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=6fe61f884627746cc57664d77fc5e8c3b2e6ef34;p=proto%2Flabwc.git menu: use client-send-to-menu as 'Workspace' submenu ...because that is more flexible and how it is in openbox. I have had in mind that we should do this since the original implementation, and #2994 just jogged my memory. --- diff --git a/src/menu/menu.c b/src/menu/menu.c index 136d2b44..f610c1c3 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -840,6 +840,10 @@ update_client_send_to_menu(struct server *server) struct workspace *workspace; + /* + * is true by default so + * GoToDesktop will be called as part of the action. + */ wl_list_for_each(workspace, &server->workspaces.all, link) { struct buf buf = BUF_INIT; if (workspace == server->workspaces.current) { @@ -856,6 +860,11 @@ update_client_send_to_menu(struct server *server) buf_clear(&buf); } + separator_create(menu, ""); + struct menuitem *item = item_create(menu, + _("Always on Visible Workspace"), NULL, false); + item_add_action(item, "ToggleOmnipresent"); + menu_create_scene(menu); } @@ -944,7 +953,6 @@ init_windowmenu(struct server *server) { struct menu *menu = menu_get_by_id(server, "client-menu"); struct menuitem *item; - struct action *action; /* Default menu if no menu.xml found */ if (!menu) { @@ -963,25 +971,8 @@ init_windowmenu(struct server *server) item_add_action(item, "ToggleAlwaysOnTop"); /* Workspace sub-menu */ - struct menu *workspace_menu = - menu_create(server, NULL, "workspaces", ""); - item = item_create(workspace_menu, _("Move Left"), NULL, false); - /* - * is true by default so - * GoToDesktop will be called as part of the action. - */ - action = item_add_action(item, "SendToDesktop"); - action_arg_add_str(action, "to", "left"); - item = item_create(workspace_menu, _("Move Right"), NULL, false); - action = item_add_action(item, "SendToDesktop"); - action_arg_add_str(action, "to", "right"); - separator_create(workspace_menu, ""); - item = item_create(workspace_menu, - _("Always on Visible Workspace"), NULL, false); - item_add_action(item, "ToggleOmnipresent"); - item = item_create(menu, _("Workspace"), NULL, true); - item->submenu = workspace_menu; + item->submenu = menu_get_by_id(server, "client-send-to-menu"); item = item_create(menu, _("Close"), NULL, false); item_add_action(item, "Close"); @@ -999,7 +990,7 @@ menu_init(struct server *server) /* Just create placeholder. Contents will be created when launched */ menu_create(server, NULL, "client-list-combined-menu", _("Windows")); - menu_create(server, NULL, "client-send-to-menu", _("Send to desktop")); + menu_create(server, NULL, "client-send-to-menu", _("Workspace")); parse_xml("menu.xml", server); init_rootmenu(server);