[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.
This commit is contained in:
parent
bc08bad7fa
commit
1215d7270f
3 changed files with 22 additions and 16 deletions
Binary file not shown.
|
@ -30,9 +30,9 @@ try:
|
||||||
hour = hourhands [ t.hour % 12 ]
|
hour = hourhands [ t.hour % 12 ]
|
||||||
|
|
||||||
if FILL_CLOCK_FACE:
|
if FILL_CLOCK_FACE:
|
||||||
return color_for(t) + "%{T8}%{F#000}%{O-27}" + hour + "%{O-27}" + minute + "%{T-}%{F}"
|
return "%{O1}%{T8}" + color_for(t) + "%{O-27}%{F#000}" + hour + minute + "%{O27}" + "%{T-}%{F}"
|
||||||
else:
|
else:
|
||||||
return "%{O1}%{T8}" + color_for(t) + "%{O-27}" + hour + "%{O-27}" + minute + "%{T-}%{F}"
|
return "%{O1}%{T8}" + color_for(t) + hour + minute + "%{T-}%{F}"
|
||||||
|
|
||||||
|
|
||||||
def color_for(t):
|
def color_for(t):
|
||||||
|
|
|
@ -146,7 +146,7 @@ type = internal/mpd
|
||||||
|
|
||||||
;format-online = <toggle> <icon-prev> %{T9}<bar-progress>%{T-}%{O-125}%{T5}<label-song>%{T-} <icon-next>
|
;format-online = <toggle> <icon-prev> %{T9}<bar-progress>%{T-}%{O-125}%{T5}<label-song>%{T-} <icon-next>
|
||||||
;small-format-online = <toggle> <icon-prev> %{T9}<bar-progress>%{T-}%{O-50}%{T5}<label-song>%{T-} <icon-next>
|
;small-format-online = <toggle> <icon-prev> %{T9}<bar-progress>%{T-}%{O-50}%{T5}<label-song>%{T-} <icon-next>
|
||||||
format-online = <toggle> %{A1:mpdclient &:}%{T9}<bar-progress>%{T-}%{O-125}%{T5}<label-song>%{T-}%{A}
|
format-online = <toggle> %{A1:mpdclient &:}%{T9}<bar-progress>%{T-}%{O-180}%{T5}<label-song>%{T-}%{A}
|
||||||
small-format-online = <toggle> %{A1:mpdclient &:}%{T9}<bar-progress>%{T-}%{O-50}%{T5}<label-song>%{T-}%{A}
|
small-format-online = <toggle> %{A1:mpdclient &:}%{T9}<bar-progress>%{T-}%{O-50}%{T5}<label-song>%{T-}%{A}
|
||||||
ro-format-online = %{T9}<bar-progress>%{T-}%{O-125}%{T5}<label-song>%{T-}
|
ro-format-online = %{T9}<bar-progress>%{T-}%{O-125}%{T5}<label-song>%{T-}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ small-label-song-maxlen = 7
|
||||||
label-song-ellipsis = false
|
label-song-ellipsis = false
|
||||||
label-song-foreground = ${colors.foreground}
|
label-song-foreground = ${colors.foreground}
|
||||||
|
|
||||||
bar-progress-width = 25
|
bar-progress-width = 30
|
||||||
small-bar-progress-width = 10
|
small-bar-progress-width = 10
|
||||||
bar-progress-indicator = ╴
|
bar-progress-indicator = ╴
|
||||||
bar-progress-indicator-foreground = #eee
|
bar-progress-indicator-foreground = #eee
|
||||||
|
@ -232,7 +232,7 @@ card = intel_backlight
|
||||||
type = internal/cpu
|
type = internal/cpu
|
||||||
interval = 3
|
interval = 3
|
||||||
;format-prefix = " "
|
;format-prefix = " "
|
||||||
format = "%{O-22}%{A1:i3-sensible-terminal -x htop &:}<ramp-coreload>%{A}"
|
format = "%{O-22}%{A1:alacritty -e htop &:}<ramp-coreload>%{A}"
|
||||||
format-foreground = ${colors.foreground-alt}
|
format-foreground = ${colors.foreground-alt}
|
||||||
format-prefix-foreground = ${colors.foreground-alt}
|
format-prefix-foreground = ${colors.foreground-alt}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ ramp-coreload-7-foreground = ${colors.foreground-alert}
|
||||||
[module/memory]
|
[module/memory]
|
||||||
type = internal/memory
|
type = internal/memory
|
||||||
interval = 3
|
interval = 3
|
||||||
format = "%{A1:i3-sensible-terminal -x htop &:}<ramp-used>%{A}"
|
format = "%{A1:alacritty -e htop &:}<ramp-used>%{A}"
|
||||||
format-foreground = ${colors.foreground-alt}
|
format-foreground = ${colors.foreground-alt}
|
||||||
|
|
||||||
ramp-used-0 =
|
ramp-used-0 =
|
||||||
|
@ -313,7 +313,7 @@ units = false
|
||||||
|
|
||||||
format =
|
format =
|
||||||
format-foreground = ${colors.foreground-alt}
|
format-foreground = ${colors.foreground-alt}
|
||||||
format-warn = "%{O-22}%{A1:i3-sensible-terminal -x watch sensors &:}%{T3}%{T-} <label-warn>%{A}"
|
format-warn = "%{O-22}%{A1:alacritty -e watch sensors &:}%{T3}%{T-} <label-warn>%{A}"
|
||||||
format-warn-foreground = ${colors.foreground-alert}
|
format-warn-foreground = ${colors.foreground-alert}
|
||||||
|
|
||||||
label = %temperature-c%℃
|
label = %temperature-c%℃
|
||||||
|
@ -321,7 +321,7 @@ label-warn = %temperature-c%℃
|
||||||
|
|
||||||
[module/wlan]
|
[module/wlan]
|
||||||
type = internal/network
|
type = internal/network
|
||||||
interface = wlp5s0
|
interface = wlp58s0
|
||||||
interval = 3
|
interval = 3
|
||||||
|
|
||||||
; %{T7} select font 7
|
; %{T7} select font 7
|
||||||
|
@ -331,15 +331,16 @@ interval = 3
|
||||||
; %{O-18} go back 18 pixels to the left
|
; %{O-18} go back 18 pixels to the left
|
||||||
; <ramp-signal> show a signal strength icon
|
; <ramp-signal> show a signal strength icon
|
||||||
; This overlays the actual signal strength icon over the dark "full signal" 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}<ramp-signal>%{A}%{A}
|
format-connected = %{A:alacritty -e wlan &:}%{T7}%{F#333}%{F}%{T-}%{O-18}<ramp-signal>%{A}
|
||||||
format-connected-foreground = ${colors.foreground-alt}
|
format-connected-foreground = ${colors.foreground-alt}
|
||||||
label-connected = %essid%
|
label-connected = %essid%
|
||||||
|
|
||||||
format-disconnected = %{A1:i3-sensible-terminal -x nmtui-connect &:}%{A3:i3-sensible-terminal -x nmtui &:}<label-disconnected>%{A}%{A}
|
format-disconnected = %{A1:alacritty -e wlan &:}<label-disconnected>%{A}
|
||||||
label-disconnected =
|
label-disconnected =
|
||||||
label-disconnected-foreground = ${colors.foreground-alt}
|
label-disconnected-foreground = ${colors.foreground-alt}
|
||||||
|
|
||||||
ramp-signal-0 = ""
|
;ramp-signal-0 = ""
|
||||||
|
ramp-signal-0 =
|
||||||
ramp-signal-1 =
|
ramp-signal-1 =
|
||||||
ramp-signal-2 =
|
ramp-signal-2 =
|
||||||
ramp-signal-3 =
|
ramp-signal-3 =
|
||||||
|
@ -348,7 +349,7 @@ ramp-signal-foreground = ${colors.foreground}
|
||||||
|
|
||||||
[module/eth]
|
[module/eth]
|
||||||
type = internal/network
|
type = internal/network
|
||||||
interface = enp4s0
|
interface = enp57s0f1
|
||||||
interval = 3
|
interval = 3
|
||||||
|
|
||||||
label-connected = "%{O-32}"
|
label-connected = "%{O-32}"
|
||||||
|
@ -373,7 +374,12 @@ exec = ~/.config/polybar/clock.py
|
||||||
;America/Detroit Asia/Seoul
|
;America/Detroit Asia/Seoul
|
||||||
|
|
||||||
[module/volume]
|
[module/volume]
|
||||||
type = internal/pulseaudio
|
;type = internal/pulseaudio
|
||||||
|
type = internal/alsa
|
||||||
|
|
||||||
|
master-soundcard = default
|
||||||
|
speaker-soundcard = default
|
||||||
|
headphone-soundcard = default
|
||||||
|
|
||||||
format-muted =
|
format-muted =
|
||||||
format-muted-foreground = ${colors.foreground-alt}
|
format-muted-foreground = ${colors.foreground-alt}
|
||||||
|
@ -392,13 +398,13 @@ adapter = AC
|
||||||
full-at = 90
|
full-at = 90
|
||||||
interval = 5
|
interval = 5
|
||||||
|
|
||||||
format-charging = %{T7}%{F#555}%{O-18}%{F#DDA}<ramp-capacity>%{O-17}%{F000}%{F}%{T-}%{O2}<label-charging>
|
format-charging = %{A:alacritty -e bat --hold &:}%{T7}%{F#555}%{O-18}%{F#DDA}<ramp-capacity>%{O-17}%{F#000}%{F}%{T-}%{O19}<label-charging>%{A}
|
||||||
label-charging = %percentage%
|
label-charging = %percentage%
|
||||||
|
|
||||||
format-discharging = %{F#555}%{O-18}%{F}<ramp-capacity>%{O2}<label-discharging>
|
format-discharging = %{A:alacritty -e bat --hold &:}%{F#555}%{O-18}%{F}<ramp-capacity>%{O2}<label-discharging>%{A}
|
||||||
label-discharging = %percentage%
|
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
|
; <5
|
||||||
ramp-capacity-0 = %{F#f55}
|
ramp-capacity-0 = %{F#f55}
|
||||||
|
|
Loading…
Reference in a new issue