mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
action: add "ShowMenu" option
Parse the following in rc.xml:
<keyboard>
<keybind key="">
<action name="ShowMenu">
<menu>root-menu</menu>
</action>
</keybind>
</keyboard>
This commit is contained in:
parent
a26fd5a75b
commit
543f00131c
4 changed files with 28 additions and 9 deletions
24
src/action.c
24
src/action.c
|
|
@ -3,23 +3,39 @@
|
|||
#include "common/log.h"
|
||||
#include "common/spawn.h"
|
||||
#include "labwc.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
static void
|
||||
show_menu(struct server *server, const char *menu)
|
||||
{
|
||||
if (!menu) {
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp(menu, "root-menu")) {
|
||||
server->input_mode = LAB_INPUT_STATE_MENU;
|
||||
menu_move(server->rootmenu, server->seat.cursor->x,
|
||||
server->seat.cursor->y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
action(struct server *server, const char *action, const char *command)
|
||||
{
|
||||
if (!action)
|
||||
return;
|
||||
if (!strcasecmp(action, "Exit")) {
|
||||
wl_display_terminate(server->wl_display);
|
||||
if (!strcasecmp(action, "Debug")) {
|
||||
/* nothing */
|
||||
} else if (!strcasecmp(action, "Execute")) {
|
||||
spawn_async_no_shell(command);
|
||||
} else if (!strcasecmp(action, "Exit")) {
|
||||
wl_display_terminate(server->wl_display);
|
||||
} else if (!strcasecmp(action, "NextWindow")) {
|
||||
server->cycle_view =
|
||||
desktop_cycle_view(server, server->cycle_view);
|
||||
} else if (!strcasecmp(action, "Reconfigure")) {
|
||||
spawn_async_no_shell("killall -SIGHUP labwc");
|
||||
} else if (!strcasecmp(action, "Debug")) {
|
||||
dbg_show_views(server);
|
||||
} else if (!strcasecmp(action, "ShowMenu")) {
|
||||
show_menu(server, command);
|
||||
} else {
|
||||
warn("action (%s) not supported", action);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue