mirror of
https://github.com/labwc/labwc.git
synced 2026-02-23 01:40:18 -05:00
cycle: add <action name="NextWindow" output="" and identifier="">
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Some checks failed
labwc.github.io / notify (push) Has been cancelled
output="all|focused|cursor" filters windows by the output they are on. identifier="all|current" filters windows by their app-id.
This commit is contained in:
parent
a5c6ff499c
commit
610d869561
6 changed files with 61 additions and 3 deletions
28
src/action.c
28
src/action.c
|
|
@ -379,6 +379,30 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
}
|
||||
goto cleanup;
|
||||
}
|
||||
if (!strcasecmp(argument, "output")) {
|
||||
if (!strcasecmp(content, "all")) {
|
||||
action_arg_add_int(action, argument, CYCLE_OUTPUT_ALL);
|
||||
} else if (!strcasecmp(content, "cursor")) {
|
||||
action_arg_add_int(action, argument, CYCLE_OUTPUT_CURSOR);
|
||||
} else if (!strcasecmp(content, "focused")) {
|
||||
action_arg_add_int(action, argument, CYCLE_OUTPUT_FOCUSED);
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||
action_names[action->type], argument, content);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
if (!strcasecmp(argument, "identifier")) {
|
||||
if (!strcasecmp(content, "all")) {
|
||||
action_arg_add_int(action, argument, CYCLE_APP_ID_ALL);
|
||||
} else if (!strcasecmp(content, "current")) {
|
||||
action_arg_add_int(action, argument, CYCLE_APP_ID_CURRENT);
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||
action_names[action->type], argument, content);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_SHOW_MENU:
|
||||
if (!strcmp(argument, "menu")) {
|
||||
|
|
@ -1146,6 +1170,10 @@ run_action(struct view *view, struct server *server, struct action *action,
|
|||
struct cycle_filter filter = {
|
||||
.workspace = action_get_int(action, "workspace",
|
||||
rc.window_switcher.workspace_filter),
|
||||
.output = action_get_int(action, "output",
|
||||
CYCLE_OUTPUT_ALL),
|
||||
.app_id = action_get_int(action, "identifier",
|
||||
CYCLE_APP_ID_ALL),
|
||||
};
|
||||
if (server->input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||
cycle_step(server, dir);
|
||||
|
|
|
|||
|
|
@ -325,8 +325,23 @@ init_cycle(struct server *server, struct cycle_filter filter)
|
|||
criteria |= LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
|
||||
}
|
||||
|
||||
uint64_t cycle_outputs =
|
||||
get_outputs_by_filter(server, filter.output);
|
||||
|
||||
const char *cycle_app_id = NULL;
|
||||
if (filter.app_id == CYCLE_APP_ID_CURRENT && server->active_view) {
|
||||
cycle_app_id = server->active_view->app_id;
|
||||
}
|
||||
|
||||
struct view *view;
|
||||
for_each_view(view, &server->views, criteria) {
|
||||
if (!(cycle_outputs & view->output->id_bit)) {
|
||||
continue;
|
||||
}
|
||||
if (cycle_app_id && strcmp(view->app_id, cycle_app_id) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rc.window_switcher.order == WINDOW_SWITCHER_ORDER_AGE) {
|
||||
insert_view_ordered_by_age(&server->cycle.views, view);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue