Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grid movement and resizing functions #64

Merged
merged 8 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ static struct Command c[] = {
{ "window_monocle" , IPCWindowMonocle , 0 , NULL } ,
{ "window_close" , IPCWindowClose , 0 , NULL } ,
{ "window_put_in_grid" , IPCWindowPutInGrid , 6 , fn_hack } ,
{ "window_move_in_grid" , IPCWindowMoveInGrid , 2 , fn_offset } ,
{ "window_resize_in_grid" , IPCWindowResizeInGrid , 2 , fn_offset } ,
{ "window_snap" , IPCWindowSnap , 1 , fn_position } ,
{ "window_cycle" , IPCWindowCycle , 0 , NULL } ,
{ "window_rev_cycle" , IPCWindowRevCycle , 0 , NULL } ,
Expand Down
2 changes: 2 additions & 0 deletions ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ enum IPCCommand {
IPCWindowMonocle,
IPCWindowClose,
IPCWindowPutInGrid,
IPCWindowMoveInGrid,
IPCWindowResizeInGrid,
IPCWindowSnap,
IPCWindowCycle,
IPCWindowRevCycle,
Expand Down
8 changes: 8 additions & 0 deletions man/waitron.1
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ Closes the focused window\.
Moves and resizes the focused windows accordingly to fit in a cell defined by the \fIcell_x\fR and \fIcell_y\fR coordinates, measuring \fIcell_width\fR in width and \fIcell_height\fR in height, in a virtual grid with width \fIgrid_width\fR and height \fIgrid_height\fR on the current monitor\. \fIcell_width\fR and \fIcell_height\fR are expressed in grid cells\. Gaps around the windows in the grid can be added along with monitor gaps\.
.
.TP
\fBwindow_move_in_grid\fR \fIx\fR \fIy\fR
Move a gridded window by \fIx\fR and \fIy\fR grid spaces.
.
.TP
\fBwindow_resize_in_grid\fR \fIx\fR \fIy\fR
Resize a gridded window by \fIx\fR and \fIy\fR grid spaces.
.
.TP
\fBwindow_snap\fR \fIPOSITION\fR
Snap the window on the screen in a position defined by \fIPOSITION\fR\.
.
Expand Down
2 changes: 2 additions & 0 deletions man/waitron.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/waitron.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ anything on `stdout`.
<cell_width> and <cell_height> are expressed in grid cells.
Gaps around the windows in the grid can be added along with monitor gaps.

* `window_move_in_grid` <x> <y>:
Move a gridded window by <x> and <y> grid spaces.

* `window_resize_in_grid` <x> <y>:
Resize a gridded window by <x> and <y> grid spaces.

* `window_snap` <POSITION>:
Snap the window on the screen in a position defined by <POSITION>.

Expand Down
9 changes: 8 additions & 1 deletion types.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ struct window_geom {
bool set_by_user;
};

struct grid {
int16_t gx, gy;
int16_t px, py;
int16_t sx, sy;
};

struct client {
xcb_window_t window;
struct window_geom geom;
struct window_geom orig_geom;
bool maxed, hmaxed, vmaxed, monocled;
struct grid grid;
bool maxed, hmaxed, vmaxed, monocled, gridded;
struct list_item *item;
struct list_item *focus_item;
struct monitor *monitor;
Expand Down
Loading