config: add <core><gap>

Specify the distance in pixels between views and output edges when using
movement actions such as MoveToEdge
This commit is contained in:
Johan Malm 2021-08-22 14:32:19 +01:00
parent 5cf4539827
commit a6eb29ad33
5 changed files with 12 additions and 6 deletions

View file

@ -24,6 +24,10 @@ Configuration must be wrapped in a <labwc_config> root-node.
that it is not always possible to turn off client side decorations. that it is not always possible to turn off client side decorations.
Default is server. Default is server.
*<core><gap>*
The gap in pixels between views and output edges when using movement
actions, for example MoveToEdge. Default is 0.
# FOCUS # FOCUS
*<focus><followMouse>* [yes|no] *<focus><followMouse>* [yes|no]

View file

@ -2,7 +2,7 @@
<labwc_config> <labwc_config>
<core> <core>
<decoration>server</decoration> <gap>10</gap>
</core> </core>
<theme> <theme>

View file

@ -9,6 +9,7 @@
struct rcxml { struct rcxml {
bool xdg_shell_server_side_deco; bool xdg_shell_server_side_deco;
int gap;
bool focus_follow_mouse; bool focus_follow_mouse;
bool raise_on_focus; bool raise_on_focus;
char *theme_name; char *theme_name;

View file

@ -167,6 +167,8 @@ entry(xmlNode *node, char *nodename, char *content)
} else { } else {
rc.xdg_shell_server_side_deco = true; rc.xdg_shell_server_side_deco = true;
} }
} else if (!strcmp(nodename, "gap.core")) {
rc.gap = atoi(content);
} else if (!strcmp(nodename, "name.theme")) { } else if (!strcmp(nodename, "name.theme")) {
rc.theme_name = strdup(content); rc.theme_name = strdup(content);
} else if (!strcmp(nodename, "cornerradius.theme")) { } else if (!strcmp(nodename, "cornerradius.theme")) {

View file

@ -135,7 +135,6 @@ view_border(struct view *view)
return border; return border;
} }
#define GAP (3)
void void
view_move_to_edge(struct view *view, const char *direction) view_move_to_edge(struct view *view, const char *direction)
{ {
@ -149,17 +148,17 @@ view_move_to_edge(struct view *view, const char *direction)
int x = 0, y = 0; int x = 0, y = 0;
if (!strcasecmp(direction, "left")) { if (!strcasecmp(direction, "left")) {
x = usable.x + border.left + GAP; x = usable.x + border.left + rc.gap;
y = view->y; y = view->y;
} else if (!strcasecmp(direction, "up")) { } else if (!strcasecmp(direction, "up")) {
x = view->x; x = view->x;
y = usable.y + border.top + GAP; y = usable.y + border.top + rc.gap;
} else if (!strcasecmp(direction, "right")) { } else if (!strcasecmp(direction, "right")) {
x = usable.x + usable.width - view->w - border.right - GAP; x = usable.x + usable.width - view->w - border.right - rc.gap;
y = view->y; y = view->y;
} else if (!strcasecmp(direction, "down")) { } else if (!strcasecmp(direction, "down")) {
x = view->x; x = view->x;
y = usable.y + usable.height - view->h - border.bottom - GAP; y = usable.y + usable.height - view->h - border.bottom - rc.gap;
} }
view_move(view, x, y); view_move(view, x, y);
} }