mihirlad55 / polybar-dwm-module

A dwm module for polybar
MIT License
116 stars 15 forks source link

Unchangable Tag colors #21

Closed wmahany closed 3 years ago

wmahany commented 3 years ago

Describe the issue

I went through the instructions on the github page to install the dwm polybar module, and everything works nice and the bar shows up, but for some reason, there are certain colors I can't change(specifically the inactive background and font color, as well as active/focused font color: image

NOTE: This image shows the bar colors when the focus is on my other monitor, which is what is producing the green background.

Expected behavior:

A clear and concise description of what you expected to happen. I should be able to change the colors in the polybar module, but any changes I make there have no effect

Actual behavior: What actually happens Colors, for just unfocused tag background and tag font color, can't be changed.

Was it working before?

I haven't experienced this with i3 or bspwm, just dwm

To Reproduce

A minimal but complete config with which the problem occurs:


Polybar Config

################################################################################
################################################################################
############                         MAINBAR-DWM                    ############
################################################################################
################################################################################

[bar/mainbar-dwm]
;https://github.com/jaagr/polybar/wiki/Configuration

monitor = ${env:MONITOR}
monitor-fallback = HDMI-0
monitor-strict = false
override-redirect = true
bottom = true
fixed-center = true
width = 100%
height = 23
;offset-x = 1%
;offset-y = 1%

background = ${colors.background}
foreground = ${colors.foreground}

; Background gradient (vertical steps)
;   background-[0-9]+ = #aarrggbb
;background-0 =

radius = 0.0
line-size = 2
line-color = #000000

border-size = 0
;border-left-size = 25
;border-right-size = 25
;border-top-size = 0
;border-bottom-size = 25
border-color = #000000

padding-left = 0
padding-right = 0

module-margin-left = 1
module-margin-right = 0

;https://github.com/jaagr/polybar/wiki/Fonts
font-0 = "Noto Sans:size=10;0"
font-1 = "FontAwesome:size=10;0"
font-2 = "Noto Sans:size=10;0"
font-3 = "Noto Sans Mono:size=10;0"

modules-left = dwm
modules-center =
modules-right = spotify previous playpause next sep weather sep wireless-network sep memory2 sep cpu2 sep arch-aur-updates sep  pavolume sep date

separator =

;dim-value = 1.0

tray-detached = true
tray-offset-x = 0
tray-offset-y = 0
tray-padding = 1
tray-maxsize = 20
tray-scale = 1.0
tray-position = center
tray-background = ${colors.background}

#i3: Make the bar appear below windows
;wm-restack = i3
;override-redirect = true

; Enable support for inter-process messaging
; See the Messaging wiki page for more details.
enable-ipc = true

; Fallback click handlers that will be called if
; there's no matching module handler found.
click-left =
click-middle =
click-right = jgmenu_run >/dev/null 2>&1 &
scroll-up =
scroll-down =
double-click-left =
double-click-middle =
double-click-right =

; Requires polybar to be built with xcursor support (xcb-util-cursor)
; Possible values are:
; - default   : The default pointer as before, can also be an empty string (default)
; - pointer   : Typically in the form of a hand
; - ns-resize : Up and down arrows, can be used to indicate scrolling
cursor-click =
cursor-scroll =

DWM Config.h:

/* See LICENSE file for copyright and license details. */

/* appearance */
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const unsigned int systraypinning = 2;   /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2;   /* systray spacing */
static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray        = 0;     /* 0 means no systray */
static const int showbar            = 1;        /* 0 means no bar */
static const int user_bh        = 23;       /* 0 means dwm will do bar height, any other number is the height of the bar */
static const int topbar             = 0;        /* 0 means bottom bar */
static const char *fonts[]          = { "monospace:size=10" };
static const char dmenufont[]       = "monospace:size=10";
static const char col_gray1[]       = "#222222";
static const char col_gray2[]       = "#444444";
static const char col_gray3[]       = "#bbbbbb";
static const char col_gray4[]       = "#eeeeee";
static const char col_cyan[]        = "#ebdbb2";
static const char *colors[][3]      = {
    /*               fg         bg         border   */
    [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
    [SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
    [SchemeHid]  = { col_cyan,  col_gray1, col_cyan  },
};

/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };

static const Rule rules[] = {
    /* xprop(1):
     *  WM_CLASS(STRING) = instance, class
     *  WM_NAME(STRING) = title
     */
    /* class      instance    title       tags mask     iscentered     isfloating   monitor */
    { "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
    { "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
    { "Steam",    NULL,       NULL,       1 << 8,       1,             0,           -1 },
};

/* layout(s) */
static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster     = 1;    /* number of clients in master area */
static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */

#include "layouts.c"
static const Layout layouts[] = {
    /* symbol     arrange function */
    { "[]=",      tile },    /* first entry is default */
    { "[M]",      monocle },
    { "TTT",      bstack },
    { "|M|",      centeredmaster },
    { "HHH",      grid },
};

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
    { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL };
static const char *termcmd[]  = { "st", "-e", "fish", NULL };

static Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    { MODKEY,                       XK_space,  spawn,          {.v = dmenucmd } },
    { MODKEY,                       XK_j,      focusstackvis,  {.i = +1 } },
    { MODKEY,                       XK_k,      focusstackvis,  {.i = -1 } },
    { MODKEY,                       XK_m,      incnmaster,     {.i = +1 } },
    { MODKEY,                       XK_n,      incnmaster,     {.i = -1 } },
    { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    { MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
    { MODKEY,                       XK_Tab,    view,           {0} },
    { MODKEY,                       XK_q,      killclient,     {0} },
    { MODKEY,                       XK_v,      cyclelayout,    {.i = +1 } },
    { MODKEY,                       XK_c,      cyclelayout,    {.i = -1 } },
    { MODKEY,                       XK_z,      setlayout,      {0} },
    { MODKEY|ShiftMask,             XK_z,      togglefloating, {0} },
    { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    TAGKEYS(                        XK_a,                      0)
    TAGKEYS(                        XK_s,                      1)
    TAGKEYS(                        XK_d,                      2)
    TAGKEYS(                        XK_f,                      3)
    TAGKEYS(                        XK_u,                      4)
    TAGKEYS(                        XK_i,                      5)
    TAGKEYS(                        XK_o,                      6)
    TAGKEYS(                        XK_p,                      7)
    { MODKEY|ShiftMask,             XK_e,      quit,           {0} },
};

/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
    /* click                event mask      button          function        argument */
    { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    { ClkWinTitle,          0,              Button3,        togglefloating, {0} },
    { ClkWinTitle,          0,              Button2,        killclient,     {0} },
    { ClkWinTitle,          0,              Button1,        togglewin,      {0} },
    { ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    /*{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },*/
    { ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    { ClkTagBar,            0,              Button1,        view,           {0} },
    { ClkTagBar,            0,              Button3,        toggleview,     {0} },
    { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};

static const char *ipcsockpath = "/tmp/dwm.sock";
static IPCCommand ipccommands[] = {
  IPCCOMMAND(  view,                1,      {ARG_TYPE_UINT}   ),
  IPCCOMMAND(  toggleview,          1,      {ARG_TYPE_UINT}   ),
  IPCCOMMAND(  tag,                 1,      {ARG_TYPE_UINT}   ),
  IPCCOMMAND(  toggletag,           1,      {ARG_TYPE_UINT}   ),
  IPCCOMMAND(  tagmon,              1,      {ARG_TYPE_UINT}   ),
  IPCCOMMAND(  focusmon,            1,      {ARG_TYPE_SINT}   ),
  IPCCOMMAND(  focusstack,          1,      {ARG_TYPE_SINT}   ),
  IPCCOMMAND(  zoom,                1,      {ARG_TYPE_NONE}   ),
  IPCCOMMAND(  incnmaster,          1,      {ARG_TYPE_SINT}   ),
  IPCCOMMAND(  killclient,          1,      {ARG_TYPE_SINT}   ),
  IPCCOMMAND(  togglefloating,      1,      {ARG_TYPE_NONE}   ),
  IPCCOMMAND(  setmfact,            1,      {ARG_TYPE_FLOAT}  ),
  IPCCOMMAND(  setlayoutsafe,       1,      {ARG_TYPE_PTR}    ),
  IPCCOMMAND(  quit,                1,      {ARG_TYPE_NONE}   )
};

List any other steps needed to reproduce the issue besides starting polybar with the config you posted above.

Polybar Log

Post everything polybar outputs to the terminal when you run it and the issue occurs below

Screenshots

If applicable, add screenshots to help explain your problem.

polybar with focus polybar with focus

polybar without focus polybar without focus

Features: +alsa +curl +dwm +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release Compiler: /usr/bin/c++ Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -Wextra -Wpedantic -O3 -DNDEBUG Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now

Additional context

Add any other context that you think is necessary about the problem here. These are the patches that I have installed with DWM:

dwm-attachaside-20180126-db22360.diff dwm-autostart-20200610-cb3f58a.diff dwm-awesomebar-20200907-6.2.diff dwm-bottomstack-6.1.diff dwm-center-20160719-56a31dc.diff dwm-centeredmaster-20160719-56a31dc.diff dwm-cyclelayouts-20180524-6.2.diff dwm-gridmode-20170909-ceac8c9.diff dwm-ipc-20201106-f04cac6.diff dwm-noborder-6.2.diff dwm-pertag-20200914-61bb8b2.diff dwm-steam-6.2.diff dwm-systray-20200914-61bb8b2.diff

wmahany commented 3 years ago

I'm just dumb. The default config for the dwm module doesn't include lines for focused foreground or unfocused background/foreground. Added the appropriate lines and my issue is fixed.