add: configuration options and keybinds for the dual-scroller layout
This commit is contained in:
@@ -57,6 +57,7 @@ scroller_prefer_center=0
|
|||||||
edge_scroller_pointer_focus=1
|
edge_scroller_pointer_focus=1
|
||||||
scroller_default_proportion_single=1.0
|
scroller_default_proportion_single=1.0
|
||||||
scroller_proportion_preset=0.5,0.8,1.0
|
scroller_proportion_preset=0.5,0.8,1.0
|
||||||
|
dual_scroller_default_split_ratio=0.3
|
||||||
|
|
||||||
# Master-Stack Layout Setting
|
# Master-Stack Layout Setting
|
||||||
new_is_master=1
|
new_is_master=1
|
||||||
@@ -237,6 +238,10 @@ bind=CTRL+ALT,Down,resizewin,+0,+50
|
|||||||
bind=CTRL+ALT,Left,resizewin,-50,+0
|
bind=CTRL+ALT,Left,resizewin,-50,+0
|
||||||
bind=CTRL+ALT,Right,resizewin,+50,+0
|
bind=CTRL+ALT,Right,resizewin,+50,+0
|
||||||
|
|
||||||
|
# dual-scroller split adjustment (increase/decrease top row height)
|
||||||
|
# bind=SUPER+SHIFT,Equal,adjust_dual_scroller_split,0.05
|
||||||
|
# bind=SUPER+SHIFT,Minus,adjust_dual_scroller_split,-0.05
|
||||||
|
|
||||||
# Mouse Button Bindings
|
# Mouse Button Bindings
|
||||||
# NONE mode key only work in ov mode
|
# NONE mode key only work in ov mode
|
||||||
mousebind=SUPER,btn_left,moveresize,curmove
|
mousebind=SUPER,btn_left,moveresize,curmove
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ typedef struct {
|
|||||||
int scroller_focus_center;
|
int scroller_focus_center;
|
||||||
int scroller_prefer_center;
|
int scroller_prefer_center;
|
||||||
int edge_scroller_pointer_focus;
|
int edge_scroller_pointer_focus;
|
||||||
|
float dual_scroller_default_split_ratio;
|
||||||
int focus_cross_monitor;
|
int focus_cross_monitor;
|
||||||
int exchange_cross_monitor;
|
int exchange_cross_monitor;
|
||||||
int scratchpad_cross_monitor;
|
int scratchpad_cross_monitor;
|
||||||
@@ -822,6 +823,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||||||
} else if (strcmp(func_name, "setmfact") == 0) {
|
} else if (strcmp(func_name, "setmfact") == 0) {
|
||||||
func = setmfact;
|
func = setmfact;
|
||||||
(*arg).f = atof(arg_value);
|
(*arg).f = atof(arg_value);
|
||||||
|
} else if (strcmp(func_name, "adjust_dual_scroller_split") == 0) {
|
||||||
|
func = adjust_dual_scroller_split;
|
||||||
|
(*arg).f = atof(arg_value);
|
||||||
} else if (strcmp(func_name, "zoom") == 0) {
|
} else if (strcmp(func_name, "zoom") == 0) {
|
||||||
func = zoom;
|
func = zoom;
|
||||||
} else if (strcmp(func_name, "exchange_client") == 0) {
|
} else if (strcmp(func_name, "exchange_client") == 0) {
|
||||||
@@ -1167,6 +1171,8 @@ void parse_option(Config *config, char *key, char *value) {
|
|||||||
config->scroller_prefer_center = atoi(value);
|
config->scroller_prefer_center = atoi(value);
|
||||||
} else if (strcmp(key, "edge_scroller_pointer_focus") == 0) {
|
} else if (strcmp(key, "edge_scroller_pointer_focus") == 0) {
|
||||||
config->edge_scroller_pointer_focus = atoi(value);
|
config->edge_scroller_pointer_focus = atoi(value);
|
||||||
|
} else if (strcmp(key, "dual_scroller_default_split_ratio") == 0) {
|
||||||
|
config->dual_scroller_default_split_ratio = atof(value);
|
||||||
} else if (strcmp(key, "focus_cross_monitor") == 0) {
|
} else if (strcmp(key, "focus_cross_monitor") == 0) {
|
||||||
config->focus_cross_monitor = atoi(value);
|
config->focus_cross_monitor = atoi(value);
|
||||||
} else if (strcmp(key, "exchange_cross_monitor") == 0) {
|
} else if (strcmp(key, "exchange_cross_monitor") == 0) {
|
||||||
@@ -2634,6 +2640,8 @@ void override_config(void) {
|
|||||||
edge_scroller_pointer_focus =
|
edge_scroller_pointer_focus =
|
||||||
CLAMP_INT(config.edge_scroller_pointer_focus, 0, 1);
|
CLAMP_INT(config.edge_scroller_pointer_focus, 0, 1);
|
||||||
scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000);
|
scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000);
|
||||||
|
dual_scroller_default_split_ratio =
|
||||||
|
CLAMP_FLOAT(config.dual_scroller_default_split_ratio, 0.1f, 0.9f);
|
||||||
|
|
||||||
// 主从布局设置
|
// 主从布局设置
|
||||||
default_mfact = CLAMP_FLOAT(config.default_mfact, 0.1f, 0.9f);
|
default_mfact = CLAMP_FLOAT(config.default_mfact, 0.1f, 0.9f);
|
||||||
@@ -2822,6 +2830,7 @@ void set_value_default() {
|
|||||||
config.scroller_focus_center = scroller_focus_center;
|
config.scroller_focus_center = scroller_focus_center;
|
||||||
config.scroller_prefer_center = scroller_prefer_center;
|
config.scroller_prefer_center = scroller_prefer_center;
|
||||||
config.edge_scroller_pointer_focus = edge_scroller_pointer_focus;
|
config.edge_scroller_pointer_focus = edge_scroller_pointer_focus;
|
||||||
|
config.dual_scroller_default_split_ratio = dual_scroller_default_split_ratio;
|
||||||
config.focus_cross_monitor = focus_cross_monitor;
|
config.focus_cross_monitor = focus_cross_monitor;
|
||||||
config.exchange_cross_monitor = exchange_cross_monitor;
|
config.exchange_cross_monitor = exchange_cross_monitor;
|
||||||
config.scratchpad_cross_monitor = scratchpad_cross_monitor;
|
config.scratchpad_cross_monitor = scratchpad_cross_monitor;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ float scroller_default_proportion_single = 1.0;
|
|||||||
int scroller_ignore_proportion_single = 0;
|
int scroller_ignore_proportion_single = 0;
|
||||||
int scroller_focus_center = 0;
|
int scroller_focus_center = 0;
|
||||||
int scroller_prefer_center = 0;
|
int scroller_prefer_center = 0;
|
||||||
|
float dual_scroller_default_split_ratio = 0.3;
|
||||||
int focus_cross_monitor = 0;
|
int focus_cross_monitor = 0;
|
||||||
int focus_cross_tag = 0;
|
int focus_cross_tag = 0;
|
||||||
int exchange_cross_monitor = 0;
|
int exchange_cross_monitor = 0;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ int switch_keyboard_layout(const Arg *arg);
|
|||||||
int setlayout(const Arg *arg);
|
int setlayout(const Arg *arg);
|
||||||
int switch_layout(const Arg *arg);
|
int switch_layout(const Arg *arg);
|
||||||
int setmfact(const Arg *arg);
|
int setmfact(const Arg *arg);
|
||||||
|
int adjust_dual_scroller_split(const Arg *arg);
|
||||||
int quit(const Arg *arg);
|
int quit(const Arg *arg);
|
||||||
int moveresize(const Arg *arg);
|
int moveresize(const Arg *arg);
|
||||||
int exchange_client(const Arg *arg);
|
int exchange_client(const Arg *arg);
|
||||||
|
|||||||
@@ -326,6 +326,28 @@ int setmfact(const Arg *arg) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int adjust_dual_scroller_split(const Arg *arg) {
|
||||||
|
float new_ratio;
|
||||||
|
|
||||||
|
if (!arg || !selmon)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Check if we're in a dual-scroller layout
|
||||||
|
if (!is_row_layout(selmon))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Calculate new ratio: if arg->f < 1.0, treat as relative adjustment, otherwise as absolute value
|
||||||
|
new_ratio = arg->f < 1.0 ? dual_scroller_default_split_ratio + arg->f : arg->f - 1.0;
|
||||||
|
|
||||||
|
// Clamp the ratio between 0.1 and 0.9
|
||||||
|
if (new_ratio < 0.1 || new_ratio > 0.9)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dual_scroller_default_split_ratio = new_ratio;
|
||||||
|
arrange(selmon, false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int killclient(const Arg *arg) {
|
int killclient(const Arg *arg) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
c = selmon->sel;
|
c = selmon->sel;
|
||||||
|
|||||||
@@ -455,8 +455,8 @@ void dual_scroller(Monitor *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate row heights (30% top, 70% bottom)
|
// Calculate row heights using configurable split ratio
|
||||||
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * 0.3);
|
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * dual_scroller_default_split_ratio);
|
||||||
unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height;
|
unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height;
|
||||||
unsigned int top_row_y = m->w.y + cur_gappov;
|
unsigned int top_row_y = m->w.y + cur_gappov;
|
||||||
unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv;
|
unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv;
|
||||||
|
|||||||
Reference in New Issue
Block a user