Quick question for polybar colors,scripts

in polybar i have a script to check for pacman updates the amount of pkgs and so forth but is there a thunderbird script for emails?

plus i have a minor issue with my icon colors in polybar, it works fine in arch but as soon as i got it running in archlabs the icons are white instead of colorfull…i use tttf-awesome and emojis and i have installed the pkgs on AL …its weird …it does the same thing in spectrwm. bar

here is my config

[colors]
;background = ${xrdb:color0:#222}
background = #131C26
background-alt = #3B4252
;foreground = ${xrdb:color7:#222}
foreground = #ffffff
foreground-alt = #ffffff
primary = #ffb52a
secondary = #e60053
alert = #bd2c40

[bar/mybar]
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 28
;offset-x = 1%
;offset-y = 1%
radius = 0.0
fixed-center = false

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

line-size = 0
line-color = #f00

border-size = 0
border-color = #00000000

padding-left = 0
padding-right = 2

module-margin-left = 1
module-margin-right = 2

font-0 = fixed:pixelsize=12;2
font-1 = unifont:fontformat=truetype:size=12:antialias=false;0
font-2 = siji:pixelsize=12;2
font-3 = FontAwesome5Free:style=Solid:size=10;4
font-4 = FontAwesome5Free:style=Regular:size=10;4
font-5 = FontAwesome5Brands:style=Regular:size=10;4
font-6 = Emoji:scale=12;0

modules-left = bspwm i3 openbox xwindow
modules-center =
modules-right =file broswer term editor kernel pacman-updates pkgs filesystem temp cpu memory xkeyboard alsa date #eth powermenu
tray-position = right
tray-padding = 2

#seperator = |

;tray-background = #0063ff

wm-restack = bspwm
;wm-restack = i3

#over ride-redirect = true

scroll-up = bspwm-desknext
scroll-down = bspwm-deskprev

;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev

cursor-click = pointer
cursor-scroll = ns-resize

[module/bspwm]
type = internal/bspwm

enable-click = true
enable-scroll = true
reverse-scroll = true
pin-workspaces = true

ws-icon-0 = I;I
ws-icon-1 = II; II
ws-icon-2 = III;III
ws-icon-3 = IV;IV
ws-icon-4 = V;V
#ws-icon-5 = VI;VI
#ws-icon-6 = VII;VII
#ws-icon-7 = VIII;VIII
#ws-icon-8 = IX;IX
#ws-icon-9 = X;X

format =

label-focused = %icon%
label-focused-background = ${colors.background}
label-focused-underline= #6790eb
label-focused-padding = 2
label-focused-foreground = ${colors.foreground}

label-occupied = %icon%
label-occupied-padding = 2
label-occupied-background = ${colors.background}

label-urgent = %icon%
label-urgent-padding = 2

label-empty = %icon%
label-empty-foreground = ${colors.foreground}
label-empty-padding = 2
label-empty-background = ${colors.background}
label-monocle = "  "
label-monocle-foreground = ${colors.foreground}
label-tiled = " :eye: "
label-tiled-foreground = ${colors.foreground}
label-fullscreen = "  "
label-fullscreen-foreground = ${colors.foreground}
label-floating = "  "
label-floating-foreground = ${colors.foreground}
label-pseudotiled = "  "
label-pseudotiled-foreground = ${colors.foreground}
label-locked = "  "
label-locked-foreground = ${colors.foreground}
label-sticky = "  "
label-sticky-foreground = ${colors.foreground}
label-private = "  "
label-private-foreground = ${colors.foreground}

; Separator in between workspaces
#label-separator = |
#abel-separator-padding = 2
;label-separator-foreground = #ffb52a

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

[module/i3]
type = internal/i3
format =
index-sort = true
wrapping-scroll = false

; Only show workspaces on the same output as the bar
;pin-workspaces = true

label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}

; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2

; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = 2

; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}

; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = 2

; Separator in between workspaces
#label-separator = |

[module/pkgs]
type = custom/script
exec = pacman -Q | wc -l
interval = 1000
label = Pkgs: %output%
format-prefix = “:smiling_imp:
format-prefix-foreground = #fefefe
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/pacman-updates]
type = custom/script
exec = checkupdates | wc -l
interval = 1000
label = Pacman: %output%
format-prefix = "  "
format-prefix-foreground = ${xrdb:color7:#E4AD0D}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/temp]
type = custom/script
exec = ~/.config/polybar/scripts/temp.sh
label = “%output%”
format-prefix=":fire: "
interval = 2

[module/kernel]
type = custom/script
exec = uname -r
tail = true
interval = 1000
format-prefix = "  "

[module/file]
type = custom/script
format-prefix = "  "
exec = echo “File”
click-left = “pcmanfm >/dev/null 2>&1 &”
format-prefix-foreground = ${xrdb:color7:#00ced1}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/term]
type = custom/script
format-prefix = "  "
exec = echo “Term”
click-left = “termite >/dev/null 2>&1 &”
format-prefix-foreground = ${xrdb:color7:#7BB4FF}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/editor]
type = custom/script
format-prefix = "  "
exec = echo “Geany”
click-left = “geany >/dev/null 2>&1 &”
format-prefix-foreground = ${xrdb:color7:#00ff00}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/broswer]
type = custom/script
format-prefix = "  "
exec = echo “Firefox”
click-left = “firefox >/dev/null 2>&1 &”
format-prefix-foreground = ${xrdb:color7:#A52A2A}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/xwindow]
type = internal/xwindow
label = %title:0:30:…%

[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock

format-prefix = ":earth_americas: "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}

label-layout = %layout%
label-layout-underline = ${colors.secondary}

label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}

[module/filesystem]
type = internal/fs
interval = 25

mount-0 = /

label-mounted = :beginner: %free%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}

[module/eth]
type = internal/network
interface = enp2s0
interval = 3.0

format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${xrdb:color7:#808080}
label-connected = %local_ip%

[module/cpu]
type = internal/cpu
interval = 2
format-prefix = “”
label = %percentage:2%%
format-prefix-foreground = ${xrdb:color7:#228B22}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

[module/memory]
type = internal/memory
interval = 2
format-prefix = “”
format-prefix-foreground = ${xrdb:color7:#A52A2A}
format-underline = #4bffdc
label = %percentage_used%%

[module/date]
type = internal/date
interval = 5

date =
date-alt = " %Y-%m-%d"

time = %H:%M
time-alt = %H:%M:%S

format-prefix =🕒
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5

label = %date% %time%

[module/alsa]
type = internal/alsa
master-mixer = Master
format-volume-padding = 1
label-volume-foreground = ${colors.foreground}
label-volume = ":loud_sound: "%{A3:pavucontrol & disown:}%percentage:2%% %{A}
format-volume =
label-muted = " muted "
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-volume-3 = 

format-charging =
format-charging-underline = #ffb52a

format-discharging =
format-discharging-underline = ${self.format-charging-underline}

format-full-prefix = " "
format-full-prefix-foreground = ${colors.foreground-alt}
format-full-underline = ${self.format-charging-underline}

ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-foreground = ${colors.foreground-alt}

animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750

animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-foreground = ${colors.foreground-alt}
animation-discharging-framerate = 750

[module/powermenu]
type = custom/menu

expand-right = false

format-spacing = 1

label-open =
label-open-foreground = ${colors.secondary}
label-close =  cancel
label-close-foreground = ${colors.secondary}
label-separator = |
label-separator-foreground = ${colors.foreground-alt}

menu-0-0 = reboot
menu-0-0-exec = systemctl reboot
menu-0-1 = power off
menu-0-1-exec = systemctl poweroff
menu-0-2 = logout
menu-0-2-exec = pkill -KILL -u panos21

[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false

[global/wm]
margin-top = 5
margin-bottom = 5

; vim:ft=dosini

i found this script but i kinda dont get where i put the email username passwd and if thunderbird is needed at all

#!/bin/sh

SERVER=""
NETRC=".netrc"

inbox=$(curl -sf --netrc-file “$NETRC” -X “STATUS INBOX (UNSEEN)” imaps://"$SERVER"/INBOX | tr -d -c “[:digit:]”)

if [ “$inbox” ] && [ “$inbox” -gt 0 ]; then
echo “# $inbox”
else
echo “”
fi

[module/inbox-imap-shellnetrc]
type = custom/script
exec = ~/polybar-scripts/inbox-imap-shellnetrc.sh
interval = 60

hello, where did you store the “.netrc” file ? Just indicate the path to this file in the variable:

NETRC="path_to_the_.netrc_file"

.netrc

machine my_imap_mailserver
login username
password supersecretpw

Here’s a python script that I use

import imaplib
obj = imaplib.IMAP4_SSL(‘MYIMAPSERVER’,993)
obj.login(‘MYUSERNAME’,‘MYPASSWD’)
obj.select()
print(len(obj.search(None, ‘UnSeen’)[1][0].split()))

polybar module:

[module/imap]
type = custom/script
exec = python3 ~/.config/polybar/scripts/imap.py
interval = 1800
format = <label>
format-prefix = " "
format-prefix-foreground = ${colors.grn2}
label-padding = 1
label-foreground = ${colors.mag}
click-left = YOUR MAIL CLIENT HERE &
format-padding = 1
1 Like

For your polybar config, I suggest you to separate sections into multiple files, because it’s a mess :laughing:

$HOME/.config/polybar/config: (note the header of this file.)

;=====================================================
; File Includes
;=====================================================

[section/base]
include-file = $HOME/.config/polybar/modules.conf
include-file = $HOME/.config/polybar/bars.conf

;=====================================================
; Colors & Settings
;=====================================================

[colors]
background = ${xrdb:background}
background-alt = {xrdb:color0}
foreground = ${xrdb:foreground}
foreground-alt = ${xrdb:color15}
blk = ${xrdb:color0}
red = ${xrdb:color1}
grn = ${xrdb:color2}
ylw = ${xrdb:color3}
blu = ${xrdb:color4}
mag = ${xrdb:color5}
cyn = ${xrdb:color6}
wht = ${xrdb:color7}
border = #598799
muted = #D33C28
trim = ${xrdb:color8}
urgent = ${xrdb:color1}

[settings]
throttle-output = 5
throttle-output-for = 10
throttle-input-for = 30
compositing-background = source
compositing-foreground = source
compositing-overline = source
compositing-underline = source
compositing-border = source
screenchange-reload = true
format-foreground = ${colors.foreground}
format-foreground-alt = ${colors.foreground-alt}
format-background = ${colors.background}
format-background-alt = ${colors.background-alt}
overline-color = ${colors.foreground}

$HOME/.config/polybar/bars.conf:

;=====================================================
; Master Bar
;=====================================================

[bar/master]
width = 100%
height = 27
border-size = 0
border-top-size = 0
border-bottom-size = 0
radius = 0
bottom = false
line-size = 2

; monospace is an aliased font name, see ~/.config/fontconfig/fonts.conf
; To determine the exact syntax for font definition,
; type $ fc-list | grep -i MYFONTNAME
font-0 = Hack Regular:size=10.5;2
font-1 = FontAwesome:style=Regular:size=11;2
font-2 = Weather Icons:size=12;1

offset-x = 0
offset-y = 0
fixed-center = true
border-color = ${colors.border}
background = ${colors.background}
background-alt = ${colors.background-alt}
foreground = ${colors.foreground}
foreground-alt = ${colors.foreground-alt}
module-margin = 0
padding-right = 0
padding-left = 0
separator =
; shows which modules have click actions
cursor-click = pointer
enable-ipc = true

;=====================================================
; I3 Bar [ IMPORTANT inherit = bar/master ]
;=====================================================

[bar/i3-bar]
inherit = bar/master

; Use $ xrandr -q | grep " connected" | cut -d ’ ’ -f1
monitor = HDMI-0
;wm-restack = i3
modules-left = i3 caps_lock mpd
modules-center = openweathermap
modules-right = ${env:POLYBAR_MODULES: coretemp networkspeed date}

;=====================================================
; Bspwm Bar [ IMPORTANT inherit = bar/master ]
;=====================================================

[bar/bspwm-bar]
inherit = bar/master

; Use $ xrandr -q | grep " connected" | cut -d ’ ’ -f1
monitor = HDMI-0
wm-restack = bspwm
modules-left = bspwm caps_lock mpd
modules-center = openweathermap
modules-right = ${env:POLYBAR_MODULES: coretemp networkspeed date}

$HOME/.config/polybar/modules.conf:

[module/date]
type = internal/date
interval = 60
label = %date% %time%
label-foreground = ${colors.foreground}
date =
date-alt = " %a %b %d, %Y -"
time = %H:%M
time-alt = %H:%M:%S
;format-prefix =" "
format-prefix =" "
format-prefix-foreground = ${colors.grn2}
format-padding = 1

… of course make it your own and don’t forget to make different scripts to launch your BARS, with accurate bars names eg:

polybar bspwm-bar -r >/dev/null &

polybar i3-bar -r >/dev/null &

1 Like

yee i know its a mess but i dont understand how the same polybar i configured in arch wont have custom coloring in archlabs this is so weird …my icons have color towards the right end of the bar only and either i replace them with joypixels or font awesome and colorize them wont change anything

For example in this module the colors are not well configured eg: format-prefix-foreground = ${xrdb:color7:#E4AD0D}

[module/pacman-updates]
type = custom/script
exec = checkupdates | wc -l
interval = 1000
label = Pacman: %output%
format-prefix = "  "
format-prefix-foreground = ${xrdb:color7:#E4AD0D}
format-foreground = ${colors.foreground}
format-background = ${colors.background}

i cant get it to change colors for nothing… its obviously the foreground i want to change the color too …im sorry man the same config works on arch and it wont on AL lol its driving me crazy so i uninstalled polybar installed the git version and started from scratch … then installed ttf-unicode and a couple of other that were missing now im going through my arch pkgs to see if something missing …ughh lol il get it sooner than later… the thing is the emoji work fine but the one were it says pkgs should work…but doesnt and if i just changed the rest of the ttf-unicode fonts to emoji id be done by now lol

Does your ~/.Xresources is configured the same way or exist ?

yes it exists i merged it with xdefaults so lxappearance would work i think i got it

[module/pacman-updates]
type = custom/script
exec = checkupdates | wc -l
interval = 1000
label = Pacman: %output%
format-prefix = "  "
format-prefix-foreground =#E4AD0D

take it i dont need the rest of the stuff plus i had to disable border color

but xresources is for urxvt and xterm i see… now emojis wont work in polybar

Not only terminal applications

This is related to ~/.Xresources ! dependencies

like the stock theming of ALis tempering with the polybar which is ${xrdb:color7:#E4AD0D} i see…i thank you for your help!! now off to clean this mess of a config! and of course try your python script i havent gotten to it yet so il be probably asking you a question or two tomorrow

o i got one how to you get your imap server info and is thunderbird required for notifications…or dunst which i never got reasearching into…

so imap is basically imap.gmail.com

its saying line 2 is wrong in imap.py

obj = imaplib.IMAP4_SSL(‘imap.gmail.com’,993)

Login to your gmail account and change your security settings.

i did i read your guys whole thread

i got it thank you sir!!!