Shows all workspaces that current view can be sent to.
Works best when added to Client menu.
<menu id="client-send-to-menu" label="Send to..." />
Menu uses ">" and "<" to highlight the current workspace
Show a menu.
*menu* The name of the menu to show. The menus "root-menu",
- "client-menu", and "client-list-combined-menu" are guaranteed to exist,
- but others may be defined explicitly. See labwc-menu(5) for more
- information.
+ "client-menu", "client-send-to-menu" and "client-list-combined-menu"
+ are guaranteed to exist, but others may be defined explicitly.
+ See labwc-menu(5) for more information.
*atCursor* [yes|no] When opening a menu, open the menu at the location
of the mouse cursor. When set to no, the menu will appear at the
- "root-menu" for the root window context menu
- "client-menu" for a window's titlebar context menu
- "client-list-combined-menu" for a list of all windows across
- all workspaces
+ all workspaces. Will change focus to the app that gets
+ selected or go to workspace without activating any app if
+ "Go there" is selected.
+ - "client-send-to-menu" shows all workspaces and sends current
+ view to that workspace when selected.
*menu.id* (when nested under other *<menu>* element)
Link to a submenu defined elsewhere (by a *<menu id="">* at toplevel)
<action name="ToggleOmnipresent" />
</item>
</menu>
+ <!--
+ openbox default workspace selector
+ to use replace above workspace menu with the example below
+ the label is required, but you can change the text.
+
+ <menu id="client-send-to-menu" label="Send to..." />
+ -->
<item label="Close">
<action name="Close" />
</item>
void menu_reconfigure(struct server *server);
void update_client_list_combined_menu(struct server *server);
+void update_client_send_to_menu(struct server *server);
#endif /* LABWC_MENU_H */
/* The client menu needs an active client */
bool is_client_menu = !strcasecmp(menu_name, "client-menu");
- if (!view && is_client_menu) {
- return;
+ if (is_client_menu) {
+ if (!view) {
+ return;
+ }
+ update_client_send_to_menu(menu->server);
}
-
/* Place menu in the view corner if desired (and menu is not root-menu) */
if (!at_cursor && view) {
/* push the client menu underneath the window menu button */
}
}
+static void
+init_client_send_to_menu(struct server *server)
+{
+ /* Just create placeholder. Contents will be created when launched */
+ menu_create(server, "client-send-to-menu", "");
+}
+
+/*
+ * This is client-send-to-menu
+ * an internal menu similar to root-menu and client-menu
+ *
+ * This will look at workspaces and produce a menu
+ * with the workspace names that can be used with
+ * SendToDesktop, left/right options are included.
+ */
+void
+update_client_send_to_menu(struct server *server)
+{
+ struct menu *menu = menu_get_by_id(server,
+ "client-send-to-menu");
+
+ if (menu) {
+ struct menuitem *item, *next;
+ wl_list_for_each_safe(item, next, &menu->menuitems, link) {
+ item_destroy(item);
+ }
+ }
+
+ menu->size.height = 0;
+
+ struct workspace *workspace;
+
+ wl_list_for_each(workspace, &server->workspaces, link) {
+ if (workspace == server->workspace_current) {
+ current_item = item_create(menu, strdup_printf(">%s<", workspace->name),
+ /*show arrow*/ false);
+ } else {
+ current_item = item_create(menu, workspace->name, /*show arrow*/ false);
+ }
+ fill_item("name.action", "SendToDesktop");
+ fill_item("to.action", workspace->name);
+ }
+
+ menu_update_width(menu);
+}
+
static void
init_client_list_combined_menu(struct server *server)
{
init_rootmenu(server);
init_windowmenu(server);
init_client_list_combined_menu(server);
+ init_client_send_to_menu(server);
post_processing(server);
validate(server);
}