Adding focusadjacenttag patch

This commit is contained in:
bakkeby
2019-10-02 23:57:25 +02:00
parent 0a23ed6efd
commit 1f21ed72d1
7 changed files with 107 additions and 1 deletions

73
patch/focusadjacenttag.c Normal file
View File

@@ -0,0 +1,73 @@
void
tagtoleft(const Arg *arg)
{
if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
focus(NULL);
arrange(selmon);
}
}
void
tagtoright(const Arg *arg)
{
if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoleft(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoright(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(NULL);
arrange(selmon);
}
}
void
tagandviewtoleft(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(selmon->sel);
arrange(selmon);
}
}
void
tagandviewtoright(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(selmon->sel);
arrange(selmon);
}
}

6
patch/focusadjacenttag.h Normal file
View File

@@ -0,0 +1,6 @@
static void tagtoleft(const Arg *arg);
static void tagtoright(const Arg *arg);
static void viewtoleft(const Arg *arg);
static void viewtoright(const Arg *arg);
static void tagandviewtoleft(const Arg *arg);
static void tagandviewtoright(const Arg *arg);

View File

@@ -36,6 +36,10 @@
#include "ewmhtags.c"
#endif
#if FOCUSADJACENTTAG_PATCH
#include "focusadjacenttag.c"
#endif
#if FULLSCREEN_PATCH
#include "fullscreen.c"
#endif

View File

@@ -36,6 +36,10 @@
#include "ewmhtags.h"
#endif
#if FOCUSADJACENTTAG_PATCH
#include "focusadjacenttag.h"
#endif
#if FULLSCREEN_PATCH
#include "fullscreen.h"
#endif