From 6866a4a4ea98dfced0d429e449374022b7717cce Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Thu, 25 Feb 2021 14:57:02 +0000 Subject: [PATCH 1/3] Changes functionality of power button A single push will turn off the screen A double push or a push and hold will open the power menu, allowing you to turn off, restart, logout or suspend (CRUST) --- config.def.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 7d06a2c..9d7bebf 100644 --- a/config.def.h +++ b/config.def.h @@ -122,6 +122,7 @@ static const char *brightnessDown[] = { "brightness", "down", NULL }; static const char *setBackgroundRandom[] = { "rofi-background", "--earth", NULL }; static const char *backgroundDetails[] = { "background", "--only-notify", NULL }; +static const char *lockScreen[] = { "screenlock", "--suspend", NULL }; static const char *powerMenu[] = { "rofi-shutdown", NULL }; #include "movestack.c" @@ -195,7 +196,7 @@ static Key keys[] = { // 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 // TODO: Make a command for screen lock - //{ 0, XF86XK_PowerOff, 1, spawn, {.v = } }, + { 0, XF86XK_PowerOff, 1, spawn, {.v = lockScreen } }, { 0, XF86XK_PowerOff, 2, spawn, {.v = powerMenu } }, { MODKEY|ShiftMask, XK_r, 0, quit, {0} }, From 3dbeed51c5ce7da3ec87c1c231eea0a9e3b1356d Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 31 Mar 2021 21:22:11 +0100 Subject: [PATCH 2/3] Makes a double tap of the power button toggle the keyboard --- config.def.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 9d7bebf..95ecb05 100644 --- a/config.def.h +++ b/config.def.h @@ -125,6 +125,8 @@ 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 *toggleKeyboard[] = { "toggleKeyboard", NULL }; + #include "movestack.c" #define MULTIKEY_THRESHOLD_MS_PRESS 200 @@ -194,10 +196,12 @@ static Key keys[] = { { 0, XF86XK_MonBrightnessUp, 0, spawn, {.v = brightnessUp } }, { 0, XF86XK_MonBrightnessDown, 0, spawn, {.v = brightnessDown } }, // 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 { 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} }, TAGKEYS( XK_1, 0) From 730577a008411e79c6748e0b0bda4db9540aa3ec Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 5 Apr 2021 09:26:18 +0100 Subject: [PATCH 3/3] 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 --- config.def.h | 2 ++ dwm.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/config.def.h b/config.def.h index 95ecb05..d74e84f 100644 --- a/config.def.h +++ b/config.def.h @@ -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 diff --git a/dwm.c b/dwm.c index cd1419b..34a8a60 100644 --- a/dwm.c +++ b/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) {