diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-02-09 23:18:57 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-02-09 23:42:30 +0100 |
| commit | 7d1560a326f32c592eca53a849b6a10aa8c1aae3 (patch) | |
| tree | 4e7cc3623328e50a17ee4ec5357e9b9e8cdadade /dwm.c | |
| parent | 1e86b5f1bd516aa8ec15fd27745914860bc3ec95 (diff) | |
| download | chaddwm-7d1560a326f32c592eca53a849b6a10aa8c1aae3.tar.gz chaddwm-7d1560a326f32c592eca53a849b6a10aa8c1aae3.tar.bz2 chaddwm-7d1560a326f32c592eca53a849b6a10aa8c1aae3.zip | |
add movekeyboard plugin
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 88 |
1 files changed, 88 insertions, 0 deletions
@@ -192,6 +192,8 @@ static void maprequest(XEvent *e); static void monocle(Monitor *m); static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); +static void movekeyboard_x(const Arg *arg); +static void movekeyboard_y(const Arg *arg); static Client *nexttiled(Client *c); static void pop(Client *c); static void propertynotify(XEvent *e); @@ -1226,6 +1228,92 @@ movemouse(const Arg *arg) } } +void +movekeyboard_x(const Arg *arg){ + int ocx, ocy, nx, ny; + Client *c; + Monitor *m; + + if (!(c = selmon->sel)) + return; + + if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ + return; + + restack(selmon); + + ocx = c->x; + ocy = c->y; + + nx = ocx + arg->i; + ny = ocy; + + // if (abs(selmon->wx - nx) < snap) + // nx = selmon->wx; + // else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) + // nx = selmon->wx + selmon->ww - WIDTH(c); + // + // if (abs(selmon->wy - ny) < snap) + // ny = selmon->wy; + // else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) + // ny = selmon->wy + selmon->wh - HEIGHT(c); + + if (!c->isfloating) + togglefloating(NULL); + + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) + resize(c, nx, ny, c->w, c->h, 1); + + if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + sendmon(c, m); + selmon = m; + focus(NULL); + } +} + +void +movekeyboard_y(const Arg *arg){ + int ocx, ocy, nx, ny; + Client *c; + Monitor *m; + + if (!(c = selmon->sel)) + return; + + if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ + return; + + restack(selmon); + + ocx = c->x; + ocy = c->y; + + nx = ocx; + ny = ocy + arg->i; + + // if (abs(selmon->wx - nx) < snap) + // nx = selmon->wx; + // else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) + // nx = selmon->wx + selmon->ww - WIDTH(c); + // + // if (abs(selmon->wy - ny) < snap) + // ny = selmon->wy; + // else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) + // ny = selmon->wy + selmon->wh - HEIGHT(c); + + if (!c->isfloating) + togglefloating(NULL); + + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) + resize(c, nx, ny, c->w, c->h, 1); + + if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + sendmon(c, m); + selmon = m; + focus(NULL); + } +} + Client * nexttiled(Client *c) { |
