mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
Merge 5f88f7f803 into b9c6a2c196
This commit is contained in:
commit
bb66239d64
4 changed files with 57 additions and 16 deletions
|
|
@ -126,7 +126,9 @@ bindr=Super,Super_L,spawn,rofi -show run
|
||||||
| `tag` | `1-9 [,synctag]` | Move window to tag. Optional `synctag` (0/1) syncs to all monitors. |
|
| `tag` | `1-9 [,synctag]` | Move window to tag. Optional `synctag` (0/1) syncs to all monitors. |
|
||||||
| `tagsilent` | `1-9` | Move window to tag without focusing it. |
|
| `tagsilent` | `1-9` | Move window to tag without focusing it. |
|
||||||
| `tagtoleft` | `[synctag]` | Move window to left tag. Optional `synctag` (0/1). |
|
| `tagtoleft` | `[synctag]` | Move window to left tag. Optional `synctag` (0/1). |
|
||||||
|
| `tagtoleftsilent` | `[synctag]` | Move window to left tag without focusing it. Optional `synctag` (0/1). |
|
||||||
| `tagtoright` | `[synctag]` | Move window to right tag. Optional `synctag` (0/1). |
|
| `tagtoright` | `[synctag]` | Move window to right tag. Optional `synctag` (0/1). |
|
||||||
|
| `tagtorightsilent` | `[synctag]` | Move window to right tag without focusing it. Optional `synctag` (0/1). |
|
||||||
| `tagcrossmon` | `tag,monitor_spec` | Move window to specified tag on specified monitor. |
|
| `tagcrossmon` | `tag,monitor_spec` | Move window to specified tag on specified monitor. |
|
||||||
| `toggletag` | `0-9` | Toggle tag on window (0 means all tags). |
|
| `toggletag` | `0-9` | Toggle tag on window (0 means all tags). |
|
||||||
| `toggleview` | `1-9` | Toggle tag view. |
|
| `toggleview` | `1-9` | Toggle tag view. |
|
||||||
|
|
|
||||||
|
|
@ -978,9 +978,15 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||||
} else if (strcmp(func_name, "tagtoleft") == 0) {
|
} else if (strcmp(func_name, "tagtoleft") == 0) {
|
||||||
func = tagtoleft;
|
func = tagtoleft;
|
||||||
(*arg).i = atoi(arg_value);
|
(*arg).i = atoi(arg_value);
|
||||||
|
} else if (strcmp(func_name, "tagtoleftsilent") == 0) {
|
||||||
|
func = tagtoleftsilent;
|
||||||
|
(*arg).i = atoi(arg_value);
|
||||||
} else if (strcmp(func_name, "tagtoright") == 0) {
|
} else if (strcmp(func_name, "tagtoright") == 0) {
|
||||||
func = tagtoright;
|
func = tagtoright;
|
||||||
(*arg).i = atoi(arg_value);
|
(*arg).i = atoi(arg_value);
|
||||||
|
} else if (strcmp(func_name, "tagtorightsilent") == 0) {
|
||||||
|
func = tagtorightsilent;
|
||||||
|
(*arg).i = atoi(arg_value);
|
||||||
} else if (strcmp(func_name, "killclient") == 0) {
|
} else if (strcmp(func_name, "killclient") == 0) {
|
||||||
func = killclient;
|
func = killclient;
|
||||||
} else if (strcmp(func_name, "centerwin") == 0) {
|
} else if (strcmp(func_name, "centerwin") == 0) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ int32_t switch_proportion_preset(const Arg *arg);
|
||||||
int32_t zoom(const Arg *arg);
|
int32_t zoom(const Arg *arg);
|
||||||
int32_t tagsilent(const Arg *arg);
|
int32_t tagsilent(const Arg *arg);
|
||||||
int32_t tagtoleft(const Arg *arg);
|
int32_t tagtoleft(const Arg *arg);
|
||||||
|
int32_t tagtoleftsilent(const Arg *arg);
|
||||||
int32_t tagtoright(const Arg *arg);
|
int32_t tagtoright(const Arg *arg);
|
||||||
|
int32_t tagtorightsilent(const Arg *arg);
|
||||||
int32_t tagcrossmon(const Arg *arg);
|
int32_t tagcrossmon(const Arg *arg);
|
||||||
int32_t viewtoleft(const Arg *arg);
|
int32_t viewtoleft(const Arg *arg);
|
||||||
int32_t viewtoright(const Arg *arg);
|
int32_t viewtoright(const Arg *arg);
|
||||||
|
|
|
||||||
|
|
@ -1193,28 +1193,51 @@ int32_t tagsilent(const Arg *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tagtoleft(const Arg *arg) {
|
int32_t tagtoside_general(const Arg *arg, bool silent, bool left) {
|
||||||
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 (left) {
|
||||||
|
if (target & 1) {
|
||||||
|
// 1 wraps around to 9
|
||||||
|
target |= 1 << LENGTH(tags);
|
||||||
|
}
|
||||||
|
target >>= 1;
|
||||||
|
} else {
|
||||||
|
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 tagtoleft(const Arg *arg) {
|
||||||
if (!selmon)
|
return tagtoside_general(arg, false, true);
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
if (selmon->sel != NULL &&
|
int32_t tagtoleftsilent(const Arg *arg) {
|
||||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
return tagtoside_general(arg, true, true);
|
||||||
selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
}
|
||||||
tag(&(Arg){.ui = selmon->tagset[selmon->seltags] << 1, .i = arg->i});
|
|
||||||
}
|
int32_t tagtoright(const Arg *arg) {
|
||||||
return 0;
|
return tagtoside_general(arg, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tagtorightsilent(const Arg *arg) {
|
||||||
|
return tagtoside_general(arg, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t toggle_named_scratchpad(const Arg *arg) {
|
int32_t toggle_named_scratchpad(const Arg *arg) {
|
||||||
|
|
@ -1457,12 +1480,15 @@ 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];
|
||||||
|
|
||||||
|
if (target & 1) {
|
||||||
|
// 1 wraps around to 9
|
||||||
|
target |= 1 << LENGTH(tags);
|
||||||
|
}
|
||||||
target >>= 1;
|
target >>= 1;
|
||||||
|
|
||||||
if (target == 0) {
|
if (target == 0) {
|
||||||
|
|
@ -1484,12 +1510,17 @@ int32_t viewtoright(const Arg *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t target = selmon->tagset[selmon->seltags];
|
uint32_t target = selmon->tagset[selmon->seltags];
|
||||||
|
|
||||||
target <<= 1;
|
target <<= 1;
|
||||||
|
if (target & 1 << LENGTH(tags)) {
|
||||||
|
// 9 wraps around to 1
|
||||||
|
target |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!selmon || (target) == selmon->tagset[selmon->seltags])
|
if (!selmon || (target) == selmon->tagset[selmon->seltags])
|
||||||
return 0;
|
return 0;
|
||||||
if (!(target & TAGMASK)) {
|
if (!(target & TAGMASK)) {
|
||||||
return 0;
|
target = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
view(&(Arg){.ui = target & TAGMASK, .i = arg->i}, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue