feat: add composable window snapping

This commit is contained in:
2025-12-28 11:21:03 +01:00
parent 395583aea9
commit beda6ec573
17 changed files with 210 additions and 64 deletions
+21
View File
@@ -62,6 +62,26 @@ typedef enum {
CLIENT_MAXIMIZED = (1 << 5)
} ClientFlags;
typedef enum {
SNAP_H_NONE = 0,
SNAP_H_LEFT,
SNAP_H_RIGHT,
SNAP_H_FULL
} SnapHorizontal;
typedef enum {
SNAP_V_NONE = 0,
SNAP_V_TOP,
SNAP_V_BOTTOM,
SNAP_V_FULL
} SnapVertical;
typedef struct {
SnapHorizontal horizontal;
SnapVertical vertical;
long timestamp;
} SnapConstraint;
typedef struct Client Client;
typedef struct Workspace Workspace;
typedef struct Monitor Monitor;
@@ -80,6 +100,7 @@ struct Client {
unsigned int workspace;
char title[256];
char class[64];
SnapConstraint snap;
Client *next;
Client *prev;
Client *mru_next;
+2
View File
@@ -83,6 +83,8 @@ void key_show_shortcuts(void);
void key_start_tutorial(void);
void key_snap_left(void);
void key_snap_right(void);
void key_snap_up(void);
void key_snap_down(void);
void key_start_demo(void);
void tutorial_start(void);
+3
View File
@@ -17,6 +17,9 @@ void layout_arrange_monocle(int workspace);
int layout_get_usable_area(int *x, int *y, int *width, int *height);
int layout_count_tiled_clients(int workspace);
void layout_apply_snap_constraint(Client *c, int area_x, int area_y,
int area_w, int area_h, int gap);
const char *layout_get_name(LayoutType layout);
const char *layout_get_symbol(LayoutType layout);