]> code.delx.au - spectrwm/commitdiff
Add horizontal_flip and vertical_flip layout options.
authorReginald Kennedy <rk@rejii.com>
Sun, 10 Jun 2012 21:31:28 +0000 (05:31 +0800)
committerReginald Kennedy <rk@rejii.com>
Tue, 12 Jun 2012 13:14:13 +0000 (21:14 +0800)
Based on patch submitted by Olivier Mauras <coredumb@coredumb.net>

ok marco

spectrwm.1
spectrwm.c
spectrwm.conf

index 5596af0152d7544021b0d5362410054423d1ce6f..2404cfb0decbc4ecbebb9a5f20ab118ba6b790ab 100644 (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.
 Possible stack_mode values are
 .Pa vertical ,
-.Pa horizontal
+.Pa vertical_flip ,
+.Pa horizontal ,
+.Pa horizontal_flip
 and
 .Pa fullscreen .
 .Pp
index 6b94bcb2ca0b315bf5402823f7b0e784c5570f9b..0569f9c1147de111141363d3a83f7ce1c09d70c7 100644 (file)
@@ -5756,7 +5756,7 @@ setautorun(char *selector, char *value, int flags)
 int
 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;
        char                    s[1024];
        struct workspace        *ws;
@@ -5776,9 +5776,15 @@ setlayout(char *selector, char *value, int flags)
 
        if (!strcasecmp(s, "vertical"))
                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;
+       else if (!strcasecmp(s, "horizontal_flip")) {
                st = SWM_H_STACK;
-       else if (!strcasecmp(s, "fullscreen"))
+               f = 1;
+       } else if (!strcasecmp(s, "fullscreen"))
                st = SWM_MAX_STACK;
        else
                errx(1, "invalid layout entry, should be 'ws[<idx>]:"
@@ -5814,6 +5820,12 @@ setlayout(char *selector, char *value, int flags)
                            SWM_ARG_ID_STACKDEC);
                        stack();
                }
+               /* Apply flip */
+               if (f) {
+                       ws[ws_id].cur_layout->l_config(&ws[ws_id],
+                           SWM_ARG_ID_FLIPLAYOUT);
+                       stack();
+               }
        }
 
        return (0);
index acdfb2d387edd50d568e8ca951c65f83a5b858f7..53c673bc825d66ea732acffb92b87597ee0ef056 100644 (file)
@@ -64,6 +64,8 @@
 # layout               = ws[1]:4:0:0:0:vertical
 # layout               = ws[2]:0:0:0:0:horizontal
 # 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)
 # modkey = Mod1