dwm-anybar-v1.0.3-to-v1.1.0.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-anybar-v1.0.3-to-v1.1.0.diff (1855B)
       ---
            1 From 8503e750d1e4627365b070db1ba44704ccddba0c Mon Sep 17 00:00:00 2001
            2 From: mihirlad55 <mihirlad55@gmail.com>
            3 Date: Mon, 10 Aug 2020 01:39:28 +0000
            4 Subject: [PATCH] Update from v1.0.3 to v1.1.0
            5 
            6 - The altbarcmd variable is added to config.def.h where the launch command for
            7   the bar can be specified. This method of launching the bar ensures that the
            8   bar does not launch too early before dwm is ready.
            9 ---
           10  config.def.h | 1 +
           11  dwm.c        | 9 +++++++++
           12  2 files changed, 10 insertions(+)
           13 
           14 diff --git a/config.def.h b/config.def.h
           15 index cb32018..d0d60aa 100644
           16 --- a/config.def.h
           17 +++ b/config.def.h
           18 @@ -7,6 +7,7 @@ static const int showbar            = 1;        /* 0 means no bar */
           19  static const int topbar             = 1;        /* 0 means bottom bar */
           20  static const int usealtbar          = 1;        /* 1 means use non-dwm status bar */
           21  static const char *altbarclass      = "Polybar"; /* Alternate bar class name */
           22 +static const char *altbarcmd        = "$HOME/bar.sh"; /* Alternate bar launch command */
           23  static const char *fonts[]          = { "monospace:size=10" };
           24  static const char dmenufont[]       = "monospace:size=10";
           25  static const char col_gray1[]       = "#222222";
           26 diff --git a/dwm.c b/dwm.c
           27 index 74ec400..f149ab4 100644
           28 --- a/dwm.c
           29 +++ b/dwm.c
           30 @@ -208,6 +208,7 @@ static void seturgent(Client *c, int urg);
           31  static void showhide(Client *c);
           32  static void sigchld(int unused);
           33  static void spawn(const Arg *arg);
           34 +static void spawnbar();
           35  static void tag(const Arg *arg);
           36  static void tagmon(const Arg *arg);
           37  static void tile(Monitor *);
           38 @@ -1630,6 +1631,7 @@ setup(void)
           39          XSelectInput(dpy, root, wa.event_mask);
           40          grabkeys();
           41          focus(NULL);
           42 +        spawnbar();
           43  }
           44  
           45  
           46 @@ -1688,6 +1690,13 @@ spawn(const Arg *arg)
           47          }
           48  }
           49  
           50 +void
           51 +spawnbar()
           52 +{
           53 +        if (*altbarcmd)
           54 +                system(altbarcmd);
           55 +}
           56 +
           57  void
           58  tag(const Arg *arg)
           59  {
           60 -- 
           61 2.28.0
           62