aboutsummaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authordavidpkj <davidpenkow1@gmail.com>2023-03-16 12:08:46 +0100
committerdavidpkj <davidpenkow1@gmail.com>2023-03-16 12:08:46 +0100
commit5c41f50138f085082dad739147cd017d7aacd6c4 (patch)
tree52bcb1518983a3cd66b013e09a3e3e9255df929c /dwm.c
parente0c0ed10afbd8e32dd1b86b4cf3078d759a1d8a2 (diff)
Patch: alwaysontop-6.2
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index 909da37..6bd78e3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -102,7 +102,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw;
unsigned int tags;
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow, issticky;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow, issticky, isalwaysontop, iscentered;
pid_t pid;
Client *next;
Client *snext;
@@ -265,6 +265,7 @@ 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 togglealwaysontop(const Arg *arg);
static void togglesticky(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -919,8 +920,11 @@ drawbar(Monitor *m)
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w - 2 * sp, 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 - 2 * sp, bh, 1, 1);
@@ -1738,6 +1742,17 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
+
+ /* raise the aot window */
+ for(Monitor *m_search = mons; m_search; m_search = m_search->next){
+ for(c = m_search->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;
@@ -2131,6 +2146,32 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
+ else
+ selmon->sel->isalwaysontop = 0; /* disabled, turn this off too */
+ 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);
}