added key functions, changed keybinds

This commit is contained in:
WanderingPenwing 2024-07-31 12:07:04 +02:00
parent aff74e6ff9
commit 370089549f
6 changed files with 216 additions and 2567 deletions

View file

@ -29,8 +29,8 @@ static const Rule rules[] = {
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Chromium-browser", NULL, NULL, 0, 0, -1},
{ "Jellyfin Media Player", NULL, NULL, 0, 0, -1},
{ "chromium-browser", NULL, NULL, 0, 0, -1},
{ "jellyfinmediaplayer", NULL, NULL, 0, 0, -1},
{ "calcifer", NULL, NULL, 1<<2, 0, -1},
{ "jiji", NULL, NULL, 1<<3, 0, -1},
{ "discord", NULL, NULL, 1<<3, 0, -1},
@ -70,26 +70,36 @@ static const char *screenlock[] = { "betterlockscreen", "-l", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_less, spawn, {.v = termcmd } },
{ MODKEY, XK_i, spawn, {.v = chromium } },
{ MODKEY, XK_twosuperior, spawn, {.v = screenlock } },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_f, fullscreen, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_z, incnmaster, {.i = +1 } },
{ MODKEY, XK_s, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_f, togglefullscreen, {0} },
{ MODKEY, XK_Up, focusstack, {.i = +1 } },
{ MODKEY, XK_Down, focusstack, {.i = -1 } },
{ MODKEY, XK_F12, incnmaster, {.i = +1 } },
{ MODKEY, XK_F11, incnmaster, {.i = -1 } },
{ MODKEY, XK_Left, setmfact, {.f = -0.05} },
{ MODKEY, XK_Right, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_a, killclient, {0} },
{ MODKEY, XK_Tab, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_Tab, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_semicolon, focusmon, {.i = +1 } },
{ MODKEY, XK_semicolon, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_semicolon, tagmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_semicolon, tagmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY, XK_F1, spawn, SHCMD("pamixer -t && notify-send -u normal \"volume\" \"$(pamixer --get-volume-human)\"") },
{ MODKEY, XK_F2, spawn, SHCMD("pamixer -d 5 -u && notify-send -u normal \"volume\" \"$(pamixer --get-volume-human)\"") },
{ MODKEY, XK_F3, spawn, SHCMD("pamixer -i 5 -u && notify-send -u normal \"volume\" \"$(pamixer --get-volume-human)\"") },
{ MODKEY, XK_F4, spawn, SHCMD("brightnessctl -d \"amdgpu_bl1\" set 10%- && notify-send -u normal -a \"brightness\" \"$(brightnessctl -d 'amdgpu_bl1' get)\"") },
{ MODKEY, XK_F5, spawn, SHCMD("brightnessctl -d \"amdgpu_bl1\" set +10% && notify-send -u normal -a \"brightness\" \"$(brightnessctl -d 'amdgpu_bl1' get)\"") },
{ MODKEY, XK_F6, spawn, SHCMD("~/nixos/scripts/usb_guest.sh") },
{ MODKEY, XK_F7, spawn, SHCMD("~/nixos/scripts/susuwatari/client.sh") },
{ MODKEY, XK_F8, spawn, SHCMD("~/nixos/scripts/hdmi_paint.sh") },
{ MODKEY, XK_F9, spawn, SHCMD("~/nixos/scripts/screen_sleep.sh") },
{ ShiftMask, XK_Print, spawn, SHCMD("maim --select \"/home/penwing/Pictures/screenshots/$(date '+%Y_%m_%d %H:%M:%S').png\"") },
TAGKEYS( XK_ampersand, 0)
TAGKEYS( XK_eacute, 1)
TAGKEYS( XK_quotedbl, 2)

379
dwm.c
View file

@ -188,15 +188,15 @@ static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
//static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
static void pop(Client *c);
//static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
//static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
@ -205,8 +205,9 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void fullscreen(const Arg *arg);
static void setgaps(const Arg *arg);
//static void fullscreen(const Arg *arg);
static void togglefullscreen(const Arg *arg);
//static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
@ -216,8 +217,8 @@ 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 togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
//static void togglebar(const Arg *arg);
//static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@ -240,7 +241,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
static void zoom(const Arg *arg);
//static void zoom(const Arg *arg);
/* variables */
static const char broken[] = "broken";
@ -287,6 +288,14 @@ static Colormap cmap;
/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
void togglefullscreen(const Arg *arg) {
Client *c = selmon->sel; // Get the currently focused client
if (!c) return; // Exit if there is no focused client
// Toggle fullscreen state
setfullscreen(c, !c->isfullscreen);
}
/* function implementations */
void
applyrules(Client *c)
@ -717,8 +726,8 @@ void
drawbar(Monitor *m)
{
int x, w, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
//int boxs = drw->fonts->h / 9;
//int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
@ -1152,65 +1161,65 @@ motionnotify(XEvent *e)
mon = m;
}
void
movemouse(const Arg *arg)
{
int x, y, ocx, ocy, nx, ny;
Client *c;
Monitor *m;
XEvent ev;
Time lasttime = 0;
if (!(c = selmon->sel))
return;
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
ocy = c->y;
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurMove]->cursor, CurrentTime) != GrabSuccess)
return;
if (!getrootptr(&x, &y))
return;
do {
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
if ((ev.xmotion.time - lasttime) <= (1000 / 60))
continue;
lasttime = ev.xmotion.time;
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))
togglefloating(NULL);
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, nx, ny, c->w, c->h, 1);
break;
}
} while (ev.type != ButtonRelease);
XUngrabPointer(dpy, CurrentTime);
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
sendmon(c, m);
selmon = m;
focus(NULL);
}
}
// void
// movemouse(const Arg *arg)
// {
// int x, y, ocx, ocy, nx, ny;
// Client *c;
// Monitor *m;
// XEvent ev;
// Time lasttime = 0;
//
// if (!(c = selmon->sel))
// return;
// if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
// return;
// restack(selmon);
// ocx = c->x;
// ocy = c->y;
// if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
// None, cursor[CurMove]->cursor, CurrentTime) != GrabSuccess)
// return;
// if (!getrootptr(&x, &y))
// return;
// do {
// XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
// switch(ev.type) {
// case ConfigureRequest:
// case Expose:
// case MapRequest:
// handler[ev.type](&ev);
// break;
// case MotionNotify:
// if ((ev.xmotion.time - lasttime) <= (1000 / 60))
// continue;
// lasttime = ev.xmotion.time;
//
// 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))
// togglefloating(NULL);
// if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
// resize(c, nx, ny, c->w, c->h, 1);
// break;
// }
// } while (ev.type != ButtonRelease);
// XUngrabPointer(dpy, CurrentTime);
// if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
// sendmon(c, m);
// selmon = m;
// focus(NULL);
// }
// }
Client *
nexttiled(Client *c)
@ -1219,14 +1228,14 @@ nexttiled(Client *c)
return c;
}
void
pop(Client *c)
{
detach(c);
attach(c);
focus(c);
arrange(c->mon);
}
// void
// pop(Client *c)
// {
// detach(c);
// attach(c);
// focus(c);
// arrange(c->mon);
// }
void
propertynotify(XEvent *e)
@ -1304,62 +1313,62 @@ resizeclient(Client *c, int x, int y, int w, int h)
XSync(dpy, False);
}
void
resizemouse(const Arg *arg)
{
int ocx, ocy, nw, nh;
Client *c;
Monitor *m;
XEvent ev;
Time lasttime = 0;
if (!(c = selmon->sel))
return;
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
return;
restack(selmon);
ocx = c->x;
ocy = c->y;
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
return;
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
do {
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
if ((ev.xmotion.time - lasttime) <= (1000 / 60))
continue;
lasttime = ev.xmotion.time;
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
&& 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))
togglefloating(NULL);
}
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, c->x, c->y, nw, nh, 1);
break;
}
} while (ev.type != ButtonRelease);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
sendmon(c, m);
selmon = m;
focus(NULL);
}
}
// void
// resizemouse(const Arg *arg)
// {
// int ocx, ocy, nw, nh;
// Client *c;
// Monitor *m;
// XEvent ev;
// Time lasttime = 0;
//
// if (!(c = selmon->sel))
// return;
// if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
// return;
// restack(selmon);
// ocx = c->x;
// ocy = c->y;
// if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
// None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
// return;
// XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
// do {
// XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
// switch(ev.type) {
// case ConfigureRequest:
// case Expose:
// case MapRequest:
// handler[ev.type](&ev);
// break;
// case MotionNotify:
// if ((ev.xmotion.time - lasttime) <= (1000 / 60))
// continue;
// lasttime = ev.xmotion.time;
//
// nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
// nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
// if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
// && 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))
// togglefloating(NULL);
// }
// if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
// resize(c, c->x, c->y, nw, nh, 1);
// break;
// }
// } while (ev.type != ButtonRelease);
// XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
// XUngrabPointer(dpy, CurrentTime);
// while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
// if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
// sendmon(c, m);
// selmon = m;
// focus(NULL);
// }
// }
void
restack(Monitor *m)
@ -1514,28 +1523,28 @@ setfullscreen(Client *c, int fullscreen)
}
}
void
setgaps(const Arg *arg)
{
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
selmon->gappx = 0;
else
selmon->gappx += arg->i;
arrange(selmon);
}
// void
// setgaps(const Arg *arg)
// {
// if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
// selmon->gappx = 0;
// else
// selmon->gappx += arg->i;
// arrange(selmon);
// }
Layout *last_layout;
void
fullscreen(const Arg *arg)
{
if (selmon->showbar) {
for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
setlayout(&((Arg) { .v = &layouts[2] }));
} else {
setlayout(&((Arg) { .v = last_layout }));
}
togglebar(arg);
}
// void
// fullscreen(const Arg *arg)
// {
// if (selmon->showbar) {
// for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
// setlayout(&((Arg) { .v = &layouts[2] }));
// } else {
// setlayout(&((Arg) { .v = last_layout }));
// }
// togglebar(arg);
// }
void
setlayout(const Arg *arg)
@ -1744,28 +1753,28 @@ tile(Monitor *m)
}
}
void
togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon);
}
// void
// togglebar(const Arg *arg)
// {
// selmon->showbar = !selmon->showbar;
// updatebarpos(selmon);
// XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
// arrange(selmon);
// }
void
togglefloating(const Arg *arg)
{
if (!selmon->sel)
return;
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
arrange(selmon);
}
// void
// togglefloating(const Arg *arg)
// {
// if (!selmon->sel)
// return;
// if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
// return;
// selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
// if (selmon->sel->isfloating)
// resize(selmon->sel, selmon->sel->x, selmon->sel->y,
// selmon->sel->w, selmon->sel->h, 0);
// arrange(selmon);
// }
void
toggletag(const Arg *arg)
@ -2199,17 +2208,17 @@ xinitvisual()
}
}
void
zoom(const Arg *arg)
{
Client *c = selmon->sel;
if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating)
return;
if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
return;
pop(c);
}
// void
// zoom(const Arg *arg)
// {
// Client *c = selmon->sel;
//
// if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating)
// return;
// if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
// return;
// pop(c);
// }
int
main(int argc, char *argv[])

2236
dwm.c.orig

File diff suppressed because it is too large Load diff

View file

@ -1,20 +0,0 @@
--- dwm.c Mon Feb 24 21:41:55 2020
+++ dwm.c Mon Feb 24 21:48:42 2020
@@ -242,6 +243,7 @@
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
+static void drawroundedcorners(Client *c);
/* variables */
static const char broken[] = "broken";
@@ -1446,6 +1500,9 @@
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, nx, ny, nw, nh, 1);
+
+ drawroundedcorners(c);
+
break;
}
} while (ev.type != ButtonRelease);

BIN
dwm.o

Binary file not shown.

View file

@ -1,114 +0,0 @@
/* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */
/* Back by popular demand, the dwm rounded corners patch. */
/* http://github.com/mitchweaver/suckless */
/* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */
/* Things to know about this patch: */
/* 1. You need to add '-lXext' to the libraries linked in config.mk */
/* LIBS = -L${X11LIB} -lX11 -lXext */
/* 2. You need to set a CORNER_RADIUS integer in your config.h: */
/* static const int CORNER_RADIUS = 10; */
/* 3. You must have "borderpx = 0;" in your config.h */
/* 4. This patch assumes ALL other "OFFICIAL" and "mitch" patches have been applied. */
/* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */
--- dwm/dwm.c Mon Feb 24 21:41:55 2020
+++ dwm/dwm.c Mon Feb 24 21:48:42 2020
@@ -39,6 +39,7 @@
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
+#include <X11/extensions/shape.h>
#include <X11/Xft/Xft.h>
#include "drw.h"
@@ -241,6 +242,7 @@
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
+static void drawroundedcorners(Client *c);
/* variables */
static const char broken[] = "broken";
@@ -1133,6 +1135,9 @@
unfocus(selmon->sel, 0);
c->mon->sel = c;
arrange(c->mon);
+
+ drawroundedcorners(c);
+
XMapWindow(dpy, c->win);
focus(NULL);
}
@@ -1337,6 +1342,55 @@
XSync(dpy, False);
}
+void drawroundedcorners(Client *c) {
+ // if set to zero in config.h, do not attempt to round
+ if(CORNER_RADIUS < 0) return;
+
+ // NOTE: this is extremely hacky and surely could be optimized.
+ // Any X wizards out there reading this, please pull request.
+ if (CORNER_RADIUS > 0 && c && !c->isfullscreen) {
+ Window win;
+ win = c->win;
+ if(!win) return;
+
+ XWindowAttributes win_attr;
+ if(!XGetWindowAttributes(dpy, win, &win_attr)) return;
+
+ // set in config.h:
+ int dia = 2 * CORNER_RADIUS;
+ int w = c->w;
+ int h = c->h;
+ if(w < dia || h < dia) return;
+
+ Pixmap mask;
+ mask = XCreatePixmap(dpy, win, w, h, 1);
+ if(!mask) return;
+
+ XGCValues xgcv;
+ GC shape_gc;
+ shape_gc = XCreateGC(dpy, mask, 0, &xgcv);
+
+ if(!shape_gc) {
+ XFreePixmap(dpy, mask);
+ free(shape_gc);
+ return;
+ }
+
+ XSetForeground(dpy, shape_gc, 0);
+ XFillRectangle(dpy, mask, shape_gc, 0, 0, w, h);
+ XSetForeground(dpy, shape_gc, 1);
+ XFillArc(dpy, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
+ XFillArc(dpy, mask, shape_gc, w-dia-1, 0, dia, dia, 0, 23040);
+ XFillArc(dpy, mask, shape_gc, 0, h-dia-1, dia, dia, 0, 23040);
+ XFillArc(dpy, mask, shape_gc, w-dia-1, h-dia-1, dia, dia, 0, 23040);
+ XFillRectangle(dpy, mask, shape_gc, CORNER_RADIUS, 0, w-dia, h);
+ XFillRectangle(dpy, mask, shape_gc, 0, CORNER_RADIUS, w, h-dia);
+ XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet);
+ XFreePixmap(dpy, mask);
+ XFreeGC(dpy, shape_gc);
+ }
+}
+
void
resizemouse(const Arg *arg)
{
@@ -1393,6 +1447,9 @@
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, nx, ny, nw, nh, 1);
+
+ drawroundedcorners(c);
+
break;
}
} while (ev.type != ButtonRelease);
@@ -1406,6 +1463,7 @@
selmon = m;
focus(NULL);
}
+ drawroundedcorners(c);
}
void