sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit c2d500d62534eec4b5390de9c1818c695b4a7022
parent 17687f3efde57a7ff6a21cfe1c91a0fc0baad97d
Author: Rob Pilling <robpilling@gmail.com>
Date:   Mon, 27 Jul 2020 20:23:39 +0100

[dwm][patch][alwaysontop] add alwaysontop patch

Diffstat:
Adwm.suckless.org/patches/alwaysontop/alwaysontop-6.2.diff | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/alwaysontop/index.md | 21+++++++++++++++++++++
2 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/alwaysontop/alwaysontop-6.2.diff b/dwm.suckless.org/patches/alwaysontop/alwaysontop-6.2.diff @@ -0,0 +1,106 @@ +From 05444e0cc72422b05000ddf748a572ee83bed9f4 Mon Sep 17 00:00:00 2001 +From: Rob Pilling <robpilling@gmail.com> +Date: Mon, 27 Jul 2020 20:11:08 +0100 +Subject: [PATCH] alwaysontop + +--- + config.h | 1 + + dwm.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 40 insertions(+), 2 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 7283a2d..c10bd8b 100644 +--- a/config.h ++++ b/config.h +@@ -178,6 +178,7 @@ static Key keys[] = { + { MODKEY, XK_e, setlayout, {.v = &layouts[LAYOUT_I_grid]} }, + + { MODKEY, XK_space, togglefloating, {0} }, ++ { MODKEY|ShiftMask, XK_space, togglealwaysontop, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, +diff --git a/dwm.c b/dwm.c +index cc36b03..1b1b491 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -92,7 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, iscentered, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -220,6 +220,7 @@ static void bstack(Monitor *); + static void togglebar(const Arg *arg); + static void togglebartrans(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglealwaysontop(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -801,8 +802,11 @@ drawbar(Monitor *m) + if (m->sel) { + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); +- if (m->sel->isfloating) ++ if (m->sel->isfloating) { + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); ++ if (m->sel->isalwaysontop) ++ drw_rect(drw, x + boxs, bh - boxw, boxw, boxw, 0, 0); ++ } + } else { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x, 0, w, bh, 1, 1); +@@ -1430,6 +1434,15 @@ restack(Monitor *m) + return; + if (m->sel->isfloating || !m->lt[m->sellt]->arrange) + XRaiseWindow(dpy, m->sel->win); ++ ++ /* raise the aot window */ ++ for(c = m->clients; c; c = c->next){ ++ if(c->isalwaysontop){ ++ XRaiseWindow(dpy, c->win); ++ break; ++ } ++ } ++ + if (m->lt[m->sellt]->arrange) { + wc.stack_mode = Below; + wc.sibling = m->barwin; +@@ -1803,6 +1816,30 @@ togglefloating(const Arg *arg) + arrange(selmon); + } + ++void ++togglealwaysontop(const Arg *arg) ++{ ++ if (!selmon->sel) ++ return; ++ if (selmon->sel->isfullscreen) ++ return; ++ ++ if(selmon->sel->isalwaysontop){ ++ selmon->sel->isalwaysontop = 0; ++ }else{ ++ /* disable others */ ++ for(Monitor *m = mons; m; m = m->next) ++ for(Client *c = m->clients; c; c = c->next) ++ c->isalwaysontop = 0; ++ ++ /* turn on, make it float too */ ++ selmon->sel->isfloating = 1; ++ selmon->sel->isalwaysontop = 1; ++ } ++ ++ arrange(selmon); ++} ++ + void + toggletag(const Arg *arg) + { +-- +2.27.0 + diff --git a/dwm.suckless.org/patches/alwaysontop/index.md b/dwm.suckless.org/patches/alwaysontop/index.md @@ -0,0 +1,21 @@ +alwaysontop +=========== + +Description +----------- +Choose one floating window to be always-on-top - this prevents other floating +windows from being raised above it. Useful for playing films, etc. + +Download +-------- +* [alwaysontop-6.2.diff](alwaysontop-6.2.diff) + +Example Configuration +--------------------- +Add the following to your keys array to bind mod+tab to toggle attach below. + + { MODKEY|ShiftMask, XK_space, togglealwaysontop, {0} }, + +Author +------ +* Rob Pilling - <robpilling@gmail.com>