feat: add option scroller_default_proportion_single

This commit is contained in:
DreamMaoMao 2025-04-06 22:05:46 +08:00
parent 04e16876e2
commit a2d216300e
4 changed files with 8 additions and 1 deletions

View file

@ -20,6 +20,7 @@ scroller_structs=20
scroller_default_proportion=0.8
scroller_focus_center=0
scroller_prefer_center=0
scroller_default_proportion_single=1.0
scroller_proportion_preset=0.5,0.8,1.0
# Master-Stack Layout Setting (tile,spiral,dwindle)

View file

@ -5969,7 +5969,7 @@ void scroller(Monitor *m, unsigned int gappo, unsigned int gappi) {
if (n == 1) {
c = tempClients[0];
target_geom.height = m->w.height - 2 * gappov;
target_geom.width = max_client_width * c->scroller_proportion;
target_geom.width = (m->w.width - 2 * gappoh) * scroller_default_proportion_single;
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
resize(c, target_geom, 0);

View file

@ -102,6 +102,7 @@ typedef struct {
int scroller_structs;
float scroller_default_proportion;
float scroller_default_proportion_single;
int scroller_focus_center;
int scroller_prefer_center;
int focus_cross_monitor;
@ -552,6 +553,8 @@ void parse_config_line(Config *config, const char *line) {
config->scroller_structs = atoi(value);
} else if (strcmp(key, "scroller_default_proportion") == 0) {
config->scroller_default_proportion = atof(value);
} else if (strcmp(key, "scroller_default_proportion_single") == 0) {
config->scroller_default_proportion_single = atof(value);
} else if (strcmp(key, "scroller_focus_center") == 0) {
config->scroller_focus_center = atoi(value);
} else if (strcmp(key, "scroller_prefer_center") == 0) {
@ -1187,6 +1190,7 @@ void override_config(void) {
scroller_structs = config.scroller_structs;
scroller_default_proportion = config.scroller_default_proportion;
scroller_default_proportion_single = config.scroller_default_proportion_single;
scroller_focus_center = config.scroller_focus_center;
focus_cross_monitor = config.focus_cross_monitor;
swipe_min_threshold = config.swipe_min_threshold;
@ -1269,6 +1273,7 @@ void set_value_default() {
config.scroller_structs = scroller_structs;
config.scroller_default_proportion = scroller_default_proportion;
config.scroller_default_proportion_single = scroller_default_proportion_single;
config.scroller_focus_center = scroller_focus_center;
config.scroller_prefer_center = scroller_prefer_center;
config.focus_cross_monitor = focus_cross_monitor;

View file

@ -45,6 +45,7 @@ unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
int scroller_structs = 20;
float scroller_default_proportion = 0.9;
float scroller_default_proportion_single = 1.0;
int scroller_focus_center = 0;
int scroller_prefer_center = 0;
int focus_cross_monitor = 0;