From f6796a79f59c0a78ca1bf6e873cce7be7d98f778 Mon Sep 17 00:00:00 2001 From: DarthMooMancer Date: Sat, 6 Sep 2025 18:32:36 -0400 Subject: [PATCH] patch: removed snap and just made it 0 for floating windows --- .config/suckless/dwm/Makefile | 1 - .config/suckless/dwm/config.h | 5 +---- .config/suckless/dwm/dwm.c | 37 ++--------------------------------- 3 files changed, 3 insertions(+), 40 deletions(-) diff --git a/.config/suckless/dwm/Makefile b/.config/suckless/dwm/Makefile index 02720c7..f2bc0f9 100644 --- a/.config/suckless/dwm/Makefile +++ b/.config/suckless/dwm/Makefile @@ -10,7 +10,6 @@ INCS = -I${X11INC} -I${FREETYPEINC} LIBS = -L${X11LIB} -lX11 ${FREETYPELIBS} CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} diff --git a/.config/suckless/dwm/config.h b/.config/suckless/dwm/config.h index e47ceb1..f2adf60 100644 --- a/.config/suckless/dwm/config.h +++ b/.config/suckless/dwm/config.h @@ -1,6 +1,5 @@ static const unsigned int borderpx = 2; static const unsigned int gappx = 5; -static const unsigned int snap = 32; static const int showbar = 1; static const int topbar = 1; @@ -38,7 +37,7 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } static char dmenumon[2] = "0"; -static const char *dmenucmd[] = { "dmenu_run", NULL }; // "-m", dmenumon, NULL }; +static const char *dmenucmd[] = { "dmenu_run", NULL }; static const char *termcmd[] = { "st", NULL }; static const char *browsercmd[] = { "librewolf", NULL }; @@ -57,8 +56,6 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_Return, zoom, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh up") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh down") }, diff --git a/.config/suckless/dwm/dwm.c b/.config/suckless/dwm/dwm.c index 83146b1..1bac2a2 100644 --- a/.config/suckless/dwm/dwm.c +++ b/.config/suckless/dwm/dwm.c @@ -131,7 +131,6 @@ static Monitor *createmon(void); static void destroynotify(XEvent *e); static void detach(Client *c); static void detachstack(Client *c); -static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); static void enternotify(XEvent *e); @@ -175,7 +174,6 @@ static void seturgent(Client *c, int urg); static void showhide(Client *c); static void spawn(const Arg *arg); static void tag(const Arg *arg); -static void tagmon(const Arg *arg); static void tile(Monitor *m); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -636,21 +634,6 @@ detachstack(Client *c) } } -Monitor * -dirtomon(int dir) -{ - Monitor *m = NULL; - - if (dir > 0) { - if (!(m = selmon->next)) - m = mons; - } else if (selmon == mons) - for (m = mons; m->next; m = m->next); - else - for (m = mons; m->next != selmon; m = m->next); - return m; -} - void drawbar(Monitor *m) { @@ -1095,16 +1078,8 @@ movemouse(const Arg *arg) nx = ocx + (ev.xmotion.x - x); ny = ocy + (ev.xmotion.y - y); - if (abs(selmon->wx - nx) < snap) - nx = selmon->wx; - else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) - nx = selmon->wx + selmon->ww - WIDTH(c); - if (abs(selmon->wy - ny) < snap) - ny = selmon->wy; - else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) - ny = selmon->wy + selmon->wh - HEIGHT(c); if (!c->isfloating && selmon->lt[selmon->sellt]->arrange - && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) + && (abs(nx - c->x) > 0 || abs(ny - c->y) > 0)) togglefloating(NULL); if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) resize(c, nx, ny, c->w, c->h, 1); @@ -1253,7 +1228,7 @@ resizemouse(const Arg *arg) && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) { if (!c->isfloating && selmon->lt[selmon->sellt]->arrange - && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) + && (abs(nw - c->w) > 0 || abs(nh - c->h) > 0)) togglefloating(NULL); } if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) @@ -1593,14 +1568,6 @@ tag(const Arg *arg) } } -void -tagmon(const Arg *arg) -{ - if (!selmon->sel || !mons->next) - return; - sendmon(selmon->sel, dirtomon(arg->i)); -} - void tile(Monitor *m) {