From 1215d7270fb879a12886d3a0fb50431d485a50fd Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Thu, 16 Dec 2021 17:13:34 +0100 Subject: [PATCH] [polybar] Improve clock and battery Make the hands in the font zero-width; now the clock *without* filled face is independent of font size. The clock *with* filled face is not. Its elements (face, hands) have to be in a specific order (hands must come after face), the face would obscure the hands if it's the other way around. But since the font has zero-width for the hands, not the face (and this makes the most sense), the filled-face clock still relies on a hardcoded offset (as before, 27 units are subtracted to move the hands, but now that the hands are zero-width, we add them back after emitting the hands, to have the rest of the bar in the correct position). So I think that the hands will be off-center if you change font size (haven't tested that), but even in that case it will be less messy now. Likewise for the battery icon. In truth, I made the font adjustments a few months ago, and had better done it in a different way: make the clock faces zero-width, make the minute hand non-zero-width, and make everything about the battery icon zero-width and add a separate, transparant "battery width" glyph. I might fix that later. --- polybar/bar-material-supplements.ttf | Bin 4692 -> 4744 bytes polybar/clock.py | 4 ++-- polybar/config.ini | 34 ++++++++++++++++----------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/polybar/bar-material-supplements.ttf b/polybar/bar-material-supplements.ttf index 01042072d6730311fe2115ddfb6094b7941bb84c..ffe8bd3ce410e943dbe24836ef82d85ec0f46dce 100644 GIT binary patch delta 859 zcmb7CJ!n%=7(MsBmylqZG-;_d)>upb6s&Dis)K`Qt-qyULMbs2p0#a;Bn_smtzhGz zQbj~_)xk+O7eNU+I7#Usbg)W6EmjZ;f;t3^lf`&$e4q{vJ~;RL&iU^Be(rrsjk8Tz z2ml_OgN}4>Z@BOJ=i*_&`e(iElT+E6u21JVC1$CBCTPu|1i4Vj_g5@No-C(gN;4TUGG)$oVT; zl@L*RM}H}oje7Zn$QiBjl(8lM-EcXwF5I$q3)G_1@-Bi3fLLQ$(XxCdORER!Yzf+ zFaYPX$En5mBP+F4$M`L@cK5JFz{1{zoPyuHcFfBgjzm2Bb%5H(P`u{I$W az5W_KXh07lqHjV(JA{bnK?Js(FZ>hU@0of4 delta 872 zcmZ`%O-NKx6#mZp8OCrLoslrH7)2fXLsK&sEy8U2Lt7*wLuAiM9m3IxF&!bCAc!Jz z(KDjfft!k8DBDCKL_r%7qk=FBL$b{jMp4rAy*DqIP4{u{`M&erbMCq4zDv~$RVfGn zFU~_nJQV6|zwkTQ2o&F@xBNic{t&jHi~JmU&Cz3Z4ZFYe>;NQ5-W7=%@ejY|p8!e= zec=Hk5zl6s3B@DS-2;Q;{WX^(cLDV$P*51{Gfovxo}Q+*#@QT=_N5H>KJ_Mpo9L*D z#zvC0C1v-?=g6aj!x5upsdzP>tWB~hWS9*$nyM+w%5e-+0IT zjr!Q2G1OqMJMFbT-CNWnDHU}*+ %{T9}%{T-}%{O-125}%{T5}%{T-} ;small-format-online = %{T9}%{T-}%{O-50}%{T5}%{T-} -format-online = %{A1:mpdclient &:}%{T9}%{T-}%{O-125}%{T5}%{T-}%{A} +format-online = %{A1:mpdclient &:}%{T9}%{T-}%{O-180}%{T5}%{T-}%{A} small-format-online = %{A1:mpdclient &:}%{T9}%{T-}%{O-50}%{T5}%{T-}%{A} ro-format-online = %{T9}%{T-}%{O-125}%{T5}%{T-} @@ -170,7 +170,7 @@ small-label-song-maxlen = 7 label-song-ellipsis = false label-song-foreground = ${colors.foreground} -bar-progress-width = 25 +bar-progress-width = 30 small-bar-progress-width = 10 bar-progress-indicator = ╴ bar-progress-indicator-foreground = #eee @@ -232,7 +232,7 @@ card = intel_backlight type = internal/cpu interval = 3 ;format-prefix = " " -format = "%{O-22}%{A1:i3-sensible-terminal -x htop &:}%{A}" +format = "%{O-22}%{A1:alacritty -e htop &:}%{A}" format-foreground = ${colors.foreground-alt} format-prefix-foreground = ${colors.foreground-alt} @@ -266,7 +266,7 @@ ramp-coreload-7-foreground = ${colors.foreground-alert} [module/memory] type = internal/memory interval = 3 -format = "%{A1:i3-sensible-terminal -x htop &:}%{A}" +format = "%{A1:alacritty -e htop &:}%{A}" format-foreground = ${colors.foreground-alt} ramp-used-0 = @@ -313,7 +313,7 @@ units = false format = format-foreground = ${colors.foreground-alt} -format-warn = "%{O-22}%{A1:i3-sensible-terminal -x watch sensors &:}%{T3}%{T-} %{A}" +format-warn = "%{O-22}%{A1:alacritty -e watch sensors &:}%{T3}%{T-} %{A}" format-warn-foreground = ${colors.foreground-alert} label = %temperature-c%℃ @@ -321,7 +321,7 @@ label-warn = %temperature-c%℃ [module/wlan] type = internal/network -interface = wlp5s0 +interface = wlp58s0 interval = 3 ; %{T7} select font 7 @@ -331,15 +331,16 @@ interval = 3 ; %{O-18} go back 18 pixels to the left ; show a signal strength icon ; This overlays the actual signal strength icon over the dark "full signal" icon -format-connected = %{A:i3-sensible-terminal -x nmtui-connect &:}%{A3:i3-sensible-terminal -x nmtui &:}%{T7}%{F#333}%{F}%{T-}%{O-18}%{A}%{A} +format-connected = %{A:alacritty -e wlan &:}%{T7}%{F#333}%{F}%{T-}%{O-18}%{A} format-connected-foreground = ${colors.foreground-alt} label-connected = %essid% -format-disconnected = %{A1:i3-sensible-terminal -x nmtui-connect &:}%{A3:i3-sensible-terminal -x nmtui &:}%{A}%{A} +format-disconnected = %{A1:alacritty -e wlan &:}%{A} label-disconnected =  label-disconnected-foreground = ${colors.foreground-alt} -ramp-signal-0 = "" +;ramp-signal-0 = "" +ramp-signal-0 = ramp-signal-1 = ramp-signal-2 = ramp-signal-3 =  @@ -348,7 +349,7 @@ ramp-signal-foreground = ${colors.foreground} [module/eth] type = internal/network -interface = enp4s0 +interface = enp57s0f1 interval = 3 label-connected = "%{O-32}" @@ -373,7 +374,12 @@ exec = ~/.config/polybar/clock.py ;America/Detroit Asia/Seoul [module/volume] -type = internal/pulseaudio +;type = internal/pulseaudio +type = internal/alsa + +master-soundcard = default +speaker-soundcard = default +headphone-soundcard = default format-muted =  format-muted-foreground = ${colors.foreground-alt} @@ -392,13 +398,13 @@ adapter = AC full-at = 90 interval = 5 -format-charging = %{T7}%{F#555}%{O-18}%{F#DDA}%{O-17}%{F000}%{F}%{T-}%{O2} +format-charging = %{A:alacritty -e bat --hold &:}%{T7}%{F#555}%{O-18}%{F#DDA}%{O-17}%{F#000}%{F}%{T-}%{O19}%{A} label-charging = %percentage% -format-discharging = %{F#555}%{O-18}%{F}%{O2} +format-discharging = %{A:alacritty -e bat --hold &:}%{F#555}%{O-18}%{F}%{O2}%{A} label-discharging = %percentage% -format-full = "%{F#dda}%{F#eea} unplug%{F}" +format-full = "%{A:alacritty -e bat --hold &:}%{F#dda}%{F#eea} unplug%{F}%{A}" ; <5 ramp-capacity-0 = %{F#f55}