Merge branch 'master' of ssh://git.jonathanh.co.uk:2222/jab2870/dwm

master
Jonathan Hodgson 3 years ago
commit cb0a34b6b8
  1. 13
      config.def.h
  2. 21
      dwm.c

@ -124,8 +124,11 @@ static const char *brightnessDown[] = { "brightness", "down", NULL };
static const char *setBackgroundRandom[] = { "rofi-background", "--earth", NULL }; static const char *setBackgroundRandom[] = { "rofi-background", "--earth", NULL };
static const char *backgroundDetails[] = { "background", "--only-notify", NULL }; static const char *backgroundDetails[] = { "background", "--only-notify", NULL };
static const char *lockScreen[] = { "screenlock", "--suspend", NULL };
static const char *powerMenu[] = { "rofi-shutdown", NULL }; static const char *powerMenu[] = { "rofi-shutdown", NULL };
static const char *toggleKeyboard[] = { "toggleKeyboard", NULL };
#include "movestack.c" #include "movestack.c"
#define MULTIKEY_THRESHOLD_MS_PRESS 200 #define MULTIKEY_THRESHOLD_MS_PRESS 200
@ -195,11 +198,15 @@ static Key keys[] = {
{ 0, XF86XK_AudioMute, 0, spawn, {.v = volumeToggle } }, { 0, XF86XK_AudioMute, 0, spawn, {.v = volumeToggle } },
{ 0, XF86XK_MonBrightnessUp, 0, spawn, {.v = brightnessUp } }, { 0, XF86XK_MonBrightnessUp, 0, spawn, {.v = brightnessUp } },
{ 0, XF86XK_MonBrightnessDown, 0, spawn, {.v = brightnessDown } }, { 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. // 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 bring up the power menu // I want a double press to toggle the keyboard
// I want a hold press to bring up the power menu
// TODO: Make a command for screen lock // TODO: Make a command for screen lock
//{ 0, XF86XK_PowerOff, 1, spawn, {.v = <This will be a screen lock command> } }, { 0, XF86XK_PowerOff, 1, spawn, {.v = lockScreen } },
{ 0, XF86XK_PowerOff, 2, spawn, {.v = powerMenu } }, { 0, XF86XK_PowerOff, 2, spawn, {.v = toggleKeyboard } },
{ 0, XF86XK_PowerOff, 3, spawn, {.v = powerMenu } },
{ MODKEY|ShiftMask, XK_r, 0, quit, {0} }, { MODKEY|ShiftMask, XK_r, 0, quit, {0} },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)

21
dwm.c

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

Loading…
Cancel
Save