Polybar

From Void Linux Wiki
Jump to: navigation, search


Polybar is somewhat better that i3bar because it allows to move module wm-restack/bspwm on the middle or to the right while on i3bar is always aligned on the left.

Config

In the same config file you can set the configuration for multiple bars. Here is an example configuration for two bars, one on the left and the other on the right:

Left monitor

[bar/left]
monitor = DVI-I-1
width = 100%
height = 30
offset-x = 0
offset-y = 0
bottom = true
modules-left = redshift sync caffeine date volume 
modules-center =  
modules-right = xwindowl bspwm 
wm-restack = bspwm

Right monitor

[bar/right]
monitor = HDMI-0
width = 100%
height = 30 
offset-x = 0
offset-y = 0 
bottom = true
modules-left = bspwm xwindowr 
modules-center =   
modules-right =  volume date powermenu
wm-restack = bspwm

modules are defined below

Modules

Examples

[module/xwindowl]
type = internal/xwindow
format-prefix = " \ "
label = %title%
label-maxlen = 25
[module/xwindowr]
type = internal/xwindow
format-prefix = " / "
label = %title%
label-maxlen = 120
[module/bspwm]
type = internal/bspwm
ws-icon-8 = IX;9
ws-icon-6 = VII;7
ws-icon-4 = V;5
ws-icon-2 = III;3
ws-icon-0 = I;1
ws-icon-1 = II;2
ws-icon-3 = IV;4
ws-icon-5 = VI;6
ws-icon-7 = VIII;8
ws-icon-9 = X;0
ws-icon-default = 
format = <label-state> <label-mode>
label-focused = %icon%
label-focused-padding = 2
label-focused-font = 7
label-occupied = %icon%
label-occupied-padding = 1
label-occupied-font = 4
label-urgent = %icon%
label-urgent-padding = 1
label-urgent-font = 3
label-empty = %icon%
label-empty-padding = 1
label-empty-font = 2

Power menu using ConsoleKit2 and i3lock

[module/powermenu]
type = custom/menu

label-open = "¿?"
label-open-font = 4
label-close = "x"
label-separator = " / "
menu-0-0 = x
menu-0-0-exec = menu-open-1
menu-0-1 = 1
menu-0-1-exec = menu-open-2
menu-0-2 =  2
menu-0-2-exec = menu-open-3
menu-0-3 =  3
menu-0-3-exec = menu-open-4
menu-0-4 =  4
menu-0-4-exec = menu-open-5
; lock
menu-5-0 = 5
menu-5-0-exec = i3lock -ni /home/user/.config/i3/lock.png
; sleep
menu-4-0 = 4
menu-4-0-exec = dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend  boolean:true
; logout
menu-3-0 = 3
menu-3-0-exec = bspc quit
; reboot
menu-2-0 = 2
menu-2-0-exec = dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
; shutdown
menu-1-0 = 1
menu-1-0-exec = dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

For more modules take a look here