diff --git a/colors.h b/colors.h index e78ec28..0b059bc 100644 --- a/colors.h +++ b/colors.h @@ -43,14 +43,15 @@ static char *colstatus[] = { /* Colors to use for opacity */ static const unsigned int alphas[][3] = { - /* fg bg border/unused */ - [SchemeBar] = { OPAQUE, baropacity, baropacity }, - [SchemeNormTitle] = { OPAQUE, normtitleopacity, normtitleopacity }, - [SchemeSelTitle] = { OPAQUE, seltitleopacity, seltitleopacity }, - [SchemeLayout] = { OPAQUE, layoutopacity, layoutopacity }, - [SchemeStatus] = { OPAQUE, statusopacity, statusopacity }, - [SchemeHiddenTitle] = { OPAQUE, hiddenopacity, hiddenopacity }, - [SchemeTags] = { tagselopacity, tagselopacity, tagnormopacity }, + /* fg bg border/unused */ + [SchemeBar] = { OPAQUE, baropacity, baropacity }, + [SchemeNormTitle] = { OPAQUE, normtitleopacity, normtitleopacity }, + [SchemeSelTitle] = { OPAQUE, seltitleopacity, seltitleopacity }, + [SchemeLayout] = { OPAQUE, layoutopacity, layoutopacity }, + [SchemeStatus] = { OPAQUE, statusopacity, statusopacity }, + [SchemeHiddenTitle] = { OPAQUE, hiddenopacity, hiddenopacity }, + [SchemeNormBorder] = { OPAQUE, normborderopacity, selborderopacity }, + [SchemeTags] = { tagselopacity, tagselopacity, tagnormopacity }, }; /* Colors to use for tags diff --git a/docs/example.Xresources b/docs/example.Xresources index 5073c21..be9cde2 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -364,7 +364,6 @@ - speedwm.deckformat: [%d] !! !! Rounded corners. If set to 1, rounded corners will be drawn. Otherwise sharp corners will be used instead. (1/0) -!! Note that this requires border size (borderpx) to be set to 0, otherwise rounded corners will automatically be disabled. !! - speedwm.roundedcorners: 0 !! diff --git a/docs/keybinds b/docs/keybinds index f67bdd5..464dae1 100644 --- a/docs/keybinds +++ b/docs/keybinds @@ -155,6 +155,7 @@ These binds can be activated using your mouse - Tag (Left click) | Switch to tag + - Tag (Scrolling up/down) | Switch to the next/previous tag - Layout indicator (Left click) | Switch to the next layout - Layout indicator (Middle click) | Switch to the next layout - Layout indicator (Right click) | Open a dmenu list of all layouts diff --git a/mouse.h b/mouse.h index 062a6a4..d800ead 100644 --- a/mouse.h +++ b/mouse.h @@ -25,6 +25,8 @@ static const Button buttons[] = { { ClkWinTitle, 0, Button3, spawn, RCMD("speedwm-utils") }, { ClkRootWin, 0, Button3, spawn, RCMD(RUN_DESKTOP) }, { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button4, view, {0} }, + { ClkTagBar, 0, Button5, view, {0} }, }; /* Commands that will run when a part of the status bar is pressed diff --git a/options.h b/options.h index 211c700..fe762a1 100644 --- a/options.h +++ b/options.h @@ -134,8 +134,6 @@ static Bool bUseOpacity = True; /* Starts with opacity on #endif /* Rounded corners - * In order to use: - * - borderpx must also be set to 0 or else rounded corners will be disabled. */ #if USEROUNDCORNERS static int roundedcorners = 0; /* Enable (1) rounded corners or disable (0) rounded corners. */ @@ -337,6 +335,8 @@ static const unsigned int tagnormopacity = OPAQUE; /* Opacity for other tag static const unsigned int tagselopacity = 160; /* Opacity for the selected tag */ static const unsigned int normtitleopacity = 160; /* Opacity for all other windows in the speedwm bar */ static const unsigned int seltitleopacity = 160; /* Opacity for the focused window in the speedwm bar */ +static const unsigned int normborderopacity = OPAQUE; /* Opacity for the all window borders except selected */ +static const unsigned int selborderopacity = OPAQUE; /* Opacity for the selected window border */ static const unsigned int hiddenopacity = 0; /* Opacity for hidden/minimized windows */ static const unsigned int statusopacity = 160; /* Opacity for speedwm status bar */ diff --git a/speedwm.c b/speedwm.c index adb08e5..59b56ac 100644 --- a/speedwm.c +++ b/speedwm.c @@ -1099,6 +1099,16 @@ buttonpress(XEvent *e) selmon->mouseactivated = 1; #endif click = ClkTagBar; + if ( ev->button == Button4 || ev->button == Button5 ) { + arg.ui = selmon->tagset[selmon->seltags]; + if ( !(arg.ui & ((1 << (LENGTH(tags) - 1)) + 1)) ) { + arg.ui = (ev->button == Button4) ? (arg.ui >> 1) : (arg.ui << 1); + } else if ( arg.ui & 1 ) { + arg.ui = (ev->button == Button4) ? arg.ui : (arg.ui << 1); + } else if ( arg.ui & (1 << (LENGTH(tags) - 1)) ) { + arg.ui = (ev->button == Button4) ? (arg.ui >> 1) : arg.ui; + } + } else arg.ui = 1 << i; } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !layoutposition && !selmon->isreset) // right layout click = ClkLtSymbol; // right layout @@ -1391,56 +1401,44 @@ configurenotify(XEvent *e) #if USEROUNDCORNERS void drawroundedcorners(Client *c) { - if (cornerradius <= 0 || !c || c->isfullscreen) { - return; - } - - if (borderpx >= 1) - return; - if (!roundedcorners) - return; - - Window win; - win = c->win; - if (!win) - return; + Window w = c->win; + XWindowAttributes wa; + XGetWindowAttributes(dpy, w, &wa); - XWindowAttributes win_attr; - if (!XGetWindowAttributes(dpy, win, &win_attr)) - return; + if(!XGetWindowAttributes(dpy, w, &wa)) + return; - int dia = 2 * cornerradius; - int w = c->w; - int h = c->h; - if (w < dia || h < dia) - return; + int width = borderpx * 2 + wa.width; + int height = borderpx * 2 + wa.height; + int rad = cornerradius * enablegaps; + int dia = 2 * rad; - Pixmap mask; - mask = XCreatePixmap(dpy, win, w, h, 1); - if (!mask) - return; + if(width < dia || height < dia) + return; + + Pixmap mask = XCreatePixmap(dpy, w, width, height, 1); + + if(!mask) + return; XGCValues xgcv; - GC shape_gc; - shape_gc = XCreateGC(dpy, mask, 0, &xgcv); - - if (!shape_gc) { + 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); + XFillRectangle(dpy, mask, shape_gc, 0, 0, width, height); 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, cornerradius, 0, w-dia, h); - XFillRectangle(dpy, mask, shape_gc, 0, cornerradius, w, h-dia); - XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet); + XFillArc(dpy, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040); + XFillArc(dpy, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040); + XFillArc(dpy, mask, shape_gc, width-dia-1, height-dia-1, dia, dia, 0, 23040); + XFillRectangle(dpy, mask, shape_gc, rad, 0, width-dia, height); + XFillRectangle(dpy, mask, shape_gc, 0, rad, width, height-dia); + XShapeCombineMask(dpy, w, ShapeBounding, 0-wa.border_width, 0-wa.border_width, mask, ShapeSet); XFreePixmap(dpy, mask); XFreeGC(dpy, shape_gc); } @@ -5783,8 +5781,8 @@ updatesystray(void) XMapSubwindows(dpy, systray->win); /* redraw background */ XSetForeground(dpy, drw->gc, scheme[SchemeBar][ColBg].pixel); - //XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); // Without alpha - XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh); // With alpha + //XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); // vanilla + XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh); XSync(dpy, False); }