mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-02 09:01:43 -05:00
feat: first stack window mfact setting
This commit is contained in:
parent
16b1d720c0
commit
faa14ff272
5 changed files with 64 additions and 13 deletions
|
|
@ -19,11 +19,14 @@ scroller_default_proportion=0.8
|
|||
scoller_focus_center=0
|
||||
scroller_proportion_preset=0.5,0.8,1.0
|
||||
|
||||
# Master-Stack Layout Setting
|
||||
# Master-Stack Layout Setting (tile,spiral,dwindle)
|
||||
new_is_master=1
|
||||
default_mfact=0.55
|
||||
default_nmaster=1
|
||||
smartgaps=0
|
||||
# only work in spiral and dwindlw
|
||||
default_smfact=0.5
|
||||
|
||||
|
||||
# Overview Setting
|
||||
hotarea_size=10
|
||||
|
|
@ -168,6 +171,8 @@ bind=SUPER,e,incnmaster,1
|
|||
bind=SUPER,t,incnmaster,-1
|
||||
bind=ALT+CTRL,Left,setmfact,-0.01
|
||||
bind=ALT+CTRL,Right,setmfact,+0.01
|
||||
bind=ALT+CTRL,Up,setsmfact,-0.01
|
||||
bind=ALT+CTRL,Down,setsmfact,+0.01
|
||||
bind=ALT,s,zoom,
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ void spawn(const Arg *arg);
|
|||
void setlayout(const Arg *arg);
|
||||
void switch_layout(const Arg *arg);
|
||||
void setmfact(const Arg *arg);
|
||||
void setsmfact(const Arg *arg);
|
||||
void quit(const Arg *arg);
|
||||
void moveresize(const Arg *arg);
|
||||
void exchange_client(const Arg *arg);
|
||||
|
|
|
|||
60
maomao.c
60
maomao.c
|
|
@ -673,6 +673,7 @@ struct Pertag {
|
|||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||
float smfacts[LENGTH(tags) + 1]; /* smfacts per tag */
|
||||
const Layout
|
||||
*ltidxs[LENGTH(tags) + 1]; /* matrix of tags and layouts indexes */
|
||||
};
|
||||
|
|
@ -2305,7 +2306,7 @@ createmon(struct wl_listener *listener, void *data) {
|
|||
for (i = 0; i <= LENGTH(tags); i++) {
|
||||
m->pertag->nmasters[i] = m->nmaster;
|
||||
m->pertag->mfacts[i] = m->mfact;
|
||||
|
||||
m->pertag->smfacts[i] = default_smfact;
|
||||
m->pertag->ltidxs[i] = m->lt;
|
||||
|
||||
if (i > 0 && strlen(config.tags[i - 1].layout_name) > 0) {
|
||||
|
|
@ -4508,7 +4509,6 @@ void switch_layout(const Arg *arg) {
|
|||
}
|
||||
}
|
||||
|
||||
/* arg > 1.0 will set mfact absolutely */
|
||||
/* arg > 1.0 will set mfact absolutely */
|
||||
void // 17
|
||||
setmfact(const Arg *arg) {
|
||||
|
|
@ -4526,6 +4526,22 @@ setmfact(const Arg *arg) {
|
|||
arrange(selmon, false);
|
||||
}
|
||||
|
||||
void
|
||||
setsmfact(const Arg *arg) {
|
||||
float f;
|
||||
|
||||
if (!arg || !selmon ||
|
||||
!selmon->pertag->ltidxs[selmon->pertag->curtag]->arrange)
|
||||
return;
|
||||
f = arg->f < 1.0 ? arg->f + selmon->pertag->smfacts[selmon->pertag->curtag]
|
||||
: arg->f - 1.0;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
// selmon->mfact = f;
|
||||
selmon->pertag->smfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon, false);
|
||||
}
|
||||
|
||||
void // 0.5
|
||||
setmon(Client *c, Monitor *m, uint32_t newtags) {
|
||||
Monitor *oldmon = c->mon;
|
||||
|
|
@ -5052,7 +5068,8 @@ void overview(Monitor *m, unsigned int gappo, unsigned int gappi) {
|
|||
grid(m, overviewgappo, overviewgappi);
|
||||
}
|
||||
|
||||
void fibonacci(Monitor *mon, int s) {
|
||||
void fibonacci(Monitor *mon, int s)
|
||||
{
|
||||
unsigned int i = 0, n = 0, nx, ny, nw, nh;
|
||||
Client *c;
|
||||
|
||||
|
|
@ -5071,11 +5088,19 @@ void fibonacci(Monitor *mon, int s) {
|
|||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && !c->isfloating &&
|
||||
!c->iskilling && !c->isfullscreen &&
|
||||
!c->ismaxmizescreen &&
|
||||
!c->animation.tagouting) {
|
||||
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
||||
if (i < n - 1) {
|
||||
!c->animation.tagouting)
|
||||
{
|
||||
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw))
|
||||
{
|
||||
if (i < n - 1)
|
||||
{
|
||||
if (i % 2)
|
||||
nh /= 2;
|
||||
{
|
||||
if (i == 1)
|
||||
nh = nh * c->mon->pertag->smfacts[selmon->pertag->curtag];
|
||||
else
|
||||
nh /= 2;
|
||||
}
|
||||
else
|
||||
nw /= 2;
|
||||
if ((i % 4) == 2 && !s)
|
||||
|
|
@ -5083,28 +5108,39 @@ void fibonacci(Monitor *mon, int s) {
|
|||
else if ((i % 4) == 3 && !s)
|
||||
ny += nh;
|
||||
}
|
||||
if ((i % 4) == 0) {
|
||||
|
||||
if ((i % 4) == 0)
|
||||
{
|
||||
if (s)
|
||||
ny += nh;
|
||||
else
|
||||
ny -= nh;
|
||||
} else if ((i % 4) == 1)
|
||||
}
|
||||
else if ((i % 4) == 1)
|
||||
nx += nw;
|
||||
else if ((i % 4) == 2)
|
||||
ny += nh;
|
||||
else if ((i % 4) == 3) {
|
||||
else if ((i % 4) == 3)
|
||||
{
|
||||
if (s)
|
||||
nx += nw;
|
||||
else
|
||||
nx -= nw;
|
||||
}
|
||||
if (i == 0) {
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (n != 1)
|
||||
nw = (mon->w.width - gappoh) *
|
||||
mon->pertag->mfacts[mon->pertag->curtag];
|
||||
ny = mon->w.y + gappov;
|
||||
} else if (i == 1)
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
nw = mon->w.width - gappoh - nw;
|
||||
}
|
||||
else if (i == 2)
|
||||
nh = mon->w.height - gappov - nh;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ typedef struct {
|
|||
|
||||
unsigned int new_is_master;
|
||||
float default_mfact;
|
||||
float default_smfact;
|
||||
unsigned int default_nmaster;
|
||||
|
||||
unsigned int hotarea_size;
|
||||
|
|
@ -374,6 +375,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value) {
|
|||
} else if (strcmp(func_name, "setmfact") == 0) {
|
||||
func = setmfact;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "setsmfact") == 0) {
|
||||
func = setsmfact;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "zoom") == 0) {
|
||||
func = zoom;
|
||||
} else if (strcmp(func_name, "exchange_client") == 0) {
|
||||
|
|
@ -613,6 +617,8 @@ void parse_config_line(Config *config, const char *line) {
|
|||
config->new_is_master = atoi(value);
|
||||
} else if (strcmp(key, "default_mfact") == 0) {
|
||||
config->default_mfact = atof(value);
|
||||
} else if (strcmp(key, "default_smfact") == 0) {
|
||||
config->default_smfact = atof(value);
|
||||
} else if (strcmp(key, "default_nmaster") == 0) {
|
||||
config->default_nmaster = atoi(value);
|
||||
} else if (strcmp(key, "hotarea_size") == 0) {
|
||||
|
|
@ -1054,6 +1060,7 @@ void override_config(void) {
|
|||
|
||||
new_is_master = config.new_is_master;
|
||||
default_mfact = config.default_mfact;
|
||||
default_smfact = config.default_smfact;
|
||||
default_nmaster = config.default_nmaster;
|
||||
hotarea_size = config.hotarea_size;
|
||||
enable_hotarea = config.enable_hotarea;
|
||||
|
|
@ -1110,6 +1117,7 @@ void set_value_default() {
|
|||
config.focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||
config.new_is_master = 1; // 新窗口是否插在头部
|
||||
config.default_mfact = 0.55f; // master 窗口比例
|
||||
config.default_smfact = 0.5f; // 第一个stack比例
|
||||
config.default_nmaster = 1; // 默认master数量
|
||||
|
||||
config.numlockon = 1; // 是否打开右边小键盘
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ unsigned int axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时
|
|||
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||
unsigned int new_is_master = 1; // 新窗口是否插在头部
|
||||
double default_mfact = 0.55f; // master 窗口比例
|
||||
double default_smfact = 0.5f; // 第一个stack窗口比例
|
||||
unsigned int default_nmaster = 1; // 默认master数量
|
||||
/* logging */
|
||||
int log_level = WLR_ERROR;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue