Adds win+left or win+right to switch tag

This involved the patch from here:

https://lists.suckless.org/dev/1104/7590.html

I use this on the pinephone with win+left and win+right bound to a swipe
left or right on the bottom edge of the screen
master
Jonathan Hodgson 3 years ago
parent 3dbeed51c5
commit 730577a008
  1. 2
      config.def.h
  2. 21
      dwm.c

@ -195,6 +195,8 @@ static Key keys[] = {
{ 0, XF86XK_AudioMute, 0, spawn, {.v = volumeToggle } },
{ 0, XF86XK_MonBrightnessUp, 0, spawn, {.v = brightnessUp } },
{ 0, XF86XK_MonBrightnessDown, 0, spawn, {.v = brightnessDown } },
{ MODKEY, XK_Right, 0, shiftview, {.i = 1 } },
{ MODKEY, XK_Left, 0, shiftview, {.i = -1 } },
// On the pinephone, I want a single press of the power button to put the phone in sleep mode.
// I want a double press to toggle the keyboard
// I want a hold press to bring up the power menu

21
dwm.c

@ -221,6 +221,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
static void shiftview(const Arg *arg);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
@ -1873,6 +1874,26 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
/** 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);
}
void
showhide(Client *c)
{

Loading…
Cancel
Save