sites

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

commit ec2b9f6a4916fa005ef32fa2a9a6b14d20d0a6ee
parent 8c0cb05c46cbe4013c9a0f3f073a7035e96b10e1
Author: Hritik Vijay <hr1t1k@protonmail.com>
Date:   Tue, 16 Feb 2021 17:58:06 +0530

Move systray to the left of status text

This patch works on the top of systray patch by Igor Gevka and moves the
systray to the left of status text. More like Windows XP style.

Diffstat:
Adwm.suckless.org/patches/systray/dwm-systray_left-20210216-66ca60e.diff | 153+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/systray/index.md | 4++++
2 files changed, 157 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/systray/dwm-systray_left-20210216-66ca60e.diff b/dwm.suckless.org/patches/systray/dwm-systray_left-20210216-66ca60e.diff @@ -0,0 +1,153 @@ +From 66ca60e5561caedc7b1c4a648cb79d9347c9f3a3 Mon Sep 17 00:00:00 2001 +From: Hritik Vijay <hr1t1k@pm.me> +Date: Tue, 16 Feb 2021 17:25:59 +0530 +Subject: [PATCH] Move systray to the left of status text + +This patch works on the top of systray patch by Igor Gevka and moves the +systray to the left of status text. More like Windows XP style. +--- + dwm.c | 34 ++++++++-------------------------- + 1 file changed, 8 insertions(+), 26 deletions(-) + +diff --git a/dwm.c b/dwm.c +index c34815d..a1a6ba0 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -220,7 +220,6 @@ static void quit(const Arg *arg); + static Monitor *recttomon(int x, int y, int w, int h); + static void removesystrayicon(Client *i); + static void resize(Client *c, int x, int y, int w, int h, int interact); +-static void resizebarwin(Monitor *m); + static void resizeclient(Client *c, int x, int y, int w, int h); + static void resizemouse(const Arg *arg); + static void resizerequest(XEvent *e); +@@ -646,7 +645,6 @@ clientmessage(XEvent *e) + sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION); + sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION); + XSync(dpy, False); +- resizebarwin(selmon); + updatesystray(); + setclientstate(c, NormalState); + } +@@ -704,7 +702,6 @@ configurenotify(XEvent *e) + for (c = m->clients; c; c = c->next) + if (c->isfullscreen) + resizeclient(c, m->mx, m->my, m->mw, m->mh); +- resizebarwin(m); + } + focus(NULL); + arrange(NULL); +@@ -806,7 +803,6 @@ destroynotify(XEvent *e) + unmanage(c, 1); + else if ((c = wintosystrayicon(ev->window))) { + removesystrayicon(c); +- resizebarwin(selmon); + updatesystray(); + } + } +@@ -852,23 +848,19 @@ dirtomon(int dir) + void + drawbar(Monitor *m) + { +- int x, w, sw = 0, stw = 0; ++ int x, w, tw = 0; + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; + Client *c; + +- if(showsystray && m == systraytomon(m)) +- stw = getsystraywidth(); +- + /* draw status first so it can be overdrawn by tags later */ + if (m == selmon) { /* status is only drawn on selected monitor */ + drw_setscheme(drw, scheme[SchemeNorm]); +- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */ +- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0); ++ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ ++ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); + } + +- resizebarwin(m); + for (c = m->clients; c; c = c->next) { + occ |= c->tags; + if (c->isurgent) +@@ -889,7 +881,7 @@ drawbar(Monitor *m) + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + +- if ((w = m->ww - sw - stw - x) > bh) { ++ if ((w = m->ww - tw - x) > bh) { + if (m->sel) { + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); +@@ -900,7 +892,7 @@ drawbar(Monitor *m) + drw_rect(drw, x, 0, w, bh, 1, 1); + } + } +- drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh); ++ drw_map(drw, m->barwin, 0, 0, m->ww , bh); + } + + void +@@ -1296,7 +1288,6 @@ maprequest(XEvent *e) + Client *i; + if ((i = wintosystrayicon(ev->window))) { + sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION); +- resizebarwin(selmon); + updatesystray(); + } + +@@ -1428,7 +1419,6 @@ propertynotify(XEvent *e) + } + else + updatesystrayiconstate(c, ev); +- resizebarwin(selmon); + updatesystray(); + } + if ((ev->window == root) && (ev->atom == XA_WM_NAME)) +@@ -1512,14 +1502,6 @@ resize(Client *c, int x, int y, int w, int h, int interact) + resizeclient(c, x, y, w, h); + } + +-void +-resizebarwin(Monitor *m) { +- unsigned int w = m->ww; +- if (showsystray && m == systraytomon(m)) +- w -= getsystraywidth(); +- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh); +-} +- + void + resizeclient(Client *c, int x, int y, int w, int h) + { +@@ -1598,7 +1580,6 @@ resizerequest(XEvent *e) + + if ((i = wintosystrayicon(ev->window))) { + updatesystrayicongeom(i, ev->width, ev->height); +- resizebarwin(selmon); + updatesystray(); + } + } +@@ -1997,7 +1978,6 @@ togglebar(const Arg *arg) + { + selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; + updatebarpos(selmon); +- resizebarwin(selmon); + if (showsystray) { + XWindowChanges wc; + if (!selmon->showbar) +@@ -2414,7 +2394,9 @@ updatesystray(void) + XWindowChanges wc; + Client *i; + Monitor *m = systraytomon(NULL); +- unsigned int x = m->mx + m->mw; ++ unsigned int sw = TEXTW(stext) - lrpad + systrayspacing; ++ unsigned int x = m->mx + m->mw - sw; ++ + unsigned int w = 1; + + if (!showsystray) +-- +2.30.1 + diff --git a/dwm.suckless.org/patches/systray/index.md b/dwm.suckless.org/patches/systray/index.md @@ -9,6 +9,8 @@ follows the selected monitor. In case icons disappear when toggling the bar, try a different font size in dwm. This has helped at least in one case with pidgin. +If you'd like the tray to appear to the left of the status text, apply the dwm-systray_left patch on the top of systray patch. + Download -------- * [dwm-systray-20200914-61bb8b2.diff](dwm-systray-20200914-61bb8b2.diff) (23k) (20200914) @@ -17,6 +19,7 @@ Download * [dwm-6.1-systray.diff](dwm-6.1-systray.diff) (24K) (20190208) * [dwm-git-20130119-systray.diff](dwm-git-20130119-systray.diff) (19946b) * [dwm-systray-6.0.diff](dwm-systray-6.0.diff) (19788b) (20130119) +* [dwm-systray_left-20210216-66ca60e.diff](dwm-systray_left-20210216-66ca60e.diff) (5K) (20210216) Author ------ @@ -26,3 +29,4 @@ Author * Eric Pruitt (7af4d43 (20160626)) * Igor Gevka (cb3f58a (6.2), 20200216) * Michel Boaventura <michel.boaventura@protonmail.com> (f09418b) +* Hritik Vijay <hr1t1k@protonmail.com> (66ca60e)