sites

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

index.md (4095B)


      1 launcher-colors
      2 ========
      3 
      4 Description
      5 -----------
      6 This patch adds colors to the launcher icons which you click to launch programs and commands.
      7 
      8 Usage:
      9 ------
     10 
     11 File config.def.h
     12 
     13 Append new color scheme to the colors array.
     14 Example below.
     15 
     16     static const char *colors[][3]      = {
     17         /*                     fg       bg      border */
     18         [SchemeNorm]       = { gray3,   black,  gray2 },
     19         [SchemeSel]        = { gray4,   blue,   blue  },
     20         [SchemeTitle]      = { white,   black,  black  }, // active window title
     21         [TabSel]           = { blue,    gray2,  black },
     22         [TabNorm]          = { gray3,   black,  black },
     23         [SchemeTag]        = { gray3,   black,  black },
     24         [SchemeTag1]       = { blue,    black,  black },
     25         [SchemeTag2]       = { red,     black,  black },
     26         [SchemeTag3]       = { orange,  black,  black },
     27         [SchemeTag4]       = { green,   black,  black },
     28         [SchemeTag5]       = { pink,    black,  black },
     29         [SchemeLayout]     = { green,   black,  black },
     30         [SchemeBtnPrev]    = { green,   black,  black },
     31         [SchemeBtnNext]    = { yellow,  black,  black },
     32         [SchemeBtnClose]   = { red,     black,  black },
     33         [SchemeColorEW]    = { orange,   black,  black }, // color ewww launcher icon
     34         [SchemeColorFF]    = { yellow,   black,  black }, // color firefox launcher icon
     35         [SchemeColorDS]    = { red,   black,  black }, // color discord launcher icon
     36         [SchemeColorTG]    = { green,   black,  black }, // color telegram launcher icon
     37         [SchemeColorMS]    = { blue,   black,  black }, // color mintstick launcher icon
     38         [SchemeColorPC]    = { pink,   black,  black }, // color pavucontrol launcher icon
     39     };
     40 
     41 The command names defined for the launchers are important since these are used again later.
     42 
     43     static const Launcher launchers[] = {
     44         /* command     name to display */
     45         { eww,         "" },
     46         { firefox,         "" },
     47         { discord,       "ﱲ" },
     48         { telegram,      "" },
     49         { mintstick,     "虜" },
     50         { pavucontrol,   "墳" },
     51     };
     52 
     53 File dwm.c
     54 
     55 Append new color schemes to the enum.
     56 Example below.
     57 
     58     enum {
     59     SchemeNorm,
     60     SchemeSel,
     61     SchemeTitle,
     62     SchemeTag,
     63     SchemeTag1,
     64     SchemeTag2,
     65     SchemeTag3,
     66     SchemeTag4,
     67     SchemeTag5,
     68     SchemeLayout,
     69     TabSel,
     70     TabNorm,
     71     SchemeBtnPrev,
     72     SchemeBtnNext,
     73     SchemeBtnClose,
     74     SchemeColorEW,
     75     SchemeColorFF,
     76     SchemeColorDS,
     77     SchemeColorTG,
     78     SchemeColorMS,
     79     SchemeColorPC
     80     }; /* color schemes */
     81 
     82 File dwm.c
     83 
     84 Navigate to the line where the following is defined:
     85 
     86     w = TEXTW(m->ltsymbol);
     87 
     88 Comment out line
     89     
     90     drw_setscheme(drw, scheme[SchemeLayout]);
     91 
     92 Inside the for loop add if conditions to set the different color schemes for each launcher.
     93 
     94 Example below.
     95 Note. The command name should match the ones defined inside config.def.h
     96 
     97     w = TEXTW(m->ltsymbol);
     98     //drw_setscheme(drw, scheme[SchemeLayout]);
     99     x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
    100     
    101     for (i = 0; i < LENGTH(launchers); i++)
    102     {
    103         if (launchers[i].command == eww){
    104             drw_setscheme(drw, scheme[SchemeColorEW]);
    105         }
    106 
    107         if (launchers[i].command == firefox){
    108           drw_setscheme(drw, scheme[SchemeColorFF]);
    109         }
    110 
    111         if (launchers[i].command == discord){
    112           drw_setscheme(drw, scheme[SchemeColorDS]);
    113         }
    114 
    115         if (launchers[i].command == telegram){
    116           drw_setscheme(drw, scheme[SchemeColorTG]);
    117         }
    118 
    119         if (launchers[i].command == mintstick){
    120           drw_setscheme(drw, scheme[SchemeColorMS]);
    121         }
    122 
    123         if (launchers[i].command == pavucontrol){
    124           drw_setscheme(drw, scheme[SchemeColorPC]);
    125         }
    126 
    127         w = TEXTW(launchers[i].name);
    128 
    129 After a rebuild.
    130 
    131 The result will be as shown below.
    132 
    133 https://imgur.com/a/JsqUKiC
    134 
    135 Author
    136 ------
    137 * [fennec](https://debugthis.dev) <xovo6six@gmail.com>
    138 
    139 [dwm-launchers-colors-20231221-81aca1b.diff](dwm-launchers-colors-20231221-81aca1b.diff)