For example, 0.6 is 60% of the physical screen size.
.It Cm layout
select layout to use at start-of-day.
-Defined in the format ws[<idx>]:<layout>, e.g. ws[2]:horizontal sets worskspace
-2 to the horizontal stack mode.
-This setting is not retained at restart.
-Possible values are
+Defined in the format ws[idx]:master_grow:master_add:stack_inc:layout, e.g.
+ws[2]:-4:0:1:horizontal sets worskspace 2 to the horizontal stack mode and
+shrinks the master area by 4 ticks and adds one window to the stack.
+Possible layout values are
.Pa vertical ,
.Pa horizontal
and
.Pa fullscreen .
+.Pp
+See
+.Pa master_grow ,
+.Pa master_shrink ,
+.Pa master_add ,
+.Pa master_del ,
+.Pa stack_inc ,
+and
+.Pa stack_del
+for more information.
+Note that the stacking options are complicated and have side-effects.
+One should familiarize oneself with these commands before experimenting with the
+.Pa layout
+option.
+.Pp
+This setting is not retained at restart.
.It Cm region
Allocates a custom region, removing any autodetected regions which occupy the same
space on the screen.
int
setlayout(char *selector, char *value, int flags)
{
- int ws_id, st, i;
+ int ws_id, st, i, x, mg, ma, si;
char s[1024];
struct workspace *ws;
return (0);
bzero(s, sizeof s);
- if (sscanf(value, "ws[%d]:%1023c", &ws_id, s) != 2)
+ if (sscanf(value, "ws[%d]:%d:%d:%d:%1023c",
+ &ws_id, &mg, &ma, &si, s) != 5)
errx(1, "invalid layout entry, should be 'ws[<idx>]:<type>'\n");
ws_id--;
if (ws_id < 0 || ws_id >= SWM_WS_MAX)
for (i = 0; i < ScreenCount(display); i++) {
ws = (struct workspace *)&screens[i].ws;
ws[ws_id].cur_layout = &layouts[st];
+ if (st == SWM_MAX_STACK)
+ continue;
+
+ /* master grow */
+ for (x = 0; x < abs(mg); x++) {
+ ws[ws_id].cur_layout->l_config(&ws[ws_id],
+ mg >= 0 ? SWM_ARG_ID_MASTERGROW :
+ SWM_ARG_ID_MASTERSHRINK);
+ stack();
+ }
+ /* master add */
+ for (x = 0; x < abs(ma); x++) {
+ ws[ws_id].cur_layout->l_config(&ws[ws_id],
+ ma >= 0 ? SWM_ARG_ID_MASTERADD :
+ SWM_ARG_ID_MASTERDEL);
+ stack();
+ }
+ /* stack inc */
+ for (x = 0; x < abs(si); x++) {
+ ws[ws_id].cur_layout->l_config(&ws[ws_id],
+ si >= 0 ? SWM_ARG_ID_STACKINC :
+ SWM_ARG_ID_STACKDEC);
+ stack();
+ }
}
return (0);
# autorun = ws[2]:xxxterm http://www.openbsd.org
# workspace layout
-# layout = ws[1]:vertical
-# layout = ws[2]:horizontal
-# layout = ws[3]:fullscreen
+# layout = ws[1]:4:0:0:vertical
+# layout = ws[2]:0:0:0:horizontal
+# layout = ws[3]:0:0:0:fullscreen
# mod key, (windows key is Mod4) (apple key on OSX is Mod2)
# modkey = Mod1