Add horizontal_flip and vertical_flip layout options.

Based on patch submitted by Olivier Mauras <coredumb@coredumb.net>

ok marco
This commit is contained in:
Reginald Kennedy 2012-06-11 05:31:28 +08:00
parent 69e4733971
commit f6d686fcff
3 changed files with 20 additions and 4 deletions

View file

@ -208,7 +208,9 @@ shrinks the master area by 4 ticks and adds one window to the stack, while
maintaining default floating window behavior. maintaining default floating window behavior.
Possible stack_mode values are Possible stack_mode values are
.Pa vertical , .Pa vertical ,
.Pa horizontal .Pa vertical_flip ,
.Pa horizontal ,
.Pa horizontal_flip
and and
.Pa fullscreen . .Pa fullscreen .
.Pp .Pp

View file

@ -5756,7 +5756,7 @@ setautorun(char *selector, char *value, int flags)
int int
setlayout(char *selector, char *value, int flags) setlayout(char *selector, char *value, int flags)
{ {
int ws_id, i, x, mg, ma, si, raise; int ws_id, i, x, mg, ma, si, raise, f = 0;
int st = SWM_V_STACK; int st = SWM_V_STACK;
char s[1024]; char s[1024];
struct workspace *ws; struct workspace *ws;
@ -5776,9 +5776,15 @@ setlayout(char *selector, char *value, int flags)
if (!strcasecmp(s, "vertical")) if (!strcasecmp(s, "vertical"))
st = SWM_V_STACK; st = SWM_V_STACK;
else if (!strcasecmp(s, "horizontal")) else if (!strcasecmp(s, "vertical_flip")) {
st = SWM_V_STACK;
f = 1;
} else if (!strcasecmp(s, "horizontal"))
st = SWM_H_STACK; st = SWM_H_STACK;
else if (!strcasecmp(s, "fullscreen")) else if (!strcasecmp(s, "horizontal_flip")) {
st = SWM_H_STACK;
f = 1;
} else if (!strcasecmp(s, "fullscreen"))
st = SWM_MAX_STACK; st = SWM_MAX_STACK;
else else
errx(1, "invalid layout entry, should be 'ws[<idx>]:" errx(1, "invalid layout entry, should be 'ws[<idx>]:"
@ -5814,6 +5820,12 @@ setlayout(char *selector, char *value, int flags)
SWM_ARG_ID_STACKDEC); SWM_ARG_ID_STACKDEC);
stack(); stack();
} }
/* Apply flip */
if (f) {
ws[ws_id].cur_layout->l_config(&ws[ws_id],
SWM_ARG_ID_FLIPLAYOUT);
stack();
}
} }
return (0); return (0);

View file

@ -64,6 +64,8 @@
# layout = ws[1]:4:0:0:0:vertical # layout = ws[1]:4:0:0:0:vertical
# layout = ws[2]:0:0:0:0:horizontal # layout = ws[2]:0:0:0:0:horizontal
# layout = ws[3]:0:0:0:0:fullscreen # layout = ws[3]:0:0:0:0:fullscreen
# layout = ws[4]:4:0:0:0:vertical_flip
# layout = ws[5]:0:0:0:0:horizontal_flip
# mod key, (windows key is Mod4) (apple key on OSX is Mod2) # mod key, (windows key is Mod4) (apple key on OSX is Mod2)
# modkey = Mod1 # modkey = Mod1