mirror of
https://github.com/labwc/labwc.git
synced 2026-02-24 01:40:15 -05:00
Implement key binds to control virtual outputs (#1287)
Add actions `VirtualOutputAdd` and `VirtualOutputRemove`
This commit is contained in:
parent
e303281333
commit
111b955b53
5 changed files with 150 additions and 1 deletions
25
src/action.c
25
src/action.c
|
|
@ -98,6 +98,8 @@ enum action_type {
|
|||
ACTION_TYPE_FOCUS_OUTPUT,
|
||||
ACTION_TYPE_IF,
|
||||
ACTION_TYPE_FOR_EACH,
|
||||
ACTION_TYPE_VIRTUAL_OUTPUT_ADD,
|
||||
ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE,
|
||||
};
|
||||
|
||||
const char *action_names[] = {
|
||||
|
|
@ -142,6 +144,8 @@ const char *action_names[] = {
|
|||
"FocusOutput",
|
||||
"If",
|
||||
"ForEach",
|
||||
"VirtualOutputAdd",
|
||||
"VirtualOutputRemove",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -363,6 +367,13 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_VIRTUAL_OUTPUT_ADD:
|
||||
case ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE:
|
||||
if (!strcmp(argument, "output_name")) {
|
||||
action_arg_add_str(action, argument, content);
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s'",
|
||||
|
|
@ -915,6 +926,20 @@ actions_run(struct view *activator, struct server *server,
|
|||
wl_array_release(&views);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_VIRTUAL_OUTPUT_ADD:
|
||||
{
|
||||
const char *output_name = action_get_str(action, "output_name",
|
||||
NULL);
|
||||
output_add_virtual(server, output_name);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE:
|
||||
{
|
||||
const char *output_name = action_get_str(action, "output_name",
|
||||
NULL);
|
||||
output_remove_virtual(server, output_name);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_INVALID:
|
||||
wlr_log(WLR_ERROR, "Not executing unknown action");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue