mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
client send to menu
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
This commit is contained in:
parent
4f11dad45b
commit
4a1375c701
6 changed files with 68 additions and 7 deletions
|
|
@ -115,9 +115,9 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
Show a menu.
|
Show a menu.
|
||||||
|
|
||||||
*menu* The name of the menu to show. The menus "root-menu",
|
*menu* The name of the menu to show. The menus "root-menu",
|
||||||
"client-menu", and "client-list-combined-menu" are guaranteed to exist,
|
"client-menu", "client-send-to-menu" and "client-list-combined-menu"
|
||||||
but others may be defined explicitly. See labwc-menu(5) for more
|
are guaranteed to exist, but others may be defined explicitly.
|
||||||
information.
|
See labwc-menu(5) for more information.
|
||||||
|
|
||||||
*atCursor* [yes|no] When opening a menu, open the menu at the location
|
*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
|
of the mouse cursor. When set to no, the menu will appear at the
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,11 @@ The menu file must be entirely enclosed within <openbox_menu> and
|
||||||
- "root-menu" for the root window context menu
|
- "root-menu" for the root window context menu
|
||||||
- "client-menu" for a window's titlebar context menu
|
- "client-menu" for a window's titlebar context menu
|
||||||
- "client-list-combined-menu" for a list of all windows across
|
- "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)
|
*menu.id* (when nested under other *<menu>* element)
|
||||||
Link to a submenu defined elsewhere (by a *<menu id="">* at toplevel)
|
Link to a submenu defined elsewhere (by a *<menu id="">* at toplevel)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,13 @@
|
||||||
<action name="ToggleOmnipresent" />
|
<action name="ToggleOmnipresent" />
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</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">
|
<item label="Close">
|
||||||
<action name="Close" />
|
<action name="Close" />
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -137,5 +137,6 @@ void menu_close_root(struct server *server);
|
||||||
void menu_reconfigure(struct server *server);
|
void menu_reconfigure(struct server *server);
|
||||||
|
|
||||||
void update_client_list_combined_menu(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 */
|
#endif /* LABWC_MENU_H */
|
||||||
|
|
|
||||||
|
|
@ -680,10 +680,12 @@ show_menu(struct server *server, struct view *view,
|
||||||
|
|
||||||
/* The client menu needs an active client */
|
/* The client menu needs an active client */
|
||||||
bool is_client_menu = !strcasecmp(menu_name, "client-menu");
|
bool is_client_menu = !strcasecmp(menu_name, "client-menu");
|
||||||
if (!view && is_client_menu) {
|
if (is_client_menu) {
|
||||||
|
if (!view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
update_client_send_to_menu(menu->server);
|
||||||
|
}
|
||||||
/* Place menu in the view corner if desired (and menu is not root-menu) */
|
/* Place menu in the view corner if desired (and menu is not root-menu) */
|
||||||
if (!at_cursor && view) {
|
if (!at_cursor && view) {
|
||||||
/* push the client menu underneath the window menu button */
|
/* push the client menu underneath the window menu button */
|
||||||
|
|
|
||||||
|
|
@ -910,6 +910,52 @@ menu_hide_submenu(struct server *server, const char *id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
init_client_list_combined_menu(struct server *server)
|
init_client_list_combined_menu(struct server *server)
|
||||||
{
|
{
|
||||||
|
|
@ -1056,6 +1102,7 @@ menu_init(struct server *server)
|
||||||
init_rootmenu(server);
|
init_rootmenu(server);
|
||||||
init_windowmenu(server);
|
init_windowmenu(server);
|
||||||
init_client_list_combined_menu(server);
|
init_client_list_combined_menu(server);
|
||||||
|
init_client_send_to_menu(server);
|
||||||
post_processing(server);
|
post_processing(server);
|
||||||
validate(server);
|
validate(server);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue