From 385ea67efd6ea2402bdaef1a9e8b31f9f7265a77 Mon Sep 17 00:00:00 2001 From: M1dgard Date: Sun, 20 May 2018 23:37:43 +0200 Subject: [PATCH] Add battery ramps and detailed clocks Like the wlan strength icons, the clocks and battery ramps draw multiple glyphs at the same location to create multi-coloured icons. For them to show up, you need my Bar Material Supplement font, which isn't published yet because I haven't decided on a license nor on a way to host it. --- polybar/clock.py | 28 +++++++++++------ polybar/config.ini | 77 +++++++++++++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 31 deletions(-) diff --git a/polybar/clock.py b/polybar/clock.py index 191074f..e359dc8 100755 --- a/polybar/clock.py +++ b/polybar/clock.py @@ -19,13 +19,14 @@ try: exit(1) - faces = "🕛🕧🕐🕜🕑🕝🕒🕞🕓🕟🕔🕠🕕🕡🕖🕢🕗🕣🕘🕤🕙🕥🕚🕦🕛" + hourhands = "" + minutehands = "" def face_for(t): - minute = (t.minute + 15) // 30 - hour = (t.hour + 0 if minute < 45 else 1) % 12 + minute = minutehands[ t.minute // 5 ] + hour = hourhands [ t.hour % 12 ] - return faces[2*hour + minute] + return "%{F000}%{O-24}" + hour + "%{O-24}" + minute def color_for(t): @@ -47,15 +48,24 @@ try: leftnow = utcnow.astimezone(tzleft ) rightnow = utcnow.astimezone(tzright) print( - "%{T2}%{F#" + color_for(leftnow) + "}" + + localnow.strftime("%A") + + " " + + + "%{T8}%{F#" + color_for(leftnow) + "}" + face_for(leftnow) + - "%{F}%{T-} " + + "%{F}%{T-}" + - localnow.strftime("%A %%{T4}%%{F"+color_for(localnow)+"}%H:%M%%{F}%%{T-} %d %b") + + " %{F"+color_for(localnow)+"}" + + # "%{T4}" + localnow.strftime("%H:%M") + "%{T-}" + + "%{T8}" + face_for(localnow) + "%{T-}" + + "%{F} " + - " %{T2}%{F#" + color_for(rightnow) + "}" + + "%{T8}%{F#" + color_for(rightnow) + "}" + face_for(rightnow) + - "%{F}%{T-}", + "%{F}%{T-}" + + + " " + + localnow.strftime("%d %b"), flush = True ) diff --git a/polybar/config.ini b/polybar/config.ini index 44b1aa6..05693d7 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -47,9 +47,10 @@ font-3 = "Fira Sans:size=12;2" font-4 = "Fira Mono:size=7;0" ; Specialised icons font-5 = "Weather Icons:size=10;1" -font-6 = "Material Wifi Signal strength:pixelsize=14;2" +font-6 = "Bar Material Supplements:pixelsize=14;1" +font-7 = "Bar Material Supplements:pixelsize=19;4" ; MPD song position -font-7 = "Fira Mono:size=7;-1" +font-8 = "Fira Mono:size=7;-1" cursor-click = pointer cursor-scroll = ns-resize @@ -98,7 +99,7 @@ label-indicator-background = ${colors.secondary} [module/filesystem] type = internal/fs -interval = 25 +interval = 24 mount-0 = / @@ -224,7 +225,7 @@ card = intel_backlight [module/cpu] type = internal/cpu -interval = 2 +interval = 3 ;format-prefix = " " format = %{O-20} format-foreground = ${colors.foreground-alt} @@ -256,7 +257,7 @@ ramp-coreload-7-foreground = ${colors.foreground-alert} [module/memory] type = internal/memory -interval = 2 +interval = 3 format = "