Skip to content

Commit

Permalink
fix polybar deprec warnings + refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kpa28-git committed Apr 30, 2024
1 parent 287b9cf commit 9bd863c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .config/alacritty/alacritty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import = ["/usr/share/alacritty/themes/everforest_dark.toml"]
TERM = "xterm-256color"

[font]
size = 12.0
size = 16.0
normal.family = "monospace"
normal.style = "Regular"
italic.family = "monospace"
Expand Down
2 changes: 1 addition & 1 deletion .config/bspwm/noswallow
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$TASK_CLIENT
$EMAIL_CLIENT
superproductivity
planify
tutanota-desktop
2 changes: 1 addition & 1 deletion .config/joshuto/joshuto.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ reverse = false

[preview]
max_preview_size = 2097152 # 2MB
preview_script = "$GOPATH/bin/pistol"
preview_script = "/usr/bin/pistol"
# preview_script = "~/.config/joshuto/preview_file.sh"

[tab]
Expand Down
114 changes: 28 additions & 86 deletions .config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,81 +21,56 @@ secondary = #e60053
linecolor = #FFFFFF
linecolorDark = #cccccc

;Top bar
[bar/main]
[bar/top]
enable-ipc = true

;Location
;---------
monitor = ${env:MONITOR:}
;Monitor is set in the launch.sh script because it detect second monitor;
;Normaly you would use something like monitor=eDP-1

;Size
;---------
width = 100%
height = 36

;Suroundings
;--------------
fixed-center = true
line-size = 3
border-size = 0
border-color = #00000000
padding-left = 3
padding-right = 3
module-margin-left = 1
module-margin-right = 1

;Fonts
;------------------
background = ${colors.background}
foreground = ${colors.foreground}
line-color = ${colors.linecolor}
font-0 = Hack Nerd Font:pixelsize=18;2
font-1 = Hack Nerd Font:pixelsize=40;6
font-2 = fixed:pixelsize=18;2
; Use '%{T-}' for the default font (font-0)
; If no font is specified, polybar will iterate until the first valid one is found.

;Misc
;------------
fixed-center = true
line-size = 3
modules-left = powermenu date weather airinfo
modules-center = bspwm
modules-right = spxprice adaprice
tray-position = right
tray-padding = 1

;Color
;------------
background = ${colors.background}
foreground = ${colors.foreground}
line-color = ${colors.linecolor}

[bar/bottom]
inherit = bar/main
inherit = bar/top
bottom=true
modules-left = battery temperature volume
modules-center = tempcpu memory cpu tempgpu memgpu pctutilgpu
;modules-right = updates-pacman-yay btcprice adaprice
modules-right = network updates-pacman-yay

[bar/secondary]
inherit = bar/main
inherit = bar/top
monitor = ${env:MONITOR}


;Misc
;------------
fixed-center = true
line-size = 3
modules-left =
modules-center = bspwm
modules-right = date powermenu
tray-position = right
tray-padding = 1


;-----------------;
; Builtin Modules ;
;-----------------;
[module/tray]
type = internal/tray
tray-padding = 1

[module/bspwm]
type = internal/bspwm
pin-workspaces = true
Expand All @@ -104,9 +79,20 @@ enable-click = true
enable-scroll = true
reverse-scroll = true
fuzzy-match = false

format = <label-monitor> <label-state>
label-monitor = %name%
label-focused = [%icon%]
label-occupied = %icon%
label-urgent = <%icon%>
label-focused-foreground = ${colors.linecolor}
label-occupied-foreground = ${colors.linecolorDark}
label-urgent-foreground = ${colors.linecolorDark}
label-focused-padding = 0
label-occupied-padding = 0
label-urgent-padding = 0
label-empty =
label-separator = |
label-separator-padding = 0.6
format = <label-monitor> <label-state>
ws-icon-0 = 1;%{T1}1%{T-}
ws-icon-1 = 2;%{T1}2%{T-}
ws-icon-2 = 3;%{T1}3%{T-}
Expand All @@ -119,24 +105,6 @@ ws-icon-8 = 9;%{T1}9%{T-}
ws-icon-9 = 0;%{T1}0%{T-}
ws-icon-default = %{T1}?%{T-}

label-focused = [%icon%]
label-focused-foreground = ${colors.linecolor}
label-focused-padding = 0

label-occupied = %icon%
label-occupied-foreground = ${colors.linecolorDark}
label-occupied-padding = 0

label-urgent = <%icon%>
label-urgent-foreground = ${colors.linecolorDark}
label-urgent-padding = 0

label-empty =

label-separator = |
label-separator-padding = 0.6


[module/date]
type = internal/date
date = %m-%d-%Y%
Expand All @@ -146,7 +114,6 @@ time-alt = %l:%M %p
format = <label>
label = %time% %date%


[module/battery]
type = internal/battery
battery = BAT0
Expand All @@ -170,7 +137,6 @@ ramp-capacity-8 = 󰂊
ramp-capacity-9 = 󰂋
ramp-capacity-10 = 󰂅


[module/volume]
type = internal/pulseaudio
format-volume = <ramp-volume> <label-volume>
Expand All @@ -180,7 +146,6 @@ ramp-volume-1 = %{T1}󰖀%{T1}
ramp-volume-2 = %{T1}󰕾%{T1}
;


[module/backlight]
type = internal/backlight
# card = intel_backlight
Expand All @@ -191,44 +156,38 @@ ramp-1 = 󰃟
ramp-2 = 󰃠
; Use `ls -1 /sys/class/backlight/` to list available cards


[module/wlan]
type = internal/network
interface = wlo1
interval = 10
label-connected =%{A1:$TERMINAL -e nmtui:}%{T1}直%{T1}%{A}
label-disconnected = %{A1:$TERMINAL -e nmtui:}%{T1}睊%{T1}%{A}


;[module/eth]
;type = internal/network
;interface = eth0
;interval = 5
;format-connected-prefix= " "
;label-connected = %local_ip%


[module/cpu]
type = internal/cpu
interval = 1
label = %{A1:$TERMINAL -e htop:}%percentage:02%%%{A}


[module/memory]
type = internal/memory
interval = 10
label = %{A1:$TERMINAL -e htop:}%gb_used%%{A}
;label = %{A1:notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)":}%gb_used%%{A}


[module/network]
type = internal/network
interface = wlo1
;label-connected-minlen = 30
;label-connected-alignment = center
label-connected =  %downspeed% |  %upspeed%


[module/temperature]
type = internal/temperature
thermal-zone = 0
Expand All @@ -240,6 +199,9 @@ label-warn-foreground = ${colors.secondary}
click-left = $TERMINAL -e watch sensors


;----------------;
; Custom Modules ;
;----------------;
[module/powermenu]
type = custom/menu
expand-right = true
Expand All @@ -257,90 +219,76 @@ menu-0-1-exec = sudo -A reboot
menu-0-2 = shutdown
menu-0-2-exec = sudo -A shutdown -h now


;----------------;
; Custom Modules ;
;----------------;
[module/tempcpu]
type = custom/script
click-left = notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)"
exec = $XDG_SCRIPT_HOME/polybar/temp-cpu.sh
interval = 5
label = %{T1}󰻠%{T1} %output%


[module/tempgpu]
type = custom/script
click-left = $TERMINAL -e nvtop
exec = $XDG_SCRIPT_HOME/polybar/temp-gpu.sh
interval = 5
label = %{T1}󰘚%{T1} %output%


[module/memgpu]
type = custom/script
click-left = $TERMINAL -e nvtop
exec = $XDG_SCRIPT_HOME/polybar/mem-gpu.sh
interval = 10
label = %output%


[module/pctutilgpu]
type = custom/script
click-left = $TERMINAL -e nvtop
exec = $XDG_SCRIPT_HOME/polybar/pctutil-gpu.sh
interval = 1
label = %output%%


[module/nordvpn]
type = custom/script
click-left = $XDG_SCRIPT_HOME/nettools/nord-toggle
exec = $XDG_SCRIPT_HOME/polybar/nordvpn.sh
interval = 10
label = %{T1}%output%%{T1}


;[module/bluetooth]
;type = custom/script
;click-left = $XDG_SCRIPT_HOME/polybar/bluetooth-toggle.sh
;exec = $XDG_SCRIPT_HOME/polybar/bluetooth.sh
;interval = 30
;label = %{T1}%output%%{T1}


;[module/torrent]
;type = custom/script
;click-left = $TERMINAL -e transmission-remote-cli
;exec = $XDG_SCRIPT_HOME/polybar/torrent.sh
;interval = 30
;label = %


[module/btcprice]
type = custom/script
click-left = $TERMINAL -e "$(curl -s rate.sx/btc@1w | less -S)"
exec = $XDG_SCRIPT_HOME/polybar/cprice.sh -s 'BTC'
interval = 600
label = %{T1} %output% %{T1}


[module/ethprice]
type = custom/script
click-left = $TERMINAL -e "$(curl -s rate.sx/eth@1w | less -S)"
exec = $XDG_SCRIPT_HOME/polybar/cprice.sh -s 'ETH'
interval = 600
label = %{T1} %output% %{T1}


[module/adaprice]
type = custom/script
click-left = $TERMINAL -e "$(curl -s rate.sx/ada@1w | less -S)"
exec = $XDG_SCRIPT_HOME/polybar/cprice.sh -s 'ADA' -f 3
interval = 600
label = %{T1} %output% %{T1}


[module/spxprice]
type = custom/script
click-left = $XDG_SCRIPT_HOME/polybar/sprice.sh -a -f 5 -s 'SPY'
Expand All @@ -367,30 +315,24 @@ exec = $XDG_SCRIPT_HOME/polybar/updates-pacman-yay.sh
interval = 14400
label = %output%


[module/corona]
type = custom/script
click-left = $TERMINAL -e less -S "$XDG_DATA_HOME/coronareport"
exec = $XDG_SCRIPT_HOME/polybar/corona.sh 'California'
interval = 14400
label = %{T-}ﯭ %output% %{T-}


[module/weather]
type = custom/script
click-left = $TERMINAL -e less -S "$XDG_DATA_HOME/weatherreport"
exec = $XDG_SCRIPT_HOME/polybar/weather.sh
interval = 14400
label = %{T1}%output% %{T1}


[module/moonphase]
type = custom/script
click-left = $TERMINAL -e less -S "$XDG_DATA_HOME/moonphase"
exec = $XDG_SCRIPT_HOME/polybar/moonphase.sh
interval = 43200
label = %{T1}%output% %{T-}



; vim:ft=dosini
10 changes: 5 additions & 5 deletions .config/polybar/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ if [ -z "$(pgrep -x polybar)" ]; then
ACTIVE="$(polybar -m | cut -d':' -f1)";
PRIMARY="$(printf '%s' "$ACTIVE" | sed -n '1p')";
SECONDARY="$(printf '%s' "$ACTIVE" | sed -n '2p')";
MONITOR=$PRIMARY polybar --reload main &
MONITOR=$PRIMARY polybar --reload bottom &
# MONITOR=$PRIMARY polybar --reload main 2>$HOME/polybar.main.log &
# MONITOR=$PRIMARY polybar --reload bottom 2>$HOME/polybar.bottom.log &
# MONITOR=$PRIMARY polybar --reload top &
# MONITOR=$PRIMARY polybar --reload bottom &
MONITOR=$PRIMARY polybar --reload top 2>$HOME/polybar.top.log &
MONITOR=$PRIMARY polybar --reload bottom 2>$HOME/polybar.bottom.log &

# Multi monitor bar mirroring: https://github.com/polybar/polybar/issues/763
# for m in $(polybar --list-monitors | cut -d":" -f1); do
# MONITOR=$m polybar --reload main &
# MONITOR=$m polybar --reload top &
# MONITOR=$m polybar --reload bottom &
# done
else
Expand Down
Loading

0 comments on commit 9bd863c

Please sign in to comment.