update config to stay sane on a rotated monitor

This commit is contained in:
seanpringle
2012-09-21 16:08:49 +10:00
parent b683ac888e
commit 9ce7bfe2ea
2 changed files with 29 additions and 13 deletions

View File

@@ -57,20 +57,37 @@
#define FOCUS_START FOCUS_IGNORE #define FOCUS_START FOCUS_IGNORE
//#define FOCUS_START FOCUS_STEAL //#define FOCUS_START FOCUS_STEAL
// Available actions...
// action_move .num = SPOT1/2/3
// action_focus .num = SPOT1/2/3
// action_move_direction .num = UP/DOWN/LEFT/RIGHT
// action_focus_direction .num = UP/DOWN/LEFT/RIGHT
// action_close
// action_cycle
// action_other
// action_command
// action_find_or_start
// action_move_monitor
// action_focus_monitor
// action_fullscreen
// action_above
// action_snapshot
// action_rollback
// If you use "AnyModifier" place those keys at the end of the array. // If you use "AnyModifier" place those keys at the end of the array.
binding keys[] = { binding keys[] = {
// Focus the top-most window in a spot. // Change focus to a spot by direction.
{ .mod = Mod4Mask, .key = XK_Left, .act = action_focus, .num = SPOT1 }, { .mod = Mod4Mask, .key = XK_Left, .act = action_focus_direction, .num = LEFT },
{ .mod = Mod4Mask, .key = XK_Up, .act = action_focus, .num = SPOT2 }, { .mod = Mod4Mask, .key = XK_Up, .act = action_focus_direction, .num = UP },
{ .mod = Mod4Mask, .key = XK_Right, .act = action_focus, .num = SPOT2 }, { .mod = Mod4Mask, .key = XK_Right, .act = action_focus_direction, .num = RIGHT },
{ .mod = Mod4Mask, .key = XK_Down, .act = action_focus, .num = SPOT3 }, { .mod = Mod4Mask, .key = XK_Down, .act = action_focus_direction, .num = DOWN },
// Move the current window to another spot. // Move the current window to another spot by direction.
{ .mod = ShiftMask|Mod4Mask, .key = XK_Left, .act = action_move, .num = SPOT1 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Left, .act = action_move_direction, .num = LEFT },
{ .mod = ShiftMask|Mod4Mask, .key = XK_Up, .act = action_move, .num = SPOT2 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Up, .act = action_move_direction, .num = UP },
{ .mod = ShiftMask|Mod4Mask, .key = XK_Right, .act = action_move, .num = SPOT2 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Right, .act = action_move_direction, .num = RIGHT },
{ .mod = ShiftMask|Mod4Mask, .key = XK_Down, .act = action_move, .num = SPOT3 }, { .mod = ShiftMask|Mod4Mask, .key = XK_Down, .act = action_move_direction, .num = DOWN },
// 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 },
@@ -107,4 +124,4 @@ binding keys[] = {
{ .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "urxvt" }, { .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "urxvt" },
{ .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" }, { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" },
{ .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" }, { .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" },
}; };

3
xoat.c
View File

@@ -586,8 +586,7 @@ Window spot_focus_top_window(int spot, int mon, Window except)
int spot_choose_by_direction(int spot, int mon, int dir) int spot_choose_by_direction(int spot, int mon, int dir)
{ {
monitor *m = &monitors[mon]; monitor *m = &monitors[mon];
int rotate = m->w < m->h ? 1:0; if (m->w < m->h) // rotated?
if (rotate)
{ {
if (dir == LEFT) return SPOT3; if (dir == LEFT) return SPOT3;
if (dir == RIGHT) return SPOT2; if (dir == RIGHT) return SPOT2;