Compare commits

..

3 Commits

2 changed files with 61 additions and 10 deletions

54
aji.c Normal file
View File

@ -0,0 +1,54 @@
void
cyclelayout(const Arg *arg) {
Layout *next;
for (next = (Layout *)layouts; next != selmon->lt[selmon->sellt]; next++);
if ((++next - layouts) >= LENGTH(layouts))
next = (Layout *)layouts;
setlayout(&(Arg) { .v = next });
}
/** Function to shift the current view to the left/right
*
* @param: "arg->i" stores the number of tags to shift right (positive value)
* or left (negative value)
*/
void
shifttag(const Arg *arg) {
if(selmon->sel){
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
selmon->sel->tags = shifted.ui & TAGMASK;
arrange(selmon);
view(&shifted);
}
}
/** Function to shift the current view to the left/right
*
* @param: "arg->i" stores the number of tags to shift right (positive value)
* or left (negative value)
*/
void
shiftview(const Arg *arg) {
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
view(&shifted);
}

View File

@ -49,11 +49,11 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */ static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
{ " Tiles ", tile }, /* first entry is default */ { "[]=", tile }, /* first entry is default */
{ " Float ", NULL }, /* no layout function means floating behavior */ { "><>", NULL }, /* no layout function means floating behavior */
{ " Monocle", monocle }, { "[M]", monocle },
}; };
/* key definitions */ /* key definitions */
@ -102,15 +102,10 @@ static const char *nmcedit[] = { "nm-connection-editor" , NULL };
static const char *top[] = { "kitty" , "htop" , NULL }; static const char *top[] = { "kitty" , "htop" , NULL };
#include "shift-tools.c" #include "aji.c"
static const Key keys[] = { static const Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_BackSpace, view, {0} }, { MODKEY, XK_BackSpace, view, {0} },
{ MODKEY, XK_a, view, {.ui = ~0} }, // Select all tags. Cancel it with `MODKEY + [tag key]`. { MODKEY, XK_a, view, {.ui = ~0} }, // Select all tags. Cancel it with `MODKEY + [tag key]`.
{ MODKEY|Mod1Mask, XK_p, tag, {.ui = ~0} }, // Pin current window to all tags. Cancel it with `MODKEY + Shift + [tag key]`. { MODKEY|Mod1Mask, XK_p, tag, {.ui = ~0} }, // Pin current window to all tags. Cancel it with `MODKEY + Shift + [tag key]`.
@ -148,6 +143,8 @@ static const Key keys[] = {
{ MODKEY|ControlMask|ShiftMask, XK_Left, shifttag, {.i = -1} }, { MODKEY|ControlMask|ShiftMask, XK_Left, shifttag, {.i = -1} },
{ MODKEY|ControlMask|ShiftMask, XK_Right, shifttag, {.i = +1} }, { MODKEY|ControlMask|ShiftMask, XK_Right, shifttag, {.i = +1} },
{ MODKEY|Mod1Mask, XK_v, cyclelayout, {0} },
{ MODKEY, XK_w, killclient, {0} }, { MODKEY, XK_w, killclient, {0} },
{ MODKEY|ShiftMask, XK_q, quit, {0} }, { MODKEY|ShiftMask, XK_q, quit, {0} },