mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-30 21:37:39 -04:00
feat: carousel-like behaviour when swapping tags
This commit is contained in:
parent
4be9e80355
commit
78f7ed6825
4 changed files with 57 additions and 19 deletions
|
|
@ -15,7 +15,11 @@ void set_tagin_animation(Monitor *m, Client *c) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->pertag->curtag > m->pertag->prevtag) {
|
bool going_forward = m->carousel_anim_dir
|
||||||
|
? m->carousel_anim_dir > 0
|
||||||
|
: m->pertag->curtag > m->pertag->prevtag;
|
||||||
|
|
||||||
|
if (going_forward) {
|
||||||
|
|
||||||
c->animainit_geom.x = config.tag_animation_direction == VERTICAL
|
c->animainit_geom.x = config.tag_animation_direction == VERTICAL
|
||||||
? c->animation.current.x
|
? c->animation.current.x
|
||||||
|
|
@ -76,7 +80,10 @@ void set_tagout_animation(Monitor *m, Client *c) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->pertag->curtag > m->pertag->prevtag) {
|
bool going_forward = m->carousel_anim_dir
|
||||||
|
? m->carousel_anim_dir > 0
|
||||||
|
: m->pertag->curtag > m->pertag->prevtag;
|
||||||
|
if (going_forward) {
|
||||||
c->pending = c->geom;
|
c->pending = c->geom;
|
||||||
c->pending.x =
|
c->pending.x =
|
||||||
config.tag_animation_direction == VERTICAL
|
config.tag_animation_direction == VERTICAL
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,7 @@ typedef struct {
|
||||||
uint32_t gappoh;
|
uint32_t gappoh;
|
||||||
uint32_t gappov;
|
uint32_t gappov;
|
||||||
uint32_t borderpx;
|
uint32_t borderpx;
|
||||||
|
int32_t tag_carousel;
|
||||||
float scratchpad_width_ratio;
|
float scratchpad_width_ratio;
|
||||||
float scratchpad_height_ratio;
|
float scratchpad_height_ratio;
|
||||||
float rootcolor[4];
|
float rootcolor[4];
|
||||||
|
|
@ -1737,6 +1738,8 @@ bool parse_option(Config *config, char *key, char *value) {
|
||||||
config->scratchpad_height_ratio = atof(value);
|
config->scratchpad_height_ratio = atof(value);
|
||||||
} else if (strcmp(key, "borderpx") == 0) {
|
} else if (strcmp(key, "borderpx") == 0) {
|
||||||
config->borderpx = atoi(value);
|
config->borderpx = atoi(value);
|
||||||
|
} else if (strcmp(key, "tag_carousel") == 0) {
|
||||||
|
config->tag_carousel = atoi(value);
|
||||||
} else if (strcmp(key, "rootcolor") == 0) {
|
} else if (strcmp(key, "rootcolor") == 0) {
|
||||||
int64_t color = parse_color(value);
|
int64_t color = parse_color(value);
|
||||||
if (color == -1) {
|
if (color == -1) {
|
||||||
|
|
@ -3428,6 +3431,7 @@ void set_value_default() {
|
||||||
config.idleinhibit_ignore_visible = 0;
|
config.idleinhibit_ignore_visible = 0;
|
||||||
|
|
||||||
config.borderpx = 4;
|
config.borderpx = 4;
|
||||||
|
config.tag_carousel = 0;
|
||||||
config.overviewgappi = 5;
|
config.overviewgappi = 5;
|
||||||
config.overviewgappo = 30;
|
config.overviewgappo = 30;
|
||||||
config.cursor_hide_timeout = 0;
|
config.cursor_hide_timeout = 0;
|
||||||
|
|
|
||||||
|
|
@ -1241,9 +1241,18 @@ int32_t tagtoleft(const Arg *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (selmon->sel != NULL &&
|
if (selmon->sel != NULL &&
|
||||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1) {
|
||||||
selmon->tagset[selmon->seltags] > 1) {
|
uint32_t target = selmon->tagset[selmon->seltags] >> 1;
|
||||||
tag(&(Arg){.ui = selmon->tagset[selmon->seltags] >> 1, .i = arg->i});
|
|
||||||
|
if (target == 0) {
|
||||||
|
if (!config.tag_carousel)
|
||||||
|
return 0;
|
||||||
|
target = (1 << (LENGTH(tags) - 1)) & TAGMASK;
|
||||||
|
selmon->carousel_anim_dir = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tag(&(Arg){.ui = target & TAGMASK, .i = arg->i});
|
||||||
|
selmon->carousel_anim_dir = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1253,9 +1262,18 @@ int32_t tagtoright(const Arg *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (selmon->sel != NULL &&
|
if (selmon->sel != NULL &&
|
||||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1) {
|
||||||
selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
uint32_t target = selmon->tagset[selmon->seltags] << 1;
|
||||||
tag(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1, .i = arg->i});
|
|
||||||
|
if (!(target & TAGMASK)) {
|
||||||
|
if (!config.tag_carousel)
|
||||||
|
return 0;
|
||||||
|
target = 1;
|
||||||
|
selmon->carousel_anim_dir = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tag(&(Arg){.ui = target & TAGMASK, .i = arg->i});
|
||||||
|
selmon->carousel_anim_dir = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1495,22 +1513,24 @@ int32_t viewtoleft(const Arg *arg) {
|
||||||
if (!selmon)
|
if (!selmon)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint32_t target = selmon->tagset[selmon->seltags];
|
if (selmon->isoverview || selmon->pertag->curtag == 0)
|
||||||
|
|
||||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
uint32_t target = selmon->tagset[selmon->seltags];
|
||||||
target >>= 1;
|
target >>= 1;
|
||||||
|
|
||||||
if (target == 0) {
|
if (target == 0) {
|
||||||
|
if (!config.tag_carousel)
|
||||||
return 0;
|
return 0;
|
||||||
|
target = (1 << (LENGTH(tags) - 1)) & TAGMASK;
|
||||||
|
selmon->carousel_anim_dir = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selmon || (target) == selmon->tagset[selmon->seltags])
|
if (target == selmon->tagset[selmon->seltags])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
||||||
|
selmon->carousel_anim_dir = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1518,19 +1538,24 @@ int32_t viewtoright(const Arg *arg) {
|
||||||
if (!selmon)
|
if (!selmon)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
if (selmon->isoverview || selmon->pertag->curtag == 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
uint32_t target = selmon->tagset[selmon->seltags];
|
uint32_t target = selmon->tagset[selmon->seltags];
|
||||||
target <<= 1;
|
target <<= 1;
|
||||||
|
|
||||||
if (!selmon || (target) == selmon->tagset[selmon->seltags])
|
|
||||||
return 0;
|
|
||||||
if (!(target & TAGMASK)) {
|
if (!(target & TAGMASK)) {
|
||||||
|
if (!config.tag_carousel)
|
||||||
return 0;
|
return 0;
|
||||||
|
target = 1;
|
||||||
|
selmon->carousel_anim_dir = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target == selmon->tagset[selmon->seltags])
|
||||||
|
return 0;
|
||||||
|
|
||||||
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
||||||
|
selmon->carousel_anim_dir = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -545,6 +545,7 @@ struct Monitor {
|
||||||
char last_surface_ws_name[256];
|
char last_surface_ws_name[256];
|
||||||
struct wlr_ext_workspace_group_handle_v1 *ext_group;
|
struct wlr_ext_workspace_group_handle_v1 *ext_group;
|
||||||
bool iscleanuping;
|
bool iscleanuping;
|
||||||
|
int8_t carousel_anim_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -3215,6 +3216,7 @@ void createmon(struct wl_listener *listener, void *data) {
|
||||||
m->skiping_frame = false;
|
m->skiping_frame = false;
|
||||||
m->resizing_count_pending = 0;
|
m->resizing_count_pending = 0;
|
||||||
m->resizing_count_current = 0;
|
m->resizing_count_current = 0;
|
||||||
|
m->carousel_anim_dir = 0;
|
||||||
|
|
||||||
m->wlr_output = wlr_output;
|
m->wlr_output = wlr_output;
|
||||||
m->wlr_output->data = m;
|
m->wlr_output->data = m;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue