Introduction
Introduction Statistics Contact Development Disclaimer Help
alwaysontop-6.2.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
alwaysontop-6.2.diff (3505B)
---
1 From 9cd160c4ba9c345c24644a7da77cc4f04fc93c4e Mon Sep 17 00:00:00 2001
2 From: Rob Pilling <[email protected]>
3 Date: Mon, 27 Jul 2020 20:11:08 +0100
4 Subject: [PATCH] alwaysontop
5
6 ---
7 config.def.h | 1 +
8 dwm.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
9 2 files changed, 44 insertions(+), 2 deletions(-)
10
11 diff --git a/config.def.h b/config.def.h
12 index 1c0b587..c3c7edd 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15 @@ -78,6 +78,7 @@ static Key keys[] = {
16 { MODKEY, XK_m, setlayout, {.v …
17 { MODKEY, XK_space, setlayout, {0} …
18 { MODKEY|ShiftMask, XK_space, togglefloating, {0} …
19 + { MODKEY|ShiftMask, XK_space, togglealwaysontop, {…
20 { MODKEY, XK_0, view, {.ui…
21 { MODKEY|ShiftMask, XK_0, tag, {.ui…
22 { MODKEY, XK_comma, focusmon, {.i …
23 diff --git a/dwm.c b/dwm.c
24 index 4465af1..8d54b26 100644
25 --- a/dwm.c
26 +++ b/dwm.c
27 @@ -92,7 +92,7 @@ struct Client {
28 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
29 int bw, oldbw;
30 unsigned int tags;
31 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfull…
32 + int isfixed, iscentered, isfloating, isalwaysontop, isurgent, n…
33 Client *next;
34 Client *snext;
35 Monitor *mon;
36 @@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
37 static void tile(Monitor *);
38 static void togglebar(const Arg *arg);
39 static void togglefloating(const Arg *arg);
40 +static void togglealwaysontop(const Arg *arg);
41 static void toggletag(const Arg *arg);
42 static void toggleview(const Arg *arg);
43 static void unfocus(Client *c, int setfocus);
44 @@ -732,8 +733,11 @@ drawbar(Monitor *m)
45 if (m->sel) {
46 drw_setscheme(drw, scheme[m == selmon ? SchemeS…
47 drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->n…
48 - if (m->sel->isfloating)
49 + if (m->sel->isfloating) {
50 drw_rect(drw, x + boxs, boxs, boxw, box…
51 + if (m->sel->isalwaysontop)
52 + drw_rect(drw, x + boxs, bh - bo…
53 + }
54 } else {
55 drw_setscheme(drw, scheme[SchemeNorm]);
56 drw_rect(drw, x, 0, w, bh, 1, 1);
57 @@ -1356,6 +1360,17 @@ restack(Monitor *m)
58 return;
59 if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
60 XRaiseWindow(dpy, m->sel->win);
61 +
62 + /* raise the aot window */
63 + for(Monitor *m_search = mons; m_search; m_search = m_search->ne…
64 + for(c = m_search->clients; c; c = c->next){
65 + if(c->isalwaysontop){
66 + XRaiseWindow(dpy, c->win);
67 + break;
68 + }
69 + }
70 + }
71 +
72 if (m->lt[m->sellt]->arrange) {
73 wc.stack_mode = Below;
74 wc.sibling = m->barwin;
75 @@ -1716,6 +1731,32 @@ togglefloating(const Arg *arg)
76 if (selmon->sel->isfloating)
77 resize(selmon->sel, selmon->sel->x, selmon->sel->y,
78 selmon->sel->w, selmon->sel->h, 0);
79 + else
80 + selmon->sel->isalwaysontop = 0; /* disabled, turn this …
81 + arrange(selmon);
82 +}
83 +
84 +void
85 +togglealwaysontop(const Arg *arg)
86 +{
87 + if (!selmon->sel)
88 + return;
89 + if (selmon->sel->isfullscreen)
90 + return;
91 +
92 + if(selmon->sel->isalwaysontop){
93 + selmon->sel->isalwaysontop = 0;
94 + }else{
95 + /* disable others */
96 + for(Monitor *m = mons; m; m = m->next)
97 + for(Client *c = m->clients; c; c = c->next)
98 + c->isalwaysontop = 0;
99 +
100 + /* turn on, make it float too */
101 + selmon->sel->isfloating = 1;
102 + selmon->sel->isalwaysontop = 1;
103 + }
104 +
105 arrange(selmon);
106 }
107
108 --
109 2.31.1
110
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.