Skip to content

Instantly share code, notes, and snippets.

@jb3
Created February 25, 2018 12:55
Show Gist options
  • Save jb3/242f7fbe0495d3cb501cf13082e9b581 to your computer and use it in GitHub Desktop.
Save jb3/242f7fbe0495d3cb501cf13082e9b581 to your computer and use it in GitHub Desktop.
Polybar configuration
[colors]
accent = #fba922
[bar/top]
enable-ipc = true
monitor = eDP-1
width = 100%
height = 33
;background = #222
background = #1f1f1f
foreground = #eee
border-bottom = 2
border-bottom-color = #333
overline-size = 10
overline-color = ${self.background}
underline-size = 10
underline-color = ${self.background}
padding-left = 0
padding-right = 10
module-margin-left = 3
module-margin-right = 3
font-0 = NotoSans-Regular:size=8;0
font-1 = MaterialIcons:size=10;2
font-2 = Termsynu:size=8;0
font-3 = Siji:pixelsize=10;1
font-4 = FontAwesome:size=10;0
modules-left = powermenu i3
modules-center = spotify
modules-right = volume wireless-network wired-network battery clock github
wm-restack = bspwm
tray-position = right
[bar/bottom]
monitor = eDP-1
bottom = true
width = 100%
height = 27
background = #1c1c1c
foreground = #eefafafa
overline-size = 3
overline-color = ${colors.accent}
underline-size = 3
underline-color = ${colors.accent}
;border-color = #ff0000
border-top = 3
border-top-color = #3d3d3d
;border-bottom = 0
;border-bottom-color = #333333
spacing = 3
;padding-right = 4
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 6
font-0 = NotoSans-Regular:size=8;0
font-1 = Unifont:size=5;0
font-2 = FontAwesome:size=8;0
font-3 = NotoSans-Regular:size=8;-1
font-4 = Unifont:size=5;0
font-5 = Termsynu:size=7;0
modules-left = bspwm i3
;modules-center =
modules-right = xbacklight cpu memory clock
;modules-right = memory
wm-restack = bspwm
[bar/external]
enable-ipc = true
monitor = HDMI-1
bottom = true
;dock = true
width = ${bar/bottom.width}
height = ${bar/bottom.height}
background = ${bar/bottom.background}
foreground = ${bar/bottom.foreground}
underline-size = ${bar/bottom.underline-size}
underline-color = ${bar/bottom.underline-color}
overline-size = ${bar/bottom.overline-size}
overline-color = ${bar/bottom.overline-color}
border-bottom.= ${bar/bottom.border-bottom}
border-bottom.color = ${bar/bottom.border-bottom-color}
spacing = ${bar/bottom.spacing}
padding-left = ${bar/bottom.padding-left}
padding-right = ${bar/bottom.padding-right}
module-margin-left = 0
module-margin-right = ${bar/bottom.module-margin-right}
font-0 = ${bar/bottom.font-0}
font-1 = ${bar/bottom.font-1}
font-2 = ${bar/bottom.font-2}
font-3 = ${bar/bottom.font-3}
font-4 = ${bar/bottom.font-4}
font-5 = ${bar/bottom.font-5}
modules-left = bspwm i3
modules-center = xwindow
modules-right = fs-root clock
wm-restack = ${bar/bottom.wm-restack}
[module/fs-root]
type = internal/fs
mount-0 = /
label-mounted = %{F#e60053}%percentage_used%%%{F-} used of %mountpoint%
[module/xbacklight]
type = internal/xbacklight
output = eDP-1
format = <ramp> <bar>
ramp-0 = 
ramp-0-foreground = #666
ramp-1 = 
ramp-1-foreground = #999
ramp-2 = 
ramp-2-foreground = #fff
bar-width = 12
bar-indicator = |
bar-indicator-font = 6
bar-indicator-foreground = #bbffffff
bar-fill = ─
bar-fill-font = 6
bar-fill-foreground = #9f78e1
bar-empty = ─
bar-empty-font = 6
bar-empty-foreground = #44
interactive=true
[module/backlight]
type = internal/backlight
card = intel_backlight
format = <ramp> <label>
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = #666
interactive = true
[module/bspwm]
type = internal/bspwm
format = <label-state> <label-mode>
ws-icon-0 = term;
ws-icon-1 = web;
ws-icon-2 = code;
ws-icon-3 = music;
ws-icon-4 = irssi;
ws-icon-default = 
label-dimmed-underline = ${root.background}
label-focused = %icon% %name%
label-focused-foreground = #f3f3f3
label-focused-background = #3f3f3f
label-focused-underline = ${colors.accent}
label-focused-font = 4
label-focused-padding = 4
label-occupied = %icon% %name%
label-occupied-underline = #555555
label-occupied-font = 4
label-occupied-padding = 4
label-urgent = %icon% %name%
label-urgent-foreground = #000000
label-urgent-background = #bd2c40
label-urgent-underline = #9b0a20
label-urgent-font = 4
label-urgent-padding = 4
label-empty = %icon% %name%
label-empty-foreground = #55ffffff
label-empty-font = 4
label-empty-padding = 4
[module/spotify]
type = custom/script
exec = ~/.config/polybar/spotify.sh %artist% - %title%
tail = true
interval = 2
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
pin-workspaces = true
ws-font=2
ws-icon-0 = term;
ws-icon-1 = web;
ws-icon-2 = code;
ws-icon-3 = music;
ws-icon-4 = irssi;
ws-icon-5 = discord;
ws-icon-default = 
label-dimmed-underline = ${root.background}
label-focused = %icon% %name%
label-focused-foreground = #f3f3f3
label-focused-background = #3f3f3f
;label-focused-underline = #${colors.accent}
label-focused-underline = #9f78e1
label-focused-font = 4
label-focused-padding = 2
label-unfocused = %icon% %name%
label-unfocused-underline = #555555
label-unfocused-font = 4
label-unfocused-padding = 2
label-urgent = %icon% %name%
label-urgent-foreground = #000000
label-urgent-background = #bd2c40
label-urgent-underline = #9b0a20
label-urgent-font = 4
label-urgent-padding = 2
label-visible = %icon% %name%
label-visible-foreground = #55ffffff
label-visible-font = 4
label-visible-padding = 2
[module/cpu]
type = internal/cpu
interval = 1.5
format = <label> <ramp-coreload>
label = CPU
label-font = 3
label-foreground = #99
ramp-coreload-0 = ▁
ramp-coreload-0-font = 2
ramp-coreload-0-foreground = #aaff77
ramp-coreload-1 = ▂
ramp-coreload-1-font = 2
ramp-coreload-1-foreground = #aaff77
ramp-coreload-2 = ▃
ramp-coreload-2-font = 2
ramp-coreload-2-foreground = #aaff77
ramp-coreload-3 = ▄
ramp-coreload-3-font = 2
ramp-coreload-3-foreground = #aaff77
ramp-coreload-4 = ▅
ramp-coreload-4-font = 2
ramp-coreload-4-foreground = #fba922
ramp-coreload-5 = ▆
ramp-coreload-5-font = 2
ramp-coreload-5-foreground = #fba922
ramp-coreload-6 = ▇
ramp-coreload-6-font = 2
ramp-coreload-6-foreground = #ff5555
ramp-coreload-7 = █
ramp-coreload-7-font = 2
ramp-coreload-7-foreground = #ff5555
[module/memory]
type = internal/memory
interval = 0.2
format = <label> <bar-used>
label = RAM
label-font = 3
label-foreground = #99
bar-used-width = 30
bar-used-gradient = true
bar-used-foreground-0 = #449f3d
bar-used-foreground-1 = #2f8419
bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ed5456
bar-used-indicator = █
bar-used-indicator-font = 5
bar-used-indicator-foreground = #fff
bar-used-fill = █
bar-used-fill-font = 5
bar-used-empty = █
bar-used-empty-font = 5
bar-used-empty-foreground = #44
[module/wireless-network]
type = internal/network
interface = wlp2s0
interval = 2.0
ping-interval = 10
format-connected = <ramp-signal> <label-connected>
label-connected = %essid% - %local_ip%
label-disconnected =  not connected
label-disconnected-foreground = #66
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
animation-packetloss-0 = 
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 = 
animation-packetloss-1-foreground = ${bar/top.foreground}
animation-packetloss-framerate = 500
[module/wired-network]
type = internal/network
interface = eth0
interval = 2.0
label-connected =  %local_ip%
label-disconnected = Ethernet disconnected
label-disconnected-foreground = #66
[module/mpd]
type = internal/mpd
format-online = <bar-progress> <icon-prev> <icon-stop> <toggle> <icon-next> <label-song>
format-online-overline = ${root.background}
format-online-underline = ${root.background}
format-offline = <label-offline>
label-offline = mpd is off
icon-play = 
icon-pause = 
icon-stop = 
icon-prev = 
icon-next = 
icon-random = 
icon-repeat = 
toggle-on-foreground =
toggle-off-foreground = #55
bar-progress-width = 45
bar-progress-format = %{+o +u}%fill%%{-o -u}%indicator%%{+o +u}%empty%%{-u -o}
; bar-progress-indicator = |
bar-progress-indicator = █
bar-progress-indicator-foreground = #ff
bar-progress-indicator-font = 3
; bar-progress-fill = ─
bar-progress-fill = █
bar-progress-fill-foreground = #bb
bar-progress-fill-font = 3
; bar-progress-empty = ─
bar-progress-empty = ▒
bar-progress-empty-font = 3
bar-progress-empty-foreground = #44
[module/clock]
type = internal/date
interval = 1
format-padding = 5
format-background = #000
format-foreground = #fff
date = %%{F#bb}%Y-%m-%d%%{F-} %%{F#ee}%H:%M:%S%%{F-}
[module/volume]
type = internal/alsa
format-volume = <ramp-volume> <label-volume>
label-volume = volume %percentage%%
label-volume-foreground = #ff
format-muted-prefix = ""
format-muted-foreground = #66
label-muted = sound muted
label-muted-foreground = #99ffffff
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-volume-foreground = #9f78e1
[module/github]
type = internal/github
; Accessing an access token stored in file
token = ${file:/home/joseph/github.access}
; Whether empty notifications should be displayed or not
empty-notifications = false
; Number of seconds
interval=10
[module/battery]
type = internal/battery
full-at = 98
battery=BAT1
adapter=ADAP
format-charging = %{F#81d13c}Battery <label-charging>%{F-}
format-discharging = %{F#e23228}Battery <label-discharging>%{F-}
;format-full = %{T3}Battery <label-full>
label-charging-font = 3
label-discharging-font = 3
label-full =
;label-full-font = 3
[module/xwindow]
type = internal/xwindow
label-maxlen = 75
label-foreground = #bbb
[module/powermenu]
type = custom/menu
format-padding = 3
format-background = #000
format-foreground = #fff
label-open = 
label-close = 
label-separator = " - "
menu-0-0 = Terminate WM
menu-0-0-foreground = ${colors.accent}
menu-0-0-exec = bspc quit -1
menu-0-1 = Reboot
menu-0-1-foreground = ${colors.accent}
menu-0-1-exec = menu-open-1
menu-0-2 = Power off
menu-0-2-foreground = ${colors.accent}
menu-0-2-exec = menu-open-2
menu-1-0 = Cancel
menu-1-0-foreground = ${colors.accent}
menu-1-0-exec = menu-open-0
menu-1-1 = Reboot
menu-1-1-foreground = ${colors.accent}
menu-1-1-exec = sudo reboot
menu-2-0 = Power off
menu-2-0-foreground = ${colors.accent}
menu-2-0-exec = sudo poweroff
menu-2-1 = Cancel
menu-2-1-foreground = ${colors.accent}
menu-2-1-exec = menu-open-0
; vim:ft=dosini
#!/bin/sh
main() {
if ! pgrep -x spotify >/dev/null; then
echo ""; exit
fi
cmd="org.freedesktop.DBus.Properties.Get"
domain="org.mpris.MediaPlayer2"
path="/org/mpris/MediaPlayer2"
meta=$(dbus-send --print-reply --dest=${domain}.spotify \
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:${domain}.Player string:Metadata)
artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | tail -1 | sed "s/\&/+/g")
album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1)
title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed "s/\&/+/g")
echo " ${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed 's/&/\\&/g'
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment