Re: [hackers] [dwm][PATCH] hide_vacant_tags patch

2019-03-29 Thread Quentin Rameau
On Fri, 29 Mar 2019 15:32:19 +0100
Ryan Kes  wrote:

> ---
>  dwm.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)

Hello Ryan,

You can update those patches yourself, I suggest having a look at
http://suckless.org/wiki/



[hackers] [dwm][PATCH] hide_vacant_tags patch

2019-03-29 Thread Ryan Kes
---
 dwm.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dwm.c b/dwm.c
index 4465af1..218e516 100644
--- a/dwm.c
+++ b/dwm.c
@@ -416,7 +416,7 @@ attachstack(Client *c)
 void
 buttonpress(XEvent *e)
 {
-   unsigned int i, x, click;
+   unsigned int i, x, click, occ = 0;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -431,9 +431,13 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
-   do
+   for (c = m->clients; c; c = c->next)
+   occ |= c->tags == 255 ? 0 : c->tags;
+   do {
+   if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+   continue;
x += TEXTW(tags[i]);
-   while (ev->x >= x && ++i < LENGTH(tags));
+   } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -709,19 +713,17 @@ drawbar(Monitor *m)
}
 
for (c = m->clients; c; c = c->next) {
-   occ |= c->tags;
+   occ |= c->tags == 255 ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+   if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+   continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? 
SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
-   if (occ & 1 << i)
-   drw_rect(drw, x + boxs, boxs, boxw, boxw,
-   m == selmon && selmon->sel && selmon->sel->tags 
& 1 << i,
-   urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
-- 
2.21.0




Re: [hackers] [slstatus][PATCH] backlight module

2019-03-29 Thread Abdullah
No  such file or directory, backlight.o
This error comes after applying this patch.

On 29/03, Ryan Kes wrote:
> ---
>  Makefile   |  1 +
>  components/backlight.c | 36 
>  config.def.h   |  1 +
>  slstatus.h |  3 +++
>  4 files changed, 41 insertions(+)
>  create mode 100644 components/backlight.c
> 
> diff --git a/Makefile b/Makefile
> index 945b5e3..28a205f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -6,6 +6,7 @@ include config.mk
>  
>  REQ = util
>  COM =\
> + components/backlight\
>   components/battery\
>   components/cpu\
>   components/datetime\
> diff --git a/components/backlight.c b/components/backlight.c
> new file mode 100644
> index 000..fcc062a
> --- /dev/null
> +++ b/components/backlight.c
> @@ -0,0 +1,36 @@
> +/* See LICENSE file for copyright and license details. */
> +#include 
> +#include 
> +
> +#include "../util.h"
> +
> +#if defined(__linux__)
> + #include 
> + #include 
> + #include 
> +
> + const char *
> + backlight_perc(const char *backlight)
> + {
> + float value;
> + char path[PATH_MAX];
> +
> + if (esnprintf(path, sizeof(path),
> + "/sys/class/backlight/%s/actual_brightness", 
> backlight) < 0) {
> + return NULL;
> + }
> + if (pscanf(path, "%f", &value) != 1) {
> + return NULL;
> + }
> +
> + return bprintf("%d", (int)(value / 852 * 100));
> + }
> +
> +#else
> + const char *
> + backlight_perc(const char *backlight)
> + {
> + return NULL;
> + }
> +
> +#endif
> diff --git a/config.def.h b/config.def.h
> index e06be66..d0996ef 100644
> --- a/config.def.h
> +++ b/config.def.h
> @@ -12,6 +12,7 @@ static const char unknown_str[] = "n/a";
>  /*
>   * functiondescription argument (example)
>   *
> + * backlight_perc  backlight percentagebacklight name 
> (intel_backlight)
>   * battery_percbattery percentage  battery name (BAT0)
>   * NULL on 
> OpenBSD/FreeBSD
>   * battery_state   battery charging state  battery name (BAT0)
> diff --git a/slstatus.h b/slstatus.h
> index 08f610a..d9c0b5f 100644
> --- a/slstatus.h
> +++ b/slstatus.h
> @@ -1,5 +1,8 @@
>  /* See LICENSE file for copyright and license details. */
>  
> +/* backlight */
> +const char *backlight_perc(const char *backlight);
> +
>  /* battery */
>  const char *battery_perc(const char *);
>  const char *battery_state(const char *);
> -- 
> 2.21.0
> 
> 


A K
https://abdullah.today
69C8 7720 E507 86DF 1D85  
EA5E FC59 7891 5CBC 7BC7




signature.asc
Description: PGP signature


[hackers] [slstatus][PATCH] separator module

2019-03-29 Thread Ryan Kes
---
 Makefile   |  1 +
 components/seperator.c | 10 ++
 config.def.h   |  1 +
 slstatus.h |  3 +++
 4 files changed, 15 insertions(+)
 create mode 100644 components/seperator.c

diff --git a/Makefile b/Makefile
index 945b5e3..20796b3 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ COM =\
components/num_files\
components/ram\
components/run_command\
+   components/seperator\
components/swap\
components/temperature\
components/uptime\
diff --git a/components/seperator.c b/components/seperator.c
new file mode 100644
index 000..826a461
--- /dev/null
+++ b/components/seperator.c
@@ -0,0 +1,10 @@
+/* See LICENSE file for copyright and license details. */
+#include 
+
+#include "../util.h"
+
+const char *
+seperator(char *seperator)
+{
+return seperator;
+}
diff --git a/config.def.h b/config.def.h
index e06be66..af289e5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -45,6 +45,7 @@ static const char unknown_str[] = "n/a";
  * ram_total   total memory size in GB NULL
  * ram_usedused memory in GB   NULL
  * run_command custom shell commandcommand (echo foo)
+ * seperator   string to echo  NULL
  * swap_free   free swap in GB NULL
  * swap_perc   swap usage in percent   NULL
  * swap_total  total swap size in GB   NULL
diff --git a/slstatus.h b/slstatus.h
index 08f610a..78aef21 100644
--- a/slstatus.h
+++ b/slstatus.h
@@ -56,6 +56,9 @@ const char *ram_used(void);
 /* run_command */
 const char *run_command(const char *cmd);
 
+/* seperator */
+const char *seperator(const char *seperator);
+
 /* swap */
 const char *swap_free(void);
 const char *swap_perc(void);
-- 
2.21.0




Re: [hackers] [dwm][PATCH] dwm-ewhmtags-6.2

2019-03-29 Thread Ryan
Ah, well i sent it again because the mailing list sent me a message that I
wasn't subscribed. I got this to compile and run without crashing with 6.2.
However never could get it to work properly with Polybar so I kind of gave
up :) Sorry about that, i seem to have forgotten about that last part. Does
the older version of the patch work with dwm 6.1 / polybar properly?

No problem. Glad to contribute and learn a little something about how X
works.

On Fri, Mar 29, 2019 at 7:16 PM Abdullah  wrote:

> this one is already submitted. maybe you changed somthing. does this
> work now? I used it and I couldn't click on tag numbers in polybar.
> btw appreciate your efforts.
>
>
>
> On 29/03, Ryan Kes wrote:
> > ---
> >  dwm.c | 49 -
> >  1 file changed, 48 insertions(+), 1 deletion(-)
> >
> > diff --git a/dwm.c b/dwm.c
> > index 4465af1..92022a1 100644
> > --- a/dwm.c
> > +++ b/dwm.c
> > @@ -55,6 +55,7 @@
> >  #define WIDTH(X)((X)->w + 2 * (X)->bw)
> >  #define HEIGHT(X)   ((X)->h + 2 * (X)->bw)
> >  #define TAGMASK ((1 << LENGTH(tags)) - 1)
> > +#define TAGSLENGTH  (LENGTH(tags))
> >  #define TEXTW(X)(drw_fontset_getwidth(drw, (X)) + lrpad)
> >
> >  /* enums */
> > @@ -62,7 +63,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /*
> cursor */
> >  enum { SchemeNorm, SchemeSel }; /* color schemes */
> >  enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
> > NetWMFullscreen, NetActiveWindow, NetWMWindowType,
> > -   NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
> > +   NetWMWindowTypeDialog, NetClientList, NetDesktopNames,
> NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /*
> EWMH atoms */
> >  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /*
> default atoms */
> >  enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
> > ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
> > @@ -197,11 +198,15 @@ static void scan(void);
> >  static int sendevent(Client *c, Atom proto);
> >  static void sendmon(Client *c, Monitor *m);
> >  static void setclientstate(Client *c, long state);
> > +static void setcurrentdesktop(void);
> > +static void setdesktopnames(void);
> >  static void setfocus(Client *c);
> >  static void setfullscreen(Client *c, int fullscreen);
> >  static void setlayout(const Arg *arg);
> >  static void setmfact(const Arg *arg);
> > +static void setnumdesktops(void);
> >  static void setup(void);
> > +static void setviewport(void);
> >  static void seturgent(Client *c, int urg);
> >  static void showhide(Client *c);
> >  static void sigchld(int unused);
> > @@ -216,6 +221,7 @@ static void toggleview(const Arg *arg);
> >  static void unfocus(Client *c, int setfocus);
> >  static void unmanage(Client *c, int destroyed);
> >  static void unmapnotify(XEvent *e);
> > +static void updatecurrentdesktop(void);
> >  static void updatebarpos(Monitor *m);
> >  static void updatebars(void);
> >  static void updateclientlist(void);
> > @@ -1431,6 +1437,16 @@ setclientstate(Client *c, long state)
> >   XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
> >   PropModeReplace, (unsigned char *)data, 2);
> >  }
> > +void
> > +setcurrentdesktop(void){
> > + long data[] = { 0 };
> > + XChangeProperty(dpy, root, netatom[NetCurrentDesktop],
> XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
> > +}
> > +void setdesktopnames(void){
> > + XTextProperty text;
> > + Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH,
> XUTF8StringStyle, &text);
> > + XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
> > +}
> >
> >  int
> >  sendevent(Client *c, Atom proto)
> > @@ -1457,6 +1473,12 @@ sendevent(Client *c, Atom proto)
> >   return exists;
> >  }
> >
> > +void
> > +setnumdesktops(void){
> > + long data[] = { TAGSLENGTH };
> > + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops],
> XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
> > +}
> > +
> >  void
> >  setfocus(Client *c)
> >  {
> > @@ -1562,6 +1584,10 @@ setup(void)
> >   netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE",
> False);
> >   netatom[NetWMWindowTypeDialog] = XInternAtom(dpy,
> "_NET_WM_WINDOW_TYPE_DIALOG", False);
> >   netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST",
> False);
> > + netatom[NetDesktopViewport] = XInternAtom(dpy,
> "_NET_DESKTOP_VIEWPORT", False);
> > + netatom[NetNumberOfDesktops] = XInternAtom(dpy,
> "_NET_NUMBER_OF_DESKTOPS", False);
> > + netatom[NetCurrentDesktop] = XInternAtom(dpy,
> "_NET_CURRENT_DESKTOP", False);
> > + netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES",
> False);
> >   /* init cursors */
> >   cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
> >   cursor[CurResize] = drw_cur_create(drw, XC_sizing);
> > @@ -1584,6 +1610,10 @@ setup

Re: [hackers] [dwm][PATCH] dwm-ewhmtags-6.2

2019-03-29 Thread Abdullah
this one is already submitted. maybe you changed somthing. does this
work now? I used it and I couldn't click on tag numbers in polybar. 
btw appreciate your efforts.



On 29/03, Ryan Kes wrote:
> ---
>  dwm.c | 49 -
>  1 file changed, 48 insertions(+), 1 deletion(-)
> 
> diff --git a/dwm.c b/dwm.c
> index 4465af1..92022a1 100644
> --- a/dwm.c
> +++ b/dwm.c
> @@ -55,6 +55,7 @@
>  #define WIDTH(X)((X)->w + 2 * (X)->bw)
>  #define HEIGHT(X)   ((X)->h + 2 * (X)->bw)
>  #define TAGMASK ((1 << LENGTH(tags)) - 1)
> +#define TAGSLENGTH  (LENGTH(tags))
>  #define TEXTW(X)(drw_fontset_getwidth(drw, (X)) + lrpad)
>  
>  /* enums */
> @@ -62,7 +63,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor 
> */
>  enum { SchemeNorm, SchemeSel }; /* color schemes */
>  enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
> NetWMFullscreen, NetActiveWindow, NetWMWindowType,
> -   NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
> +   NetWMWindowTypeDialog, NetClientList, NetDesktopNames, 
> NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* 
> EWMH atoms */
>  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default 
> atoms */
>  enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
> ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
> @@ -197,11 +198,15 @@ static void scan(void);
>  static int sendevent(Client *c, Atom proto);
>  static void sendmon(Client *c, Monitor *m);
>  static void setclientstate(Client *c, long state);
> +static void setcurrentdesktop(void);
> +static void setdesktopnames(void);
>  static void setfocus(Client *c);
>  static void setfullscreen(Client *c, int fullscreen);
>  static void setlayout(const Arg *arg);
>  static void setmfact(const Arg *arg);
> +static void setnumdesktops(void);
>  static void setup(void);
> +static void setviewport(void);
>  static void seturgent(Client *c, int urg);
>  static void showhide(Client *c);
>  static void sigchld(int unused);
> @@ -216,6 +221,7 @@ static void toggleview(const Arg *arg);
>  static void unfocus(Client *c, int setfocus);
>  static void unmanage(Client *c, int destroyed);
>  static void unmapnotify(XEvent *e);
> +static void updatecurrentdesktop(void);
>  static void updatebarpos(Monitor *m);
>  static void updatebars(void);
>  static void updateclientlist(void);
> @@ -1431,6 +1437,16 @@ setclientstate(Client *c, long state)
>   XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
>   PropModeReplace, (unsigned char *)data, 2);
>  }
> +void
> +setcurrentdesktop(void){
> + long data[] = { 0 };
> + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, 
> PropModeReplace, (unsigned char *)data, 1);
> +}
> +void setdesktopnames(void){
> + XTextProperty text;
> + Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, 
> &text);
> + XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
> +}
>  
>  int
>  sendevent(Client *c, Atom proto)
> @@ -1457,6 +1473,12 @@ sendevent(Client *c, Atom proto)
>   return exists;
>  }
>  
> +void
> +setnumdesktops(void){
> + long data[] = { TAGSLENGTH };
> + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 
> 32, PropModeReplace, (unsigned char *)data, 1);
> +}
> +
>  void
>  setfocus(Client *c)
>  {
> @@ -1562,6 +1584,10 @@ setup(void)
>   netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", 
> False);
>   netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, 
> "_NET_WM_WINDOW_TYPE_DIALOG", False);
>   netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
> + netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", 
> False);
> + netatom[NetNumberOfDesktops] = XInternAtom(dpy, 
> "_NET_NUMBER_OF_DESKTOPS", False);
> + netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", 
> False);
> + netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", 
> False);
>   /* init cursors */
>   cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
>   cursor[CurResize] = drw_cur_create(drw, XC_sizing);
> @@ -1584,6 +1610,10 @@ setup(void)
>   /* EWMH support per view */
>   XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
>   PropModeReplace, (unsigned char *) netatom, NetLast);
> + setnumdesktops();
> + setcurrentdesktop();
> + setdesktopnames();
> + setviewport();
>   XDeleteProperty(dpy, root, netatom[NetClientList]);
>   /* select events */
>   wa.cursor = cursor[CurNormal]->cursor;
> @@ -1595,6 +1625,11 @@ setup(void)
>   grabkeys();
>   focus(NULL);
>  }
> +void
> +setviewport(void){
> + long data[] = { 0, 0 };
> + XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 
> 32, PropModeReplace, (unsig

[hackers] [dwm][PATCH] dwm-notitle-6.2

2019-03-29 Thread Ryan Kes
---
 config.def.h |  1 -
 dwm.c| 20 
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/config.def.h b/config.def.h
index 1c0b587..19330cd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -102,7 +102,6 @@ static Button buttons[] = {
/* clickevent mask  button  function
argument */
{ ClkLtSymbol,  0,  Button1,setlayout,  
{0} },
{ ClkLtSymbol,  0,  Button3,setlayout,  
{.v = &layouts[2]} },
-   { ClkWinTitle,  0,  Button2,zoom,   
{0} },
{ ClkStatusText,0,  Button2,spawn,  
{.v = termcmd } },
{ ClkClientWin, MODKEY, Button1,movemouse,  
{0} },
{ ClkClientWin, MODKEY, Button2,togglefloating, 
{0} },
diff --git a/dwm.c b/dwm.c
index 4465af1..bcf5cb1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms 
*/
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
-   ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
+   ClkRootWin, ClkLast }; /* clicks */
 
 typedef union {
int i;
@@ -439,10 +439,8 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
-   else if (ev->x > selmon->ww - TEXTW(stext))
-   click = ClkStatusText;
else
-   click = ClkWinTitle;
+   click = ClkStatusText;
} else if ((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
@@ -729,15 +727,8 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
 
if ((w = m->ww - sw - 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);
-   if (m->sel->isfloating)
-   drw_rect(drw, x + boxs, boxs, boxw, boxw, 
m->sel->isfixed, 0);
-   } else {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
-   }
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
 }
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
drawbars();
break;
}
-   if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
+   if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
updatetitle(c);
-   if (c == c->mon->sel)
-   drawbar(c->mon);
-   }
if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c);
}
-- 
2.21.0




[hackers] [slstatus][PATCH] backlight module

2019-03-29 Thread Ryan Kes
---
 Makefile   |  1 +
 components/backlight.c | 36 
 config.def.h   |  1 +
 slstatus.h |  3 +++
 4 files changed, 41 insertions(+)
 create mode 100644 components/backlight.c

diff --git a/Makefile b/Makefile
index 945b5e3..28a205f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ include config.mk
 
 REQ = util
 COM =\
+   components/backlight\
components/battery\
components/cpu\
components/datetime\
diff --git a/components/backlight.c b/components/backlight.c
new file mode 100644
index 000..fcc062a
--- /dev/null
+++ b/components/backlight.c
@@ -0,0 +1,36 @@
+/* See LICENSE file for copyright and license details. */
+#include 
+#include 
+
+#include "../util.h"
+
+#if defined(__linux__)
+   #include 
+   #include 
+   #include 
+
+   const char *
+   backlight_perc(const char *backlight)
+   {
+   float value;
+   char path[PATH_MAX];
+
+   if (esnprintf(path, sizeof(path),
+   "/sys/class/backlight/%s/actual_brightness", 
backlight) < 0) {
+   return NULL;
+   }
+   if (pscanf(path, "%f", &value) != 1) {
+   return NULL;
+   }
+
+   return bprintf("%d", (int)(value / 852 * 100));
+   }
+
+#else
+   const char *
+   backlight_perc(const char *backlight)
+   {
+   return NULL;
+   }
+
+#endif
diff --git a/config.def.h b/config.def.h
index e06be66..d0996ef 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,6 +12,7 @@ static const char unknown_str[] = "n/a";
 /*
  * functiondescription argument (example)
  *
+ * backlight_perc  backlight percentagebacklight name 
(intel_backlight)
  * battery_percbattery percentage  battery name (BAT0)
  * NULL on OpenBSD/FreeBSD
  * battery_state   battery charging state  battery name (BAT0)
diff --git a/slstatus.h b/slstatus.h
index 08f610a..d9c0b5f 100644
--- a/slstatus.h
+++ b/slstatus.h
@@ -1,5 +1,8 @@
 /* See LICENSE file for copyright and license details. */
 
+/* backlight */
+const char *backlight_perc(const char *backlight);
+
 /* battery */
 const char *battery_perc(const char *);
 const char *battery_state(const char *);
-- 
2.21.0




[hackers] [st][PATCH] st-disable-bold-italic-fonts-0.8.2

2019-03-29 Thread Ryan Kes
---
 config.def.h |  6 ++
 x.c  | 10 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index 482901e..4f5aeac 100644
--- a/config.def.h
+++ b/config.def.h
@@ -6,6 +6,12 @@
  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
  */
 static char *font = "Liberation 
Mono:pixelsize=12:antialias=true:autohint=true";
+
+/* disable bold, italic and roman fonts globally */
+int disablebold = 0;
+int disableitalic = 0;
+int disableroman = 0;
+
 static int borderpx = 2;
 
 /*
diff --git a/x.c b/x.c
index 5828a3b..9663fa6 100644
--- a/x.c
+++ b/x.c
@@ -233,6 +233,11 @@ static char *usedfont = NULL;
 static double usedfontsize = 0;
 static double defaultfontsize = 0;
 
+/* declared in config.h */
+extern int disablebold;
+extern int disableitalic;
+extern int disableroman;
+
 static char *opt_class = NULL;
 static char **opt_cmd  = NULL;
 static char *opt_embed = NULL;
@@ -960,7 +965,10 @@ xloadfonts(char *fontstr, double fontsize)
win.ch = ceilf(dc.font.height * chscale);
 
FcPatternDel(pattern, FC_SLANT);
-   FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+   if (!disableitalic)
+   FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+   if (!disableroman)
+   FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
if (xloadfont(&dc.ifont, pattern))
die("can't open font %s\n", fontstr);
 
-- 
2.21.0




[hackers] [dwm][PATCH] dwm-ewhmtags-6.2

2019-03-29 Thread Ryan Kes
---
 dwm.c | 49 -
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/dwm.c b/dwm.c
index 4465af1..92022a1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -55,6 +55,7 @@
 #define WIDTH(X)((X)->w + 2 * (X)->bw)
 #define HEIGHT(X)   ((X)->h + 2 * (X)->bw)
 #define TAGMASK ((1 << LENGTH(tags)) - 1)
+#define TAGSLENGTH  (LENGTH(tags))
 #define TEXTW(X)(drw_fontset_getwidth(drw, (X)) + lrpad)
 
 /* enums */
@@ -62,7 +63,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
-   NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+   NetWMWindowTypeDialog, NetClientList, NetDesktopNames, 
NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH 
atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms 
*/
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -197,11 +198,15 @@ static void scan(void);
 static int sendevent(Client *c, Atom proto);
 static void sendmon(Client *c, Monitor *m);
 static void setclientstate(Client *c, long state);
+static void setcurrentdesktop(void);
+static void setdesktopnames(void);
 static void setfocus(Client *c);
 static void setfullscreen(Client *c, int fullscreen);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
+static void setnumdesktops(void);
 static void setup(void);
+static void setviewport(void);
 static void seturgent(Client *c, int urg);
 static void showhide(Client *c);
 static void sigchld(int unused);
@@ -216,6 +221,7 @@ static void toggleview(const Arg *arg);
 static void unfocus(Client *c, int setfocus);
 static void unmanage(Client *c, int destroyed);
 static void unmapnotify(XEvent *e);
+static void updatecurrentdesktop(void);
 static void updatebarpos(Monitor *m);
 static void updatebars(void);
 static void updateclientlist(void);
@@ -1431,6 +1437,16 @@ setclientstate(Client *c, long state)
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
PropModeReplace, (unsigned char *)data, 2);
 }
+void
+setcurrentdesktop(void){
+   long data[] = { 0 };
+   XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, 
PropModeReplace, (unsigned char *)data, 1);
+}
+void setdesktopnames(void){
+   XTextProperty text;
+   Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, 
&text);
+   XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
+}
 
 int
 sendevent(Client *c, Atom proto)
@@ -1457,6 +1473,12 @@ sendevent(Client *c, Atom proto)
return exists;
 }
 
+void
+setnumdesktops(void){
+   long data[] = { TAGSLENGTH };
+   XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 
32, PropModeReplace, (unsigned char *)data, 1);
+}
+
 void
 setfocus(Client *c)
 {
@@ -1562,6 +1584,10 @@ setup(void)
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", 
False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, 
"_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+   netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", 
False);
+   netatom[NetNumberOfDesktops] = XInternAtom(dpy, 
"_NET_NUMBER_OF_DESKTOPS", False);
+   netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", 
False);
+   netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", 
False);
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1584,6 +1610,10 @@ setup(void)
/* EWMH support per view */
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast);
+   setnumdesktops();
+   setcurrentdesktop();
+   setdesktopnames();
+   setviewport();
XDeleteProperty(dpy, root, netatom[NetClientList]);
/* select events */
wa.cursor = cursor[CurNormal]->cursor;
@@ -1595,6 +1625,11 @@ setup(void)
grabkeys();
focus(NULL);
 }
+void
+setviewport(void){
+   long data[] = { 0, 0 };
+   XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 
32, PropModeReplace, (unsigned char *)data, 2);
+}
 
 
 void
@@ -1732,6 +1767,7 @@ toggletag(const Arg *arg)
focus(NULL);
arrange(selmon);
}
+   updatecurrentdesktop();
 }
 
 void
@@ -1744,6 +1780,7 @@ toggleview(const Arg *arg)
focus(NULL);
arrange(selmon);
}
+   updatecurrentdesktop();
 }
 
 void
@@ -1846,6 +18