mirror of
https://github.com/vale981/spectrwm
synced 2025-03-04 17:31:40 -05:00
Make layout fancier by adding master_grow, master_shrink, master_add,
master_del, stack_inc and stack_del to the format string.
This commit is contained in:
parent
2a8d7bafe3
commit
014589e605
3 changed files with 50 additions and 9 deletions
24
scrotwm.1
24
scrotwm.1
|
@ -122,14 +122,30 @@ This ratio is the screen size to what they will be resized.
|
|||
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.
|
||||
|
|
29
scrotwm.c
29
scrotwm.c
|
@ -4589,7 +4589,7 @@ setautorun(char *selector, char *value, int flags)
|
|||
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;
|
||||
|
||||
|
@ -4597,7 +4597,8 @@ setlayout(char *selector, char *value, int flags)
|
|||
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)
|
||||
|
@ -4615,6 +4616,30 @@ setlayout(char *selector, char *value, int flags)
|
|||
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);
|
||||
|
|
|
@ -46,9 +46,9 @@ dialog_ratio = 0.6
|
|||
# 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
|
||||
|
|
Loading…
Add table
Reference in a new issue