diff options
| author | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
|---|---|---|
| committer | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
| commit | 8cbadb61604667b407b53ee1258433994fa4765a (patch) | |
| tree | 97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwm/patch/focusadjacenttag.c | |
Diffstat (limited to 'dwm/patch/focusadjacenttag.c')
| -rwxr-xr-x | dwm/patch/focusadjacenttag.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dwm/patch/focusadjacenttag.c b/dwm/patch/focusadjacenttag.c new file mode 100755 index 0000000..f0244a2 --- /dev/null +++ b/dwm/patch/focusadjacenttag.c @@ -0,0 +1,69 @@ +void +tagtoleft(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] > 1) { + selmon->sel->tags >>= 1; + arrange(selmon); + focus(NULL); + } +} + +void +tagtoright(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] & (MASK >> 1)) { + selmon->sel->tags <<= 1; + arrange(selmon); + focus(NULL); + } +} + +void +viewtoleft(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] > 1) { + view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); + } +} + +void +viewtoright(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] & (MASK >> 1)) { + view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); + } +} + +void +tagandviewtoleft(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] > 1) { + selmon->sel->tags >>= 1; + view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); + } +} + +void +tagandviewtoright(const Arg *arg) +{ + unsigned int MASK = (1 << NUMTAGS) - 1; + if (selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 + && selmon->tagset[selmon->seltags] & (MASK >> 1)) { + selmon->sel->tags <<= 1; + view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); + } +} |
