mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding focusadjacenttag patch
This commit is contained in:
parent
0a23ed6efd
commit
1f21ed72d1
@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2019-10-02 - Added restartsig and emptyview patch
|
||||
2019-10-02 - Added restartsig, emptyview and focusadjacenttag patches
|
||||
|
||||
2019-10-01 - Added leftlayout, fullscreen, holdbar and unfloatvisible patches
|
||||
|
||||
@ -101,6 +101,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [floatbordercolor](https://dwm.suckless.org/patches/float_border_color/)
|
||||
- this patch allows a different border color to be chosen for floating windows
|
||||
|
||||
- [focusadjacenttag](https://dwm.suckless.org/patches/focusadjacenttag/)
|
||||
- provides the ability to focus the tag on the immediate left or right of the currently focused tag
|
||||
- it also allows to send the focused window either on the left or the right tag
|
||||
|
||||
- [focusonclick](https://dwm.suckless.org/patches/focusonclick/)
|
||||
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse pointer)
|
||||
|
||||
|
@ -398,6 +398,14 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
#if FOCUSADJACENTTAG_PATCH
|
||||
{ MODKEY, XK_Left, viewtoleft, {0} },
|
||||
{ MODKEY, XK_Right, viewtoright, {0} },
|
||||
{ MODKEY|ShiftMask, XK_Left, tagtoleft, {0} },
|
||||
{ MODKEY|ShiftMask, XK_Right, tagtoright, {0} },
|
||||
{ MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} },
|
||||
{ MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} },
|
||||
#endif // FOCUSADJACENTTAG_PATCH
|
||||
#if TAGALLMON_PATCH
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
|
||||
|
73
patch/focusadjacenttag.c
Normal file
73
patch/focusadjacenttag.c
Normal 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
6
patch/focusadjacenttag.h
Normal 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);
|
@ -36,6 +36,10 @@
|
||||
#include "ewmhtags.c"
|
||||
#endif
|
||||
|
||||
#if FOCUSADJACENTTAG_PATCH
|
||||
#include "focusadjacenttag.c"
|
||||
#endif
|
||||
|
||||
#if FULLSCREEN_PATCH
|
||||
#include "fullscreen.c"
|
||||
#endif
|
||||
|
@ -36,6 +36,10 @@
|
||||
#include "ewmhtags.h"
|
||||
#endif
|
||||
|
||||
#if FOCUSADJACENTTAG_PATCH
|
||||
#include "focusadjacenttag.h"
|
||||
#endif
|
||||
|
||||
#if FULLSCREEN_PATCH
|
||||
#include "fullscreen.h"
|
||||
#endif
|
||||
|
@ -132,6 +132,13 @@
|
||||
*/
|
||||
#define FANCYBAR_PATCH 0
|
||||
|
||||
/* This patch provides the ability to focus the tag on the immediate left or right of the
|
||||
* currently focused tag. It also allows to send the focused window either on the left or
|
||||
* the right tag.
|
||||
* http://dwm.suckless.org/patches/focusadjacenttag/
|
||||
*/
|
||||
#define FOCUSADJACENTTAG_PATCH 1
|
||||
|
||||
/* Switch focus only by mouse click and not sloppy (focus follows mouse pointer).
|
||||
* https://dwm.suckless.org/patches/focusonclick/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user