add togglewarp function

This commit is contained in:
Alexander Bocken 2021-10-02 17:12:03 +02:00
parent 89d2cee6fa
commit 3cf9f6f915
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
2 changed files with 22 additions and 7 deletions

View File

@ -3,6 +3,7 @@
/* appearance */ /* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int borderfloatpx = 2; /* border pixel of windows which are floating; seems not correctly implemented yet! window freezes if toggled to floating if different to borderpx*/ static const unsigned int borderfloatpx = 2; /* border pixel of windows which are floating; seems not correctly implemented yet! window freezes if toggled to floating if different to borderpx*/
static int dowarp = 1; /* default behaviour of mouse. Can be chaned via calling togglewarp*/
static const unsigned int snap = 10; /* snap pixel */ static const unsigned int snap = 10; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
@ -144,10 +145,11 @@ static Key keys[] = {
/* { MODKEY|ShiftMask, XK_q, spawn, SHCMD("") }, */ /* { MODKEY|ShiftMask, XK_q, spawn, SHCMD("") }, */
{ MODKEY, XK_w, spawn, SHCMD("$BROWSER") }, { MODKEY, XK_w, spawn, SHCMD("$BROWSER") },
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("chromium") }, /*using ungoogled-chromium as backup browser*/ { MODKEY|ShiftMask, XK_w, spawn, SHCMD("chromium") }, /*using ungoogled-chromium as backup browser*/
{ MODKEY|ShiftMask|ControlMask, XK_w, togglewarp, {0} },
{ MODKEY, XK_e, spawn, SHCMD("st -e neomutt -e 'set sidebar_visible = no'; pkill -RTMIN+13 dwmblocks") }, { MODKEY, XK_e, spawn, SHCMD("st -e neomutt -e 'set sidebar_visible = no'; pkill -RTMIN+13 dwmblocks") },
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD("st -e weechat") }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD("element-desktop") },
{ MODKEY, XK_r, spawn, SHCMD("st -e $FILE") }, { MODKEY, XK_r, spawn, SHCMD("st -e $FILE") },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("st -e lf") }, { MODKEY|ShiftMask, XK_r, spawn, SHCMD("element-desktop --profile alpenrunde") },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_y, setlayout, {.v = &layouts[2]} },
@ -247,7 +249,7 @@ static Key keys[] = {
{ MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill") }, { MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill") },
{ MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") }, { MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") },
{ 0, XF86XK_AudioMute, spawn, SHCMD("lmc mute; pkill -RTMIN+10 dwmblocks") }, { 0, XF86XK_AudioMute, spawn, SHCMD("lmc toggle; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("lmc up 5; pkill -RTMIN+10 dwmblocks") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("lmc up 5; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("lmc down 5; pkill -RTMIN+10 dwmblocks") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("lmc down 5; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioPrev, spawn, SHCMD("mpc prev") }, { 0, XF86XK_AudioPrev, spawn, SHCMD("mpc prev") },
@ -272,10 +274,10 @@ static Key keys[] = {
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1") }, { 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1") },
{ 0, XF86XK_TouchpadOff, spawn, SHCMD("synclient TouchpadOff=1") }, { 0, XF86XK_TouchpadOff, spawn, SHCMD("synclient TouchpadOff=1") },
{ 0, XF86XK_TouchpadOn, spawn, SHCMD("synclient TouchpadOff=0") }, { 0, XF86XK_TouchpadOn, spawn, SHCMD("synclient TouchpadOff=0") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 5; pkill -RTMIN+2 dwmblocks") }, { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("bright inc 5; pkill -RTMIN+2 dwmblocks") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 5; pkill -RTMIN+2 dwmblocks") }, { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("bright dec 5; pkill -RTMIN+2 dwmblocks") },
{ ShiftMask, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -set 1; pkill -RTMIN+2 dwmblocks") }, { ShiftMask, XF86XK_MonBrightnessDown, spawn, SHCMD("bright set 1; pkill -RTMIN+2 dwmblocks") },
{ ShiftMask, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -set 100; pkill -RTMIN+2 dwmblocks") }, { ShiftMask, XF86XK_MonBrightnessUp, spawn, SHCMD("bright set 100; pkill -RTMIN+2 dwmblocks") },
}; };
@ -295,3 +297,4 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} },
}; };

12
dwm.c
View File

@ -226,6 +226,7 @@ static void togglefullscr(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void togglesticky(const Arg *arg); static void togglesticky(const Arg *arg);
static void togglewarp(const Arg *arg);
static void unfocus(Client *c, int setfocus); static void unfocus(Client *c, int setfocus);
static void unmanage(Client *c, int destroyed); static void unmanage(Client *c, int destroyed);
static void unmapnotify(XEvent *e); static void unmapnotify(XEvent *e);
@ -290,6 +291,7 @@ static Drw *drw;
static Monitor *mons, *selmon; static Monitor *mons, *selmon;
static Window root, wmcheckwin; static Window root, wmcheckwin;
/* configuration, allows nested code to access above variables */ /* configuration, allows nested code to access above variables */
#include "config.h" #include "config.h"
@ -1865,6 +1867,13 @@ togglesticky(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
void togglewarp(const Arg *arg){
if (dowarp)
dowarp=0;
else
dowarp=1;
}
void void
setsticky(const Arg *arg) setsticky(const Arg *arg)
{ {
@ -2230,6 +2239,8 @@ view(const Arg *arg)
void void
warp(const Client *c) warp(const Client *c)
{ {
if (!dowarp)
return;
int x, y; int x, y;
if (!c) { if (!c) {
@ -2648,3 +2659,4 @@ void
spiral(Monitor *mon) { spiral(Monitor *mon) {
fibonacci(mon, 0); fibonacci(mon, 0);
} }