<keybind key="A-F3"><action name="Execute"><command>bemenu-run</command></action></keybind>
<keybind key="A-F4"><action name="Close" /></keybind>
<keybind key="W-a"><action name="ToggleMaximize" /></keybind>
+
+ <keybind key="A-Left"><action name="MoveToEdge"><direction>left</direction></action></keybind>
+ <keybind key="A-Right"><action name="MoveToEdge"><direction>right</direction></action></keybind>
+ <keybind key="A-Up"><action name="MoveToEdge"><direction>up</direction></action></keybind>
+ <keybind key="A-Down"><action name="MoveToEdge"><direction>down</direction></action></keybind>
</keyboard>
</labwc_config>
free(cmd.buf);
} else if (!strcasecmp(action, "Exit")) {
wl_display_terminate(server->wl_display);
+ } else if (!strcasecmp(action, "MoveToEdge")) {
+ view_move_to_edge(topmost_mapped_view(server), command);
} else if (!strcasecmp(action, "NextWindow")) {
server->cycle_view =
desktop_cycle_view(server, server->cycle_view);
current_keybind->action = strdup(content);
} else if (!strcmp(nodename, "command.action")) {
current_keybind->command = strdup(content);
+ } else if (!strcmp(nodename, "direction.action")) {
+ current_keybind->command = strdup(content);
} else if (!strcmp(nodename, "menu.action")) {
current_keybind->command = strdup(content);
}
#include <stdio.h>
+#include <strings.h>
#include "labwc.h"
#include "ssd.h"
view->impl->for_each_popup_surface(view, iterator, data);
}
+static struct border
+view_border(struct view *view)
+{
+ struct border border = {
+ .left = view->margin.left - view->padding.left,
+ .top = view->margin.top - view->padding.top,
+ .right = view->margin.right + view->padding.right,
+ .bottom = view->margin.bottom + view->padding.bottom,
+ };
+ return border;
+}
+
+#define GAP (3)
+void
+view_move_to_edge(struct view *view, char *direction)
+{
+ if (!view) {
+ wlr_log(WLR_ERROR, "no view");
+ return;
+ }
+ struct output *output = view_output(view);
+ struct border border = view_border(view);
+ struct wlr_box usable;
+ memcpy(&usable, &output->usable_area, sizeof(struct wlr_box));
+
+ double ox = 0, oy = 0;
+ wlr_output_layout_output_coords(view->server->output_layout,
+ output->wlr_output, &ox, &oy);
+ usable.x -= ox;
+ usable.y -= oy;
+
+ int x, y;
+ if (!strcasecmp(direction, "left")) {
+ x = usable.x + border.left + GAP;
+ y = view->y;
+ } else if (!strcasecmp(direction, "up")) {
+ x = view->x;
+ y = usable.y + border.top + GAP;
+ } else if (!strcasecmp(direction, "right")) {
+ x = usable.x + usable.width - view->w - border.right - GAP;
+ y = view->y;
+ } else if (!strcasecmp(direction, "down")) {
+ x = view->x;
+ y = usable.y + usable.height - view->h - border.bottom - GAP;
+ }
+ view_move(view, x, y);
+}