mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
workspaces: Add workspace actions
This commit is contained in:
parent
8c5157a098
commit
c93d625938
4 changed files with 39 additions and 0 deletions
|
|
@ -66,6 +66,14 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
*<action name="ToggleAlwaysOnTop">*
|
*<action name="ToggleAlwaysOnTop">*
|
||||||
Toggle always-on-top of focused window.
|
Toggle always-on-top of focused window.
|
||||||
|
|
||||||
|
*<action name="GoToDesktop"><to>*
|
||||||
|
Switch to workspace. Supported values are "left", "right" or the full
|
||||||
|
name of a workspace or its index (starting at 1) as configured in rc.xml.
|
||||||
|
|
||||||
|
*<action name="SendToDesktop"><to>*
|
||||||
|
Send active window to workspace.
|
||||||
|
Supported values are the same as for GoToDesktop.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
labwc(1), labwc-config(5), labwc-theme(5)
|
labwc(1), labwc-config(5), labwc-theme(5)
|
||||||
|
|
|
||||||
23
src/action.c
23
src/action.c
|
|
@ -9,6 +9,7 @@
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
#include "workspaces.h"
|
||||||
|
|
||||||
enum action_type {
|
enum action_type {
|
||||||
ACTION_TYPE_NONE = 0,
|
ACTION_TYPE_NONE = 0,
|
||||||
|
|
@ -31,6 +32,8 @@ enum action_type {
|
||||||
ACTION_TYPE_MOVE,
|
ACTION_TYPE_MOVE,
|
||||||
ACTION_TYPE_RAISE,
|
ACTION_TYPE_RAISE,
|
||||||
ACTION_TYPE_RESIZE,
|
ACTION_TYPE_RESIZE,
|
||||||
|
ACTION_TYPE_GO_TO_DESKTOP,
|
||||||
|
ACTION_TYPE_SEND_TO_DESKTOP,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *action_names[] = {
|
const char *action_names[] = {
|
||||||
|
|
@ -54,6 +57,8 @@ const char *action_names[] = {
|
||||||
"Move",
|
"Move",
|
||||||
"Raise",
|
"Raise",
|
||||||
"Resize",
|
"Resize",
|
||||||
|
"GoToDesktop",
|
||||||
|
"SendToDesktop",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -255,6 +260,24 @@ actions_run(struct view *activator, struct server *server,
|
||||||
resize_edges);
|
resize_edges);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACTION_TYPE_GO_TO_DESKTOP:
|
||||||
|
{
|
||||||
|
struct workspace *target;
|
||||||
|
target = workspaces_find(server->workspace_current, action->arg);
|
||||||
|
if (target) {
|
||||||
|
workspaces_switch_to(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACTION_TYPE_SEND_TO_DESKTOP:
|
||||||
|
if (view) {
|
||||||
|
struct workspace *target;
|
||||||
|
target = workspaces_find(view->workspace, action->arg);
|
||||||
|
if (target) {
|
||||||
|
workspaces_send_to(view, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ACTION_TYPE_NONE:
|
case ACTION_TYPE_NONE:
|
||||||
wlr_log(WLR_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Not executing unknown action with arg %s",
|
"Not executing unknown action with arg %s",
|
||||||
|
|
|
||||||
|
|
@ -75,10 +75,16 @@ fill_keybind(char *nodename, char *content)
|
||||||
wlr_log(WLR_ERROR, "Action argument already set: %s",
|
wlr_log(WLR_ERROR, "Action argument already set: %s",
|
||||||
current_keybind_action->arg);
|
current_keybind_action->arg);
|
||||||
} else if (!strcmp(nodename, "command.action")) {
|
} else if (!strcmp(nodename, "command.action")) {
|
||||||
|
/* Execute */
|
||||||
current_keybind_action->arg = strdup(content);
|
current_keybind_action->arg = strdup(content);
|
||||||
} else if (!strcmp(nodename, "direction.action")) {
|
} else if (!strcmp(nodename, "direction.action")) {
|
||||||
|
/* MoveToEdge, SnapToEdge */
|
||||||
current_keybind_action->arg = strdup(content);
|
current_keybind_action->arg = strdup(content);
|
||||||
} else if (!strcmp(nodename, "menu.action")) {
|
} else if (!strcmp(nodename, "menu.action")) {
|
||||||
|
/* ShowMenu */
|
||||||
|
current_keybind_action->arg = strdup(content);
|
||||||
|
} else if (!strcmp(nodename, "to.action")) {
|
||||||
|
/* GoToDesktop, SendToDesktop */
|
||||||
current_keybind_action->arg = strdup(content);
|
current_keybind_action->arg = strdup(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,8 @@ fill_item(char *nodename, char *content)
|
||||||
* compatibility with old openbox-menu generators
|
* compatibility with old openbox-menu generators
|
||||||
*/
|
*/
|
||||||
current_item_action->arg = strdup(content);
|
current_item_action->arg = strdup(content);
|
||||||
|
} else if (!strcmp(nodename, "to.action")) {
|
||||||
|
current_item_action->arg = strdup(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue