Skip to content

Instantly share code, notes, and snippets.

@gjabell
Created April 3, 2017 00:46
Show Gist options
  • Save gjabell/673aaaed9a61cde14236cfc0f00e712d to your computer and use it in GitHub Desktop.
Save gjabell/673aaaed9a61cde14236cfc0f00e712d to your computer and use it in GitHub Desktop.
Polybar (with music)
#!/bin/bash
player_status=$(playerctl status 2> /dev/null)
if [[ $? -eq 0 ]]; then
metadata="$(playerctl metadata artist) - $(playerctl metadata title)"
fi
# Foreground color formatting tags are optional
if [[ $player_status = "Playing" ]]; then
echo "%{F#FFFFFF}$metadata%{F-}"
elif [[ $player_status = "Paused" ]]; then
echo "%{F#999}$metadata%{F-}"
else
echo ""
fi
# Polybar config
# Colors based on gruvbox color scheme
[colors]
background = #282828
foreground = #EBDBB2
disabled = #928374
red = #CC241D
yellow = #D79921
green = #98971A
purple = #B16286
blue = #458588
black = #282828
[bar/main]
width = 100%
height = 30
enable-ipc = true
background = ${colors.background}
foreground = ${colors.foreground}
spacing = 3
lineheight = 16
padding-left = 0
padding-right = 5
module-margin-left = 0
module-margin-right = 5
font-0 = Roboto:size=11;2
font-1 = NotoSans:pixelsize=11;1
font-2 = FontAwesome:size=11;2
modules-left = i3 music
modules-center = date
modules-right = xbacklight volume disk wireless-network battery
[module/battery]
type = internal/battery
full-at = 98
format-charging = <animation-charging> <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full = <ramp-capacity> <label-full>
ramp-capacity-0 = 
ramp-capacity-0-foreground = ${colors.red}
ramp-capacity-1 = 
ramp-capacity-1-foreground = ${colors.yellow}
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
bar-capacity-width = 10
bar-capacity-format = %{+u}%{+o}%fill%%empty%%{-u}%{-o}
bar-capacity-fill = █
bar-capacity-fill-foreground = ${colors.foreground}
bar-capacity-fill-font = 3
bar-capacity-empty = █
bar-capacity-empty-font = 3
bar-capacity-empty-foreground = ${colors.foreground}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 750
animation-charging-foreground = ${colors.green}
[module/date]
type = internal/date
date = %H:%M
date-alt = %A, %d %B %Y
[module/disk]
type = internal/fs
format-mounted = <label-mounted>
label-mounted =  %used% / %total%
mount-0 = /
interval = 360
[module/i3]
type = internal/i3
index-sort = true
format = <label-state> <label-mode>
format-underline = ${colors.foreground}
label-focused = 
label-focused-foreground = ${colors.foreground}
label-focused-font = 2
label-focused-padding = 4
label-unfocused = 
label-unfocused-foreground = ${colors.disabled}
label-unfocused-font = 2
label-unfocused-padding = 4
label-urgent = 
label-urgent-foreground = ${colors.red}
label-urgent-font = 2
label-urgent-padding = 4
[module/music]
type = custom/script
interval = 1
label = %output%
exec = ~/.config/polybar/music
[module/volume]
type = internal/volume
speaker-mixer = Speaker
headphone-mixer = Headphone
headphone-id = 9
format-volume = <bar-volume>
format-volume-prefix = ""
format-volume-foreground = ${colors.foreground}
format-muted-prefix = ""
format-muted-foreground = ${colors.disabled}
label-muted = " ○○○○○○○○○○"
bar-volume-width = 10
bar-volume-gradient = false
bar-volume-indicator = ●
bar-volume-fill = ●
bar-volume-empty = ○
bar-volume-empty-foreground = ${colors.foreground}
[module/wireless-network]
type = internal/network
interface = wlp58s0
interval = 5
ping-interval = 10
format-connected = <ramp-signal> <label-connected>
label-connected = %essid%
label-disconnected =  not connected
label-disconnected-foreground = ${colors.disabled}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = 
label-foreground = ${colors.foreground}
bar-width = 10
bar-indicator = ●
bar-fill = ●
bar-empty = ○
bar-empty-foreground = ${colors.disabled}
; vim:ft=dosini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment