mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
action: add ToggleAlwaysOnBottom
This commit is contained in:
parent
78aec7945c
commit
15cd093f2e
7 changed files with 45 additions and 4 deletions
|
|
@ -80,6 +80,13 @@ Actions are used in menus and keyboard/mouse bindings.
|
|||
*<action name="ToggleAlwaysOnTop">*
|
||||
Toggle always-on-top of focused window.
|
||||
|
||||
*<action name="ToggleAlwaysOnBottom">*
|
||||
Toggle bewteen layers 'always-on-bottom' and 'normal'. When a window is
|
||||
in the 'always-on-bottom' layer, it is rendered below all other
|
||||
top-level windows. It is anticipated that this action will be useful
|
||||
when defining window-rules for desktop-management tools that do not
|
||||
support the wlr-layer-shell protocol.
|
||||
|
||||
*<action name="ToggleKeybinds">*
|
||||
Stop handling keybinds other than ToggleKeybinds itself.
|
||||
This can be used to allow A-Tab and similar keybinds to be delivered
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ struct server {
|
|||
|
||||
/* Tree for all non-layer xdg/xwayland-shell surfaces with always-on-top/below */
|
||||
struct wlr_scene_tree *view_tree_always_on_top;
|
||||
struct wlr_scene_tree *view_tree_always_on_bottom;
|
||||
#if HAVE_XWAYLAND
|
||||
/* Tree for unmanaged xsurfaces without initialized view (usually popups) */
|
||||
struct wlr_scene_tree *unmanaged_tree;
|
||||
|
|
|
|||
|
|
@ -171,8 +171,11 @@ void view_maximize(struct view *view, bool maximize,
|
|||
void view_set_fullscreen(struct view *view, bool fullscreen);
|
||||
void view_toggle_maximize(struct view *view);
|
||||
void view_toggle_decorations(struct view *view);
|
||||
void view_toggle_always_on_top(struct view *view);
|
||||
|
||||
bool view_is_always_on_top(struct view *view);
|
||||
void view_toggle_always_on_top(struct view *view);
|
||||
void view_toggle_always_on_bottom(struct view *view);
|
||||
|
||||
bool view_is_tiled(struct view *view);
|
||||
bool view_is_floating(struct view *view);
|
||||
void view_move_to_workspace(struct view *view, struct workspace *workspace);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ enum action_type {
|
|||
ACTION_TYPE_TOGGLE_FULLSCREEN,
|
||||
ACTION_TYPE_TOGGLE_DECORATIONS,
|
||||
ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP,
|
||||
ACTION_TYPE_TOGGLE_ALWAYS_ON_BOTTOM,
|
||||
ACTION_TYPE_FOCUS,
|
||||
ACTION_TYPE_ICONIFY,
|
||||
ACTION_TYPE_MOVE,
|
||||
|
|
@ -93,6 +94,7 @@ const char *action_names[] = {
|
|||
"ToggleFullscreen",
|
||||
"ToggleDecorations",
|
||||
"ToggleAlwaysOnTop",
|
||||
"ToggleAlwaysOnBottom",
|
||||
"Focus",
|
||||
"Iconify",
|
||||
"Move",
|
||||
|
|
@ -519,6 +521,11 @@ actions_run(struct view *activator, struct server *server,
|
|||
view_toggle_always_on_top(view);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_TOGGLE_ALWAYS_ON_BOTTOM:
|
||||
if (view) {
|
||||
view_toggle_always_on_bottom(view);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_FOCUS:
|
||||
if (view) {
|
||||
desktop_focus_and_activate_view(&server->seat, view);
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ server_init(struct server *server)
|
|||
* | layer-shell | background-layer | Yes | swaybg
|
||||
*/
|
||||
|
||||
server->view_tree_always_on_bottom = wlr_scene_tree_create(&server->scene->tree);
|
||||
server->view_tree = wlr_scene_tree_create(&server->scene->tree);
|
||||
server->view_tree_always_on_top = wlr_scene_tree_create(&server->scene->tree);
|
||||
server->xdg_popup_tree = wlr_scene_tree_create(&server->scene->tree);
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ view_impl_move_to_back(struct view *view)
|
|||
void
|
||||
view_impl_map(struct view *view)
|
||||
{
|
||||
if (!view->been_mapped) {
|
||||
window_rules_apply(view, LAB_WINDOW_RULE_EVENT_ON_FIRST_MAP);
|
||||
}
|
||||
desktop_focus_and_activate_view(&view->server->seat, view);
|
||||
view_move_to_front(view);
|
||||
view_update_title(view);
|
||||
view_update_app_id(view);
|
||||
if (!view->been_mapped) {
|
||||
window_rules_apply(view, LAB_WINDOW_RULE_EVENT_ON_FIRST_MAP);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
22
src/view.c
22
src/view.c
|
|
@ -627,6 +627,28 @@ view_toggle_always_on_top(struct view *view)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
view_is_always_on_bottom(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
return view->scene_tree->node.parent ==
|
||||
view->server->view_tree_always_on_bottom;
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_always_on_bottom(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
if (view_is_always_on_bottom(view)) {
|
||||
view->workspace = view->server->workspace_current;
|
||||
wlr_scene_node_reparent(&view->scene_tree->node,
|
||||
view->workspace->tree);
|
||||
} else {
|
||||
wlr_scene_node_reparent(&view->scene_tree->node,
|
||||
view->server->view_tree_always_on_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_move_to_workspace(struct view *view, struct workspace *workspace)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue