dwm-qubesrules-6.3.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-qubesrules-6.3.diff (2398B)
       ---
            1 From: 3o14r473 <3o14@pm.me> E4FE E61C 3B02 F4CA B6D8  0CA7 F105 757D 34BE FA98
            2 Donate: monero:41rMoMLvk8hEJYP2vbv3dNUGzN95CLXoANAtmAVaUxzse5KfPjhkE7d4PUwh8kCkF16FwwqfZTmS4ZKmYCjrsFAcGXTPpwH
            3 Subject: [PATCH] dwm-qubesrules-6.3.diff 
            4 
            5 This patch allows dwm to use QubesOS-specific
            6 window properties, _QUBES_LABEL and _QUBES_VMNAME, in its rulematching.
            7 
            8 It needs to be applied on top of the qubesdecorations patch.
            9 ---
           10  config.def.h | 8 +++++---
           11  dwm.c        | 6 ++++++
           12  2 files changed, 11 insertions(+), 3 deletions(-)
           13 
           14 diff --git a/config.def.h b/config.def.h
           15 index 42dce05..b246392 100644
           16 --- a/config.def.h
           17 +++ b/config.def.h
           18 @@ -40,12 +40,14 @@ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
           19  
           20  static const Rule rules[] = {
           21          /* xprop(1):
           22 +         *        _QUBES_LABEL(CARDINAL) = label
           23 +         *        _QUBES_VMNAME(STRING) = qube
           24           *        WM_CLASS(STRING) = instance, class
           25           *        WM_NAME(STRING) = title
           26           */
           27 -        /* class      instance    title       tags mask     isfloating   monitor */
           28 -        { "Gimp",     NULL,       NULL,       0,            1,           -1 },
           29 -        { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
           30 +        /* label  qube        class      instance    title       tags mask     isfloating   monitor */
           31 +         { 0,    "personal", "Gimp",     NULL,       NULL,       0,            1,           -1 },
           32 +         { 6,     NULL,      "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
           33  };
           34  
           35  /* layout(s) */
           36 diff --git a/dwm.c b/dwm.c
           37 index be99dde..9a71902 100644
           38 --- a/dwm.c
           39 +++ b/dwm.c
           40 @@ -86,6 +86,7 @@ typedef struct {
           41  typedef struct Monitor Monitor;
           42  typedef struct Client Client;
           43  struct Client {
           44 +        int label;
           45          char vmname[256];
           46          char name[256];
           47          float mina, maxa;
           48 @@ -135,6 +136,8 @@ struct Monitor {
           49  };
           50  
           51  typedef struct {
           52 +        int label;
           53 +        const char *qube;
           54          const char *class;
           55          const char *instance;
           56          const char *title;
           57 @@ -301,6 +304,8 @@ applyrules(Client *c)
           58          for (i = 0; i < LENGTH(rules); i++) {
           59                  r = &rules[i];
           60                  if ((!r->title || strstr(c->name, r->title))
           61 +                && (!r->label || (c->label == r->label))
           62 +                && (!r->qube || strstr(c->vmname, r->qube))
           63                  && (!r->class || strstr(class, r->class))
           64                  && (!r->instance || strstr(instance, r->instance)))
           65                  {
           66 @@ -1076,6 +1081,7 @@ manage(Window w, XWindowAttributes *wa)
           67                  c->tags = t->tags;
           68          } else {
           69                  c->mon = selmon;
           70 +                c->label = getlabel(c);
           71                  applyrules(c);
           72          }
           73  
           74 -- 
           75 2.30.2
           76