[wiki] [sites] Patch to add individual colors to launcher icons || fennec

From: <git_AT_suckless.org>
Date: Thu, 21 Dec 2023 15:25:28 +0100

commit 1007ac4858cae592264b21fe53a7697af82e5986
Author: fennec <fennec>
Date: Thu Dec 21 14:21:13 2023 +0000

    Patch to add individual colors to launcher icons

diff --git a/dwm.suckless.org/patches/launcher-colors/dwm-launchers-colors-20231221-81aca1b.diff b/dwm.suckless.org/patches/launcher-colors/dwm-launchers-colors-20231221-81aca1b.diff
new file mode 100644
index 00000000..2c490523
--- /dev/null
+++ b/dwm.suckless.org/patches/launcher-colors/dwm-launchers-colors-20231221-81aca1b.diff
_AT_@ -0,0 +1,105 @@
+From 81aca1b1533076fe353bee2d29d169adfca55b44 Mon Sep 17 00:00:00 2001
+From: fennec <xovo6six_AT_gmail.com>
+Date: Thu, 21 Dec 2023 13:53:18 +0000
+Subject: [PATCH] Patch for launcher icon colors
+
+---
+ chadwm/config.def.h | 17 +++++++++++++++++
+ chadwm/dwm.c | 32 +++++++++++++++++++++++++++++++-
+ 2 files changed, 48 insertions(+), 1 deletion(-)
+
+diff --git a/chadwm/config.def.h b/chadwm/config.def.h
+index 45e60b2..fbaf85c 100644
+--- a/chadwm/config.def.h
++++ b/chadwm/config.def.h
+_AT_@ -59,16 +59,32 @@ static const char *colors[][3] = {
+ [SchemeBtnPrev] = { green, black, black },
+ [SchemeBtnNext] = { yellow, black, black },
+ [SchemeBtnClose] = { red, black, black },
++ [SchemeColorEW] = { orange, black, black }, // color ewww launcher icon
++ [SchemeColorFF] = { pink, black, black }, // color firefox launcher icon
++ [SchemeColorDS] = { red, black, black }, // color discord launcher icon
++ [SchemeColorTG] = { green, black, black }, // color telegram launcher icon
++ [SchemeColorMS] = { blue, black, black }, // color mintstick launcher icon
++ [SchemeColorPC] = { yellow, black, black }, // color pavucontrol launcher icon
+ };
+
+ /* tagging */
+ static char *tags[] = {"", "", "", "", ""};
+
+ static const char* eww[] = { "eww", "open" , "eww", NULL };
++static const char* firefox[] = { "firefox", "open", "firefox", NULL };
++static const char* discord[] = { "discord", "open" , "discord", NULL };
++static const char* telegram[] = { "telegram-desktop", "open" , "telegram-desktop", NULL };
++static const char* mintstick[] = { "mintstick", "-m", "iso", NULL};
++static const char* pavucontrol[] = { "pavucontrol", NULL };
+
+ static const Launcher launchers[] = {
+ /* command name to display */
+ { eww, "" },
++ { firefox, "" },
++ { discord, "ﱲ" },
++ { telegram, "" },
++ { mintstick, "虜" },
++ { pavucontrol, "墳" },
+ };
+
+ static const int tagschemes[] = {
+_AT_@ -287,3 +303,4 @@ static const Button buttons[] = {
+ { ClkTabNext, 0, Button1, movestack, { .i = +1 } },
+ { ClkTabClose, 0, Button1, killclient, {0} },
+ };
++
+diff --git a/chadwm/dwm.c b/chadwm/dwm.c
+index ddb7e0c..84639cc 100644
+--- a/chadwm/dwm.c
++++ b/chadwm/dwm.c
+_AT_@ -108,7 +108,13 @@ enum {
+ TabNorm,
+ SchemeBtnPrev,
+ SchemeBtnNext,
+- SchemeBtnClose
++ SchemeBtnClose,
++ SchemeColorEW,
++ SchemeColorFF,
++ SchemeColorDS,
++ SchemeColorTG,
++ SchemeColorMS,
++ SchemeColorPC
+ }; /* color schemes */
+ enum {
+ NetSupported,
+_AT_@ -1519,6 +1525,30 @@ void drawbar(Monitor *m) {
+
+ for (i = 0; i < LENGTH(launchers); i++)
+ {
++ if (launchers[i].command == eww){
++ drw_setscheme(drw, scheme[SchemeColorEW]);
++ }
++
++ if (launchers[i].command == firefox){
++ drw_setscheme(drw, scheme[SchemeColorFF]);
++ }
++
++ if (launchers[i].command == discord){
++ drw_setscheme(drw, scheme[SchemeColorDS]);
++ }
++
++ if (launchers[i].command == telegram){
++ drw_setscheme(drw, scheme[SchemeColorTG]);
++ }
++
++ if (launchers[i].command == mintstick){
++ drw_setscheme(drw, scheme[SchemeColorMS]);
++ }
++
++ if (launchers[i].command == pavucontrol){
++ drw_setscheme(drw, scheme[SchemeColorPC]);
++ }
++
+ w = TEXTW(launchers[i].name);
+ drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, urg & 1 << i);
+ x += w;
+--
+2.43.0
+
diff --git a/dwm.suckless.org/patches/launcher-colors/index.md b/dwm.suckless.org/patches/launcher-colors/index.md
new file mode 100644
index 00000000..b5aec289
--- /dev/null
+++ b/dwm.suckless.org/patches/launcher-colors/index.md
_AT_@ -0,0 +1,139 @@
+launcher-colors
+========
+
+Description
+-----------
+This patch adds colors to the launcher icons which you click to launch programs and commands.
+
+Usage:
+------
+
+File config.def.h
+
+Append new color scheme to the colors array.
+Example below.
+
+ static const char *colors[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { gray3, black, gray2 },
+ [SchemeSel] = { gray4, blue, blue },
+ [SchemeTitle] = { white, black, black }, // active window title
+ [TabSel] = { blue, gray2, black },
+ [TabNorm] = { gray3, black, black },
+ [SchemeTag] = { gray3, black, black },
+ [SchemeTag1] = { blue, black, black },
+ [SchemeTag2] = { red, black, black },
+ [SchemeTag3] = { orange, black, black },
+ [SchemeTag4] = { green, black, black },
+ [SchemeTag5] = { pink, black, black },
+ [SchemeLayout] = { green, black, black },
+ [SchemeBtnPrev] = { green, black, black },
+ [SchemeBtnNext] = { yellow, black, black },
+ [SchemeBtnClose] = { red, black, black },
+ [SchemeColorEW] = { orange, black, black }, // color ewww launcher icon
+ [SchemeColorFF] = { yellow, black, black }, // color firefox launcher icon
+ [SchemeColorDS] = { red, black, black }, // color discord launcher icon
+ [SchemeColorTG] = { green, black, black }, // color telegram launcher icon
+ [SchemeColorMS] = { blue, black, black }, // color mintstick launcher icon
+ [SchemeColorPC] = { pink, black, black }, // color pavucontrol launcher icon
+ };
+
+The command names defined for the launchers are important since these are used again later.
+
+ static const Launcher launchers[] = {
+ /* command name to display */
+ { eww, "" },
+ { firefox, "" },
+ { discord, "ﱲ" },
+ { telegram, "" },
+ { mintstick, "虜" },
+ { pavucontrol, "墳" },
+ };
+
+File dwm.c
+
+Append new color schemes to the enum.
+Example below.
+
+ enum {
+ SchemeNorm,
+ SchemeSel,
+ SchemeTitle,
+ SchemeTag,
+ SchemeTag1,
+ SchemeTag2,
+ SchemeTag3,
+ SchemeTag4,
+ SchemeTag5,
+ SchemeLayout,
+ TabSel,
+ TabNorm,
+ SchemeBtnPrev,
+ SchemeBtnNext,
+ SchemeBtnClose,
+ SchemeColorEW,
+ SchemeColorFF,
+ SchemeColorDS,
+ SchemeColorTG,
+ SchemeColorMS,
+ SchemeColorPC
+ }; /* color schemes */
+
+File dwm.c
+
+Navigate to the line where the following is defined:
+
+ w = TEXTW(m->ltsymbol);
+
+Comment out line
+
+ drw_setscheme(drw, scheme[SchemeLayout]);
+
+Inside the for loop add if conditions to set the different color schemes for each launcher.
+
+Example below.
+Note. The command name should match the ones defined inside config.def.h
+
+ w = TEXTW(m->ltsymbol);
+ //drw_setscheme(drw, scheme[SchemeLayout]);
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+
+ for (i = 0; i < LENGTH(launchers); i++)
+ {
+ if (launchers[i].command == eww){
+ drw_setscheme(drw, scheme[SchemeColorEW]);
+ }
+
+ if (launchers[i].command == firefox){
+ drw_setscheme(drw, scheme[SchemeColorFF]);
+ }
+
+ if (launchers[i].command == discord){
+ drw_setscheme(drw, scheme[SchemeColorDS]);
+ }
+
+ if (launchers[i].command == telegram){
+ drw_setscheme(drw, scheme[SchemeColorTG]);
+ }
+
+ if (launchers[i].command == mintstick){
+ drw_setscheme(drw, scheme[SchemeColorMS]);
+ }
+
+ if (launchers[i].command == pavucontrol){
+ drw_setscheme(drw, scheme[SchemeColorPC]);
+ }
+
+ w = TEXTW(launchers[i].name);
+
+After a rebuild.
+
+The result will be as shown below.
+
+https://imgur.com/a/JsqUKiC
+
+Author
+------
+* [fennec](https://debugthis.dev) <xovo6six_AT_gmail.com>
+
+[dwm-launchers-colors-20231221-81aca1b.diff](dwm-launchers-colors-20231221-81aca1b.diff)
\ No newline at end of file
Received on Thu Dec 21 2023 - 15:25:28 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 21 2023 - 15:36:49 CET