mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
tag to left/right wrap around
This commit is contained in:
parent
1a86dc804b
commit
cd83239be4
1 changed files with 40 additions and 22 deletions
|
|
@ -1211,46 +1211,64 @@ int32_t tagsilent(const Arg *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tagtoleft(const Arg *arg) {
|
int32_t tagtoleft_general(const Arg *arg, bool silent) {
|
||||||
if (!selmon)
|
if (!selmon)
|
||||||
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) {
|
|
||||||
tag(&(Arg){.ui = selmon->tagset[selmon->seltags] >> 1, .i = arg->i});
|
uint32_t target = selmon->tagset[selmon->seltags];
|
||||||
|
if (target & 1) {
|
||||||
|
// 1 wraps around to 9
|
||||||
|
target |= 1 << LENGTH(tags);
|
||||||
|
}
|
||||||
|
target >>= 1;
|
||||||
|
|
||||||
|
if (silent)
|
||||||
|
tagsilent(&(Arg){.ui = target, .i = arg->i});
|
||||||
|
else
|
||||||
|
tag(&(Arg){.ui = target, .i = arg->i});
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tagtoleft(const Arg *arg) {
|
||||||
|
return tagtoleft_general(arg, false);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t tagtoleftsilent(const Arg *arg) {
|
int32_t tagtoleftsilent(const Arg *arg) {
|
||||||
|
return tagtoleft_general(arg, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tagtoright_general(const Arg *arg, bool silent) {
|
||||||
|
if (!selmon)
|
||||||
|
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) {
|
|
||||||
tagsilent(&(Arg){.ui = selmon->tagset[selmon->seltags] >> 1, .i = arg->i});
|
uint32_t target = selmon->tagset[selmon->seltags];
|
||||||
|
target <<= 1;
|
||||||
|
if (target & 1 << LENGTH(tags)) {
|
||||||
|
// 9 wraps around to 1
|
||||||
|
target |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (silent)
|
||||||
|
tagsilent(&(Arg){.ui = target, .i = arg->i});
|
||||||
|
else
|
||||||
|
tag(&(Arg){.ui = target, .i = arg->i});
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tagtoright(const Arg *arg) {
|
int32_t tagtoright(const Arg *arg) {
|
||||||
if (!selmon)
|
return tagtoright_general(arg, false);
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (selmon->sel != NULL &&
|
|
||||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
|
||||||
selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
|
||||||
tag(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1, .i = arg->i});
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tagtorightsilent(const Arg *arg) {
|
int32_t tagtorightsilent(const Arg *arg) {
|
||||||
if (selmon->sel != NULL &&
|
return tagtoright_general(arg, true);
|
||||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
|
||||||
selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
|
||||||
tagsilent(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1, .i = arg->i});
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t toggle_named_scratchpad(const Arg *arg) {
|
int32_t toggle_named_scratchpad(const Arg *arg) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue