saner key defaults

This commit is contained in:
seanpringle
2012-09-04 15:19:14 +10:00
parent 98ebf12d1f
commit a555736e44
5 changed files with 79 additions and 72 deletions

View File

@@ -48,14 +48,16 @@
binding keys[] = { binding keys[] = {
// Focus the top-most window in a spot. // Focus the top-most window in a spot.
{ .mod = Mod4Mask, .key = XK_1, .act = ACTION_FOCUS, .num = SPOT1 }, { .mod = Mod4Mask, .key = XK_Left, .act = ACTION_FOCUS, .num = SPOT1 },
{ .mod = Mod4Mask, .key = XK_2, .act = ACTION_FOCUS, .num = SPOT2 }, { .mod = Mod4Mask, .key = XK_Up, .act = ACTION_FOCUS, .num = SPOT2 },
{ .mod = Mod4Mask, .key = XK_3, .act = ACTION_FOCUS, .num = SPOT3 }, { .mod = Mod4Mask, .key = XK_Right, .act = ACTION_FOCUS, .num = SPOT2 },
{ .mod = Mod4Mask, .key = XK_Down, .act = ACTION_FOCUS, .num = SPOT3 },
// Move the current window to another spot. // Move the current window to another spot.
{ .mod = ShiftMask|Mod4Mask, .key = XK_1, .act = ACTION_MOVE, .num = SPOT1 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Left, .act = ACTION_MOVE, .num = SPOT1 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_2, .act = ACTION_MOVE, .num = SPOT2 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Up, .act = ACTION_MOVE, .num = SPOT2 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_3, .act = ACTION_MOVE, .num = SPOT3 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Right, .act = ACTION_MOVE, .num = SPOT2 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_Down, .act = ACTION_MOVE, .num = SPOT3 },
// Flip between the top two windows in the current spot. // Flip between the top two windows in the current spot.
{ .mod = Mod4Mask, .key = XK_Tab, .act = ACTION_OTHER }, { .mod = Mod4Mask, .key = XK_Tab, .act = ACTION_OTHER },
@@ -73,28 +75,28 @@ binding keys[] = {
{ .mod = Mod4Mask, .key = XK_a, .act = ACTION_ABOVE_TOGGLE }, { .mod = Mod4Mask, .key = XK_a, .act = ACTION_ABOVE_TOGGLE },
// Switch focus between monitors. // Switch focus between monitors.
{ .mod = Mod4Mask, .key = XK_Right, .act = ACTION_FOCUS_MONITOR, .num = 1 }, { .mod = Mod4Mask, .key = XK_Next, .act = ACTION_FOCUS_MONITOR, .num = 1 },
{ .mod = Mod4Mask, .key = XK_Left, .act = ACTION_FOCUS_MONITOR, .num = -1 }, { .mod = Mod4Mask, .key = XK_Prior, .act = ACTION_FOCUS_MONITOR, .num = -1 },
// Move windows between monitors. // Move windows between monitors.
{ .mod = ShiftMask|Mod4Mask, .key = XK_Right, .act = ACTION_MOVE_MONITOR, .num = 1 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Next, .act = ACTION_MOVE_MONITOR, .num = 1 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_Left, .act = ACTION_MOVE_MONITOR, .num = -1 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Prior, .act = ACTION_MOVE_MONITOR, .num = -1 },
// Launcher // Launcher
{ .mod = Mod4Mask, .key = XK_x, .act = ACTION_COMMAND, .data = "dmenu_run" }, { .mod = Mod4Mask, .key = XK_x, .act = ACTION_COMMAND, .data = "dmenu_run" },
// Raise tag groups // Raise tag groups
{ .mod = Mod4Mask, .key = XK_F1, .act = ACTION_RAISE_TAG, .num = TAG1 }, { .mod = Mod4Mask, .key = XK_1, .act = ACTION_RAISE_TAG, .num = TAG1 },
{ .mod = Mod4Mask, .key = XK_F2, .act = ACTION_RAISE_TAG, .num = TAG2 }, { .mod = Mod4Mask, .key = XK_2, .act = ACTION_RAISE_TAG, .num = TAG2 },
{ .mod = Mod4Mask, .key = XK_F3, .act = ACTION_RAISE_TAG, .num = TAG3 }, { .mod = Mod4Mask, .key = XK_3, .act = ACTION_RAISE_TAG, .num = TAG3 },
// Tag/untag the current window // Tag/untag the current window
{ .mod = ShiftMask|Mod4Mask, .key = XK_F1, .act = ACTION_TAG, .num = TAG1 }, { .mod = ShiftMask|Mod4Mask, .key = XK_1, .act = ACTION_TAG, .num = TAG1 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_F2, .act = ACTION_TAG, .num = TAG2 }, { .mod = ShiftMask|Mod4Mask, .key = XK_2, .act = ACTION_TAG, .num = TAG2 },
{ .mod = ShiftMask|Mod4Mask, .key = XK_F3, .act = ACTION_TAG, .num = TAG3 }, { .mod = ShiftMask|Mod4Mask, .key = XK_3, .act = ACTION_TAG, .num = TAG3 },
{ .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_F1, .act = ACTION_UNTAG, .num = TAG1 }, { .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_1, .act = ACTION_UNTAG, .num = TAG1 },
{ .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_F2, .act = ACTION_UNTAG, .num = TAG2 }, { .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_2, .act = ACTION_UNTAG, .num = TAG2 },
{ .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_F3, .act = ACTION_UNTAG, .num = TAG3 }, { .mod = ShiftMask|ControlMask|Mod4Mask, .key = XK_3, .act = ACTION_UNTAG, .num = TAG3 },
// Find or start apps by WM_CLASS (lower case match). // Find or start apps by WM_CLASS (lower case match).
{ .mod = AnyModifier, .key = XK_F1, .act = ACTION_FIND_OR_START, .data = "urxvt" }, { .mod = AnyModifier, .key = XK_F1, .act = ACTION_FIND_OR_START, .data = "urxvt" },

38
xoat.1
View File

@@ -16,32 +16,32 @@ See config.h for customization.
.PP .PP
These are the default key bindings: These are the default key bindings:
.TP .TP
.B Mod4-1 .B Mod4-Left
Focus tile 1. Focus tile 1.
.RS .RS
.RE .RE
.TP .TP
.B Mod4-2 .B Mod4-Right (and Up)
Focus tile 2. Focus tile 2.
.RS .RS
.RE .RE
.TP .TP
.B Mod4-3 .B Mod4-Down
Focus tile 3. Focus tile 3.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-1 .B Shift-Mod4-Left
Move window to tile 1. Move window to tile 1.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-2 .B Shift-Mod4-Right (and Up)
Move window to tile 2. Move window to tile 2.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-3 .B Shift-Mod4-Down
Move window to tile 3. Move window to tile 3.
.RS .RS
.RE .RE
@@ -72,22 +72,22 @@ Toggle state above (only placed above fullscreen windows).
.RS .RS
.RE .RE
.TP .TP
.B Mod4-Right .B Mod4-Next (Page Down)
Focus next monitor. Focus next monitor.
.RS .RS
.RE .RE
.TP .TP
.B Mod4-Left .B Mod4-Prior (Page Up)
Focus previous monitor. Focus previous monitor.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-Right .B Shift-Mod4-Next
Move window to next monitor. Move window to next monitor.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-Left .B Shift-Mod4-Prior
Move window to previous monitor. Move window to previous monitor.
.RS .RS
.RE .RE
@@ -102,47 +102,47 @@ Launch urxvt
.RS .RS
.RE .RE
.TP .TP
.B Mod4-F1 .B Mod4-1
Raise windows in tag 1. Raise windows in tag 1.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-F1 .B Shift-Mod4-1
Place current window in tag 1. Place current window in tag 1.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Control-Mod4-F1 .B Shift-Control-Mod4-1
Remove current window from tag 1. Remove current window from tag 1.
.RS .RS
.RE .RE
.TP .TP
.B Mod4-F2 .B Mod4-2
Raise windows in tag 2. Raise windows in tag 2.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-F2 .B Shift-Mod4-2
Place current window in tag 2. Place current window in tag 2.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Control-Mod4-F2 .B Shift-Control-Mod4-2
Remove current window from tag 2. Remove current window from tag 2.
.RS .RS
.RE .RE
.TP .TP
.B Mod4-F3 .B Mod4-3
Raise windows in tag 3. Raise windows in tag 3.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Mod4-F3 .B Shift-Mod4-3
Place current window in tag 3. Place current window in tag 3.
.RS .RS
.RE .RE
.TP .TP
.B Shift-Control-Mod4-F3 .B Shift-Control-Mod4-3
Remove current window from tag 3. Remove current window from tag 3.
.RS .RS
.RE .RE

26
xoat.c
View File

@@ -992,15 +992,15 @@ int main(int argc, char *argv[])
client *c = wins.clients[i]; client *c = wins.clients[i];
if (!c) continue; if (!c) continue;
unsigned long strut[12]; memset(strut, 0, sizeof(strut)); wm_strut strut; memset(&strut, 0, sizeof(wm_strut));
if (window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT_PARTIAL], strut, 12) if (window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT_PARTIAL], (unsigned long*)&strut, 12)
|| window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT], strut, 4)) || window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT], (unsigned long*)&strut, 4))
{ {
struts[LEFT] = MAX(struts[LEFT], strut[LEFT]); struts.left = MAX(struts.left, strut.left);
struts[RIGHT] = MAX(struts[RIGHT], strut[RIGHT]); struts.right = MAX(struts.right, strut.right);
struts[TOP] = MAX(struts[TOP], strut[TOP]); struts.top = MAX(struts.top, strut.top);
struts[BOTTOM] = MAX(struts[BOTTOM], strut[BOTTOM]); struts.bottom = MAX(struts.bottom, strut.bottom);
warnx("struts %ld %ld %ld %ld 0x%08lx %s", strut[LEFT], strut[LEFT], strut[LEFT], strut[LEFT], (long)c->window, c->class); warnx("struts %ld %ld %ld %ld 0x%08lx %s", strut.left, strut.left, strut.left, strut.left, (long)c->window, c->class);
} }
client_free(c); client_free(c);
} }
@@ -1014,9 +1014,9 @@ int main(int argc, char *argv[])
for (i = 0; i < nmonitors; i++) for (i = 0; i < nmonitors; i++)
{ {
monitors[i].x = info[i].x_org; monitors[i].x = info[i].x_org;
monitors[i].y = info[i].y_org + struts[TOP]; monitors[i].y = info[i].y_org + struts.top;
monitors[i].w = info[i].width; monitors[i].w = info[i].width;
monitors[i].h = info[i].height - struts[TOP] - struts[BOTTOM]; monitors[i].h = info[i].height - struts.top - struts.bottom;
warnx("monitor %d %dx%d+%d+%d", i, monitors[i].w, monitors[i].h, monitors[i].x, monitors[i].y); warnx("monitor %d %dx%d+%d+%d", i, monitors[i].w, monitors[i].h, monitors[i].x, monitors[i].y);
} }
XFree(info); XFree(info);
@@ -1024,11 +1024,11 @@ int main(int argc, char *argv[])
} }
// left struts affect first monitor // left struts affect first monitor
monitors[0].x += struts[LEFT]; monitors[0].x += struts.left;
monitors[0].w -= struts[LEFT]; monitors[0].w -= struts.left;
// right struts affect last monitor // right struts affect last monitor
monitors[nmonitors-1].w -= struts[RIGHT]; monitors[nmonitors-1].w -= struts.right;
// dump atoms for debug // dump atoms for debug
for (i = 0; i < ATOMS; i++) warnx("atom 0x%lx %s", (long)atoms[i], atom_names[i]); for (i = 0; i < ATOMS; i++) warnx("atom 0x%lx %s", (long)atoms[i], atom_names[i]);

9
xoat.h
View File

@@ -94,8 +94,13 @@ stack inplay;
static int (*xerror)(Display *, XErrorEvent *); static int (*xerror)(Display *, XErrorEvent *);
enum { LEFT, RIGHT, TOP, BOTTOM }; typedef struct {
int struts[4] = { 0, 0, 0, 0 }; long left, right, top, bottom,
left_start_y, left_end_y, right_start_y, right_end_y,
top_start_x, top_end_x, bottom_start_x, bottom_end_x;
} wm_strut;
wm_strut struts;
#define ATOM_ENUM(x) x #define ATOM_ENUM(x) x
#define ATOM_CHAR(x) #x #define ATOM_CHAR(x) #x

38
xoat.md
View File

@@ -20,22 +20,22 @@ See config.h for customization.
These are the default key bindings: These are the default key bindings:
Mod4-1 Mod4-Left
: Focus tile 1. : Focus tile 1.
Mod4-2 Mod4-Right (and Up)
: Focus tile 2. : Focus tile 2.
Mod4-3 Mod4-Down
: Focus tile 3. : Focus tile 3.
Shift-Mod4-1 Shift-Mod4-Left
: Move window to tile 1. : Move window to tile 1.
Shift-Mod4-2 Shift-Mod4-Right (and Up)
: Move window to tile 2. : Move window to tile 2.
Shift-Mod4-3 Shift-Mod4-Down
: Move window to tile 3. : Move window to tile 3.
Mod4-Tab Mod4-Tab
@@ -53,16 +53,16 @@ Mod4-f
Mod4-a Mod4-a
: Toggle state above (only placed above fullscreen windows). : Toggle state above (only placed above fullscreen windows).
Mod4-Right Mod4-Next (Page Down)
: Focus next monitor. : Focus next monitor.
Mod4-Left Mod4-Prior (Page Up)
: Focus previous monitor. : Focus previous monitor.
Shift-Mod4-Right Shift-Mod4-Next
: Move window to next monitor. : Move window to next monitor.
Shift-Mod4-Left Shift-Mod4-Prior
: Move window to previous monitor. : Move window to previous monitor.
Shift-Mod4-x Shift-Mod4-x
@@ -71,31 +71,31 @@ Shift-Mod4-x
F1 F1
: Launch urxvt : Launch urxvt
Mod4-F1 Mod4-1
: Raise windows in tag 1. : Raise windows in tag 1.
Shift-Mod4-F1 Shift-Mod4-1
: Place current window in tag 1. : Place current window in tag 1.
Shift-Control-Mod4-F1 Shift-Control-Mod4-1
: Remove current window from tag 1. : Remove current window from tag 1.
Mod4-F2 Mod4-2
: Raise windows in tag 2. : Raise windows in tag 2.
Shift-Mod4-F2 Shift-Mod4-2
: Place current window in tag 2. : Place current window in tag 2.
Shift-Control-Mod4-F2 Shift-Control-Mod4-2
: Remove current window from tag 2. : Remove current window from tag 2.
Mod4-F3 Mod4-3
: Raise windows in tag 3. : Raise windows in tag 3.
Shift-Mod4-F3 Shift-Mod4-3
: Place current window in tag 3. : Place current window in tag 3.
Shift-Control-Mod4-F3 Shift-Control-Mod4-3
: Remove current window from tag 3. : Remove current window from tag 3.
# OPTIONS # OPTIONS