Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Open
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
10 changes: 10 additions & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ static struct key keys[] = {
{MOD, XK_c, win_center, {0}},
{MOD, XK_f, win_fs, {0}},

{MOD, XK_k, win_move, {.com = (const char*[]){"move", "n"}, .i = 10}},
{MOD, XK_j, win_move, {.com = (const char*[]){"move", "s"}, .i = 10}},
{MOD, XK_l, win_move, {.com = (const char*[]){"move", "e"}, .i = 10}},
{MOD, XK_h, win_move, {.com = (const char*[]){"move", "w"}, .i = 10}},

{MOD|ShiftMask, XK_k, win_move, {.com = (const char*[]){"resize", "n"}, .i = 10}},
{MOD|ShiftMask, XK_j, win_move, {.com = (const char*[]){"resize", "s"}, .i = 10}},
{MOD|ShiftMask, XK_l, win_move, {.com = (const char*[]){"resize", "e"}, .i = 10}},
{MOD|ShiftMask, XK_h, win_move, {.com = (const char*[]){"resize", "w"}, .i = 10}},

{Mod1Mask, XK_Tab, win_next, {0}},
{Mod1Mask|ShiftMask, XK_Tab, win_prev, {0}},

Expand Down
13 changes: 13 additions & 0 deletions sowm.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ static void (*events[LASTEvent])(XEvent *e) = {

#include "config.h"

void win_move(const Arg arg) {
int r = arg.com[0][0] == 'r';
char m = arg.com[1][0];

win_size(cur->w, &wx, &wy, &ww, &wh);

XMoveResizeWindow(d, cur->w, \
wx + (r ? 0 : m == 'e' ? arg.i : m == 'w' ? -arg.i : 0),
wy + (r ? 0 : m == 'n' ? -arg.i : m == 's' ? arg.i : 0),
MAX(10, ww + (r ? m == 'e' ? arg.i : m == 'w' ? -arg.i : 0 : 0)),
MAX(10, wh + (r ? m == 'n' ? -arg.i : m == 's' ? arg.i : 0 : 0)));
}

void win_focus(client *c) {
cur = c;
XSetInputFocus(d, cur->w, RevertToParent, CurrentTime);
Expand Down
1 change: 1 addition & 0 deletions sowm.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void win_focus(client *c);
void win_kill(const Arg arg);
void win_prev(const Arg arg);
void win_next(const Arg arg);
void win_move(const Arg arg);
void win_to_ws(const Arg arg);
void ws_go(const Arg arg);

Expand Down