Polybar: Refactors, small modules, and device-specific configuration

This commit is contained in:
Salt 2018-08-01 22:38:48 -05:00
parent 8120fd9099
commit 3fce79d834
3 changed files with 85 additions and 36 deletions

View File

@ -1,6 +1,12 @@
#!/bin/sh
export PB_BAR_WIDTH=2548
export PB_BAR_SECONDARY_WIDTH=1908
export PB_MODULE_BAR_WIDTH=60
export PB_MODULE_WLAN_INTERFACE=wlp5s0
# Primary bottom
export PB_BAR_PRIMARY_MODULES_LEFT='cpu memory swap'
export PB_MODULE_BAR_WIDTH=60
export PB_MODULE_ETH_INTERFACE=eno1
export PB_MODULE_WLAN_INTERFACE=wlp5s0
# vim:ft=sh

View File

@ -30,6 +30,7 @@ unset PB_BAR_PRIMARY_2_MODULES_LEFT PB_BAR_PRIMARY_2_MODULES_CENTER PB_BAR_PRIMA
unset PB_BAR_SECONDARY_MODULES_LEFT PB_BAR_SECONDARY_MODULES_CENTER PB_BAR_SECONDARY_MODULES_RIGHT
unset PB_BAR_SECONDARY_2_MODULES_LEFT PB_BAR_SECONDARY_2_MODULES_CENTER PB_BAR_SECONDARY_2_MODULES_RIGHT
unset PB_MODULE_BAR_WIDTH
unset PB_MODULE_ETH_INTERFACE
unset PB_MODULE_WLAN_INTERFACE
# bspwm monitorset.sh
unset BSPWM_DESKTOPS_TOTAL

View File

@ -21,7 +21,7 @@ icon-fs = ${xrdb:color11}
icon-memory = ${xrdb:color13}
icon-tor = ${xrdb:color13}
icon-volume = ${res/colors.primary}
icon-wlan = ${xrdb:color14}
icon-network = ${xrdb:color14}
icon-wm = ${xrdb:color12}
icon-xbacklight = ${res/colors.primary}
@ -108,7 +108,7 @@ border-top-size = 0
modules-left = ${env:PB_BAR_PRIMARY_2_MODULES_LEFT:bspwm}
modules-center = ${env:PB_BAR_PRIMARY_2_MODULES_CENTER:xwindow}
modules-right = ${env:PB_BAR_PRIMARY_2_MODULES_RIGHT:fs-home | tor wlan}
modules-right = ${env:PB_BAR_PRIMARY_2_MODULES_RIGHT:fs-home | tor wlan eth}
[bar/secondary]
width = ${env:PB_BAR_SECONDARY_WIDTH:1908}
@ -130,7 +130,7 @@ border-top-size = 0
modules-left = ${env:PB_BAR_SECONDARY_2_MODULES_LEFT:bspwm}
modules-center = ${env:PB_BAR_SECONDARY_2_MODULES_CENTER:xwindow}
modules-right = ${env:PB_BAR_SECONDARY_2_MODULES_RIGHT: }
modules-right = ${env:PB_BAR_SECONDARY_2_MODULES_RIGHT:uname | hostname}
#========================================
# MODULES
@ -154,6 +154,33 @@ content = " "
# OTHER
#====================
[module/battery]
type = internal/battery
format-charging = <bar-capacity> <label-charging>
format-charging-prefix = "Battery: "
format-charging-prefix-foreground = ${res/colors.icon-battery}
format-discharging = <bar-capacity> <label-discharging>
format-discharging-prefix = "Battery: "
format-discharging-prefix-foreground = ${res/colors.icon-battery}
format-full = <bar-capacity> <label-full>
format-full-prefix = "Battery: "
format-full-prefix-foreground = ${res/colors.icon-battery}
time-format = %H:%M
full-at = 98
interval = 15
label-charging = %percentage%%+
label-discharging = %percentage%%
label-full = %percentage%%
bar-capacity-width = ${res/config.bar-width}
bar-capacity-fill = ${res/config.bar-fill}
bar-capacity-fill-foreground = ${res/colors.icon-battery}
bar-capacity-empty = ${self.bar-capacity-fill}
bar-capacity-empty-foreground = ${res/colors.bar-empty}
bar-capacity-indicator = ${res/config.bar-indicator}
bar-capacity-indicator-foreground = ${res/colors.background-alt}
[module/bspwm]
type = internal/bspwm
format = <label-state>
@ -183,33 +210,6 @@ label-empty-padding = ${res/config.padding}
label-empty-foreground = ${res/colors.background-alt}
label-empty-font = 3
[module/battery]
type = internal/battery
format-charging = <bar-capacity> <label-charging>
format-charging-prefix = "Battery: "
format-charging-prefix-foreground = ${res/colors.icon-battery}
format-discharging = <bar-capacity> <label-discharging>
format-discharging-prefix = "Battery: "
format-discharging-prefix-foreground = ${res/colors.icon-battery}
format-full = <bar-capacity> <label-full>
format-full-prefix = "Battery: "
format-full-prefix-foreground = ${res/colors.icon-battery}
time-format = %H:%M
full-at = 98
interval = 15
label-charging = %percentage%%+
label-discharging = %percentage%%
label-full = %percentage%%
bar-capacity-width = ${res/config.bar-width}
bar-capacity-fill = ${res/config.bar-fill}
bar-capacity-fill-foreground = ${res/colors.icon-battery}
bar-capacity-empty = ${self.bar-capacity-fill}
bar-capacity-empty-foreground = ${res/colors.bar-empty}
bar-capacity-indicator = ${res/config.bar-indicator}
bar-capacity-indicator-foreground = ${res/colors.background-alt}
[module/cpu]
type = internal/cpu
format = <bar-load>
@ -245,6 +245,20 @@ interval = 15
exec = dropbox status
exec-if = which dropbox && [ "`dropbox status`" != "Up to date" ] && wget -q --spider http://www.startpage.com/
[module/eth]
type = internal/network
format-connected = <label-connected>
format-connected-prefix = "Ethernet: "
format-connected-prefix-foreground = ${res/colors.icon-network}
format-disconnected = <label-disconnected>
format-disconnected-prefix = "Ethernet: "
format-disconnected-prefix-foreground = ${res/colors.icon-network}
interface = ${env:PB_MODULE_ETH_INTERFACE:enp0s31f6}
label-connected = %local_ip%
label-disconnected = Disconnected
label-disconnected-foreground = ${res/colors.foreground-dark}
[module/fs-home]
type = internal/fs
format-mounted = <bar-used> <label-mounted>
@ -262,6 +276,13 @@ bar-used-empty-foreground = ${res/colors.bar-empty}
bar-used-indicator = ${res/config.bar-indicator}
bar-used-indicator-foreground = ${res/colors.background-alt}
[module/hostname]
type = custom/script
format-foreground = ${res/colors.background-alt}
interval = 3600
exec = hostname
[module/memory]
type = internal/memory
format = <bar-used> <label>
@ -279,6 +300,20 @@ bar-used-empty-foreground = ${res/colors.bar-empty}
bar-used-indicator = ${res/config.bar-indicator}
bar-used-indicator-foreground = ${res/colors.background-alt}
[module/monitor]
type = custom/text
content = ${env:PB_MONITOR:eDP-1}
content-foreground = ${res/colors.background-alt}
[module/swap]
type = internal/memory
format = <label>
format-prefix = "Swap: "
format-prefix-foreground = ${res/colors.icon-memory}
interval = 1
label = %gb_swap_used% used
[module/tor]
type = custom/script
format-prefix = "Tor: "
@ -288,6 +323,13 @@ interval = 10
exec = if systemctl is-failed --quiet tor; then echo Failed, see logs for details; elif ! systemctl is-enabled --quiet tor; then echo Disabled; else echo Inactive; fi
exec-if = ! systemctl is-active tor
[module/uname]
type = custom/script
format-foreground = ${res/colors.background-alt}
interval = 3600
exec = uname -sr
[module/volume]
type = internal/volume
format-volume = <bar-volume> <label-volume>
@ -313,14 +355,14 @@ bar-volume-indicator-foreground = ${res/colors.background-alt}
type = internal/network
format-connected = <label-connected>
format-connected-prefix = "WLAN: "
format-connected-prefix-foreground = ${res/colors.icon-wlan}
format-connected-prefix-foreground = ${res/colors.icon-network}
format-disconnected = <label-disconnected>
format-disconnected-prefix = "WLAN: "
format-disconnected-prefix-foreground = ${res/colors.icon-wlan}
format-disconnected-prefix-foreground = ${res/colors.icon-network}
interface = ${env:PB_MODULE_WLAN_INTERFACE:wlp1s0}
label-connected = %essid%
label-disconnected = None
label-connected = %local_ip%
label-disconnected = Disconnected
label-disconnected-foreground = ${res/colors.foreground-dark}
[module/xbacklight]