Skip to content

Instantly share code, notes, and snippets.

@magnuspedro
Last active October 15, 2017 00:52
Show Gist options
  • Save magnuspedro/ee3d62b1376a88854d405d1550ac55fb to your computer and use it in GitHub Desktop.
Save magnuspedro/ee3d62b1376a88854d405d1550ac55fb to your computer and use it in GitHub Desktop.
My polybar
;-------------------------------------------------
; ;
; Polybar config for my themes ;
; ;
; ;
;-------------------------------------------------
[colors]
;my_background = #0d000000
my_background = #0d000000
my_foreground = #FFF
my_color0 = #073642
my_color1 = #dc332f
my_color2 = #859900
my_color3 = #b58900
my_color4 = #268bd2
my_color5 = #d33682
my_color6 = #2aa198
my_color7 = #eee8d5
my_color8 = #002b36
my_color9 = #cb4b16
my_color10 = #586e75
my_color11 = #657b83
my_color12 = #839496
my_color13 = #6c71c4
my_color14 = #93a1a1
my_color15 = #fdf6e3
[bar/top_bar]
;monitor = ${env:MONITOR:HDMI-1}
monitor = ${env:MONITOR}
top = true
;width = 90%
width = 100%
height = 20
offset-x = 0%
offset-y = 1%
radius = 0.0
fixed-center = true
tray-transparent = true
tray-detached = false
background = ${colors.my_background}
;foreground = ${colors.my_foreground}
foreground = ${colors.my_foreground}
#line-size = 2
#line-color = ${colors.my_color4}
border-size = 0
#border-color = ${colors.my_color4}
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 0
font-0 = Hack:fontformat=truetype:size=9;1
font-1 = Hack:fontformat=truetype:size=9;1
font-2 = FontAwesome:fontformat=truetype:size=9;1
font-3 = MaterialIcons:size=9;0
modules-center = xwindow spotify
modules-left = previous playPause next
modules-right = filesystemHome filesystem
[bar/main_bar]
;monitor = ${env:MONITOR:HDMI-1}
monitor = ${env:MONITOR}
bottom = true
;width = 90%
width = 100%
height = 20
;offset-x = 5%
;offset-y = 1%
offset-x = 0%
offset-y = 0
radius = 0.0
fixed-center = true
separator = " "
background = ${colors.my_background}
;foreground = ${colors.my_foreground}
foreground = ${colors.my_foreground}
line-size = 2
line-color = ${colors.my_color4}
border-size = 0
border-color = ${colors.my_color4}
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 0
font-0 = Hack:fontformat=truetype:size=9;1
font-1 = Hack:fontformat=truetype:size=9;1
font-2 = FontAwesome:fontformat=truetype:size=9;1
font-3 = MaterialIcons:size=10;2
modules-left = powermenu ewmh temperature cpu memory
modules-center = date
modules-right = battery volume backlight eth
tray-position = right
tray-padding = 9
tray-transparent = true
tray-offset-y = 0%
tray-offset-x = 0%
tray-maxsize = 18
tray-detached = false
#tray-background = ${colors.my_background}
#tray-underline = ${colors.my_color4}
;wm-restack = bspwm
wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev
[module/memory]
type = internal/memory
format = <bar-used>
format-foreground = ${colors.my_color6}
format-padding = 1
label = RAM
bar-used-indicator =
bar-used-width = 20
bar-used-foreground-0 = #55aa55
bar-used-foreground-1 = #557755
bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ff5555
bar-used-fill = ▐
bar-used-empty = ▐
bar-used-empty-foreground = #444444
[module/cpu]
type = internal/cpu
interval = 0.5
format = <ramp-coreload>
format-padding = 1
label = CPU
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/backlight]
type = internal/xbacklight
label = %percentage%%
format = <ramp> <label>
;format-foreground = ${colors.my_color9}
format-padding = 1
format-spacing-margin = 10
ramp-0 = 🌕
ramp-1 = 
ramp-2 = 
ramp-3 = 
;[module/weather]
;type = custom/script
;interval = 60
;format-background = ${colors.background-mod1}
;format = <label>
;format-prefix = " ⁣  "
;format-suffix = " "
;format-prefix-foreground = ${colors.foreground-alt}
;exec = python ~/.config/polybar/weather.py
;[module/mpd]
;type = internal/mpd
;interval = 1
;format-offline-background = ${colors.background}
;format-online-background = ${colors.background-mod0}
;toggle-off-foreground = #FF0000
;toggle-on-foreground = #FF0000
;host = 127.0.0.1
;port = 6600
;format-online = " ⁣ <label-song> "
;format-offline =
;format-stop =
[module/i3]
type = internal/i3
;
;strip-wsnumbers = true
;
;label-focused-padding = 3
;label-unfocused-padding = 3
;
;label-focused-background = ${colors.background-alt}
;label-unfocused-background = ${colors.my_background}
;label-unfocused-foreground = ${colors.my_foreground}
;label-unfocused-underline = ${colors.my_foreground}
;
;label-mode-padding = 0
;label-mode-background = ${colors.background-unf}
;
;label-visible-underline = ${colors.my_background}
;label-visible-padding = 4
; Available tokens:
; %mode%
; Default: %mode%
label-mode = %mode%
label-mode-padding = 2
;label-mode-background = ${colors.my_color4}
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-focused = %index%
;label-focused-foreground = ${colors.my_foreground}
;label-focused-foreground = ${colors.my_foreground}
;label-focused-background = ${colors.my_background}
;label-focused-underline = ${colors.my_color4}
;label-focused-padding = 2
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-unfocused = %index%
label-unfocused-padding = 2
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-visible = %index%
label-visible-underline = ${colors.my_foreground}
label-visible-padding = 4
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-urgent = %index%
label-urgent-foreground = ${colors.my_foreground}
label-urgent-background = ${colors.my_background}
label-urgent-underline = ${colors.my_color8}
label-urgent-padding = 2
;[module/wlan]
;type = internal/network
;interface = wlo1
;interval = 3.0
;format-connected-background = ${colors.my_background}
;format-connected = "<ramp-signal><label-connected>"
;format-connected-underline = #9f78e1
;label-connected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
;ramp-signal-0 = 1
;ramp-signal-1 = 2
;ramp-signal-2 = 3
;ramp-signal-3 = 4
;ramp-signal-4 = 5
;ramp-signal-foreground = ${colors.my_foreground}
[module/eth]
type = internal/network
interface = wlp3s0
interval = 3.0
format-connected-padding = 1
;format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.my_foreground}
format-connected = <label-connected>
label-connected = %local_ip% %downspeed:9%
label-connected-foreground = #eefafafa
format-disconnected = <label-disconnected>
format-packetloss = <animation-packetloss> <label-connected>
label-disconnected = %ifname% disconnected
label-disconnected-foreground = ${colors.my_foreground}
; Only applies if <animation-packetloss> is used
animation-packetloss-0 = ⚠
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 = 📶
animation-packetloss-1-foreground = #000000
; Framerate in milliseconds
animation-packetloss-framerate = 500
[module/playPause]
type = custom/script
exec = python3 ~/.config/polybar/playPause.py
format-padding = 1
interval = 2
format = <label>
format-foreground = ${colors.my_foreground}
format-background = ${colors.my_background}
click-left = playerctl play-pause
[module/next]
type = custom/script
exec = echo 
format-padding = 1
format = <label>
format-foreground = ${colors.my_foreground}
format-background = ${colors.my_background}
click-left = playerctl next
[module/previous]
type = custom/script
exec = echo 
format-padding = 1
format = <label>
format-foreground = ${colors.my_foreground}
format-background = ${colors.my_background}
click-left = playerctl previous
[module/spotify]
type = custom/script
exec = python ~/.config/polybar/spotify.py
interval = 5
format = <label>
label =%output:0:500:...%
format-background = ${colors.my_background}
format-padding = 3
format-foreground = ${colors.my_foreground}
[module/date]
type = internal/date
interval = 5
date =
date-alt = "%d/%m/%Y"
time = "%A %B %d, %I:%M %p "
time-alt = %H:%M %p
format-prefix-foreground = ${colors.my_foreground}
label = %time%
[module/volume]
type = internal/volume
format-volume-foreground = ${colors.my_foreground}
format-muted-background = ${colors.my_background}
format-volume-background = ${colors.my_background}
format-volume-padding = 1
format-muted-padding = 1
format-volume = <ramp-volume> <label-volume>
;format-muted-foreground = ${colors.my_color3}
;format-muted-underline = ${colors.my_color3}
label-muted = 
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-headphones-0 = 
ramp-headphones-1 = 
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC0
format-padding = 1
full-at = 95
;format-full-background = ${colors.my_color4}
format-full-background = ${colors.my_background}
format-full-foreground = ${colors.my_foreground}
format-full-padding = 1
format-charging-background = ${colors.my_background}
format-charging = " <animation-charging> <label-charging>"
format-charging-padding = 1
;format-discharging-background = ${colors.my_color4}
format-discharging-background = ${colors.my_background}
format-discharging-foreground = ${colors.my_foreground}
format-discharging-padding = 1
format-discharging = "<ramp-capacity> <label-discharging>"
;format-full-prefix-foreground = ${colors.my_color4}
format-full-prefix-foreground = ${colors.my_foreground}
format-full-prefix = " "
format-charing-background = ${colors.my_background}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
ramp-capacity-foreground = ${colors.my_foreground}
;ramp-capacity-foreground = ${colors.my_color4}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
;animation-charging-foreground = ${colors.my_foreground}
;animation-charging-foreground = ${colors.my_background}
animation-charging-foreground = ${colors.my_foreground}
animation-charging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
format = <ramp> <label>
;format-underline = #f50a4d
format-warn = <ramp> <label-warn>
;format-warn-underline = ${self.format-underline}
label = %temperature%
label-warn = %temperature%
label-warn-foreground = ${colors.my_foreground}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = ${colors.my_foreground}
[module/powermenu]
type = custom/menu
format-spacing = 1
label-open = " "
label-open-background = ${colors.my_background}
label-open-foreground = ${colors.my_foreground}
label-close = "  Cancel"
label-close-background = ${colors.my_background}
label-close-foreground = ${colors.my_foreground}
label-separator = " "
label-separator-foreground = ${colors.my_foreground}
menu-0-0 = Reboot
menu-0-0-exec = menu-open-1
menu-0-1 = Power Off
menu-0-1-exec = menu-open-2
menu-1-0 = Cancel
menu-1-0-exec = menu-open-0
menu-1-1 = Reboot
menu-1-1-exec = sudo reboot
menu-2-0 = Power Off
menu-2-0-exec = sudo poweroff
menu-2-1 = Cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
[global/wm]
margin-top = 5
margin-bottom = 5
;
; [module/xkeyboard]
; type = internal/xkeyboard
; blacklist-0 = num lock
;
; format-prefix = " "
; format-prefix-foreground = ${colors.foreground-alt}
; format-prefix-underline = ${colors.secondary}
;
; label-layout = %layout%
; label-layout-underline = ${colors.secondary}
;
; label-indicator-padding = 2
; label-indicator-margin = 1
; label-indicator-background = ${colors.secondary}
; label-indicator-underline = ${colors.secondary}
;
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
fixed-values = true
label-mounted-padding = 1
spacing = 4
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
[module/filesystemHome]
type = internal/fs
interval = 25
mount-0 = /home
fixed-values = true
label-mounted-padding = 1
spacing = 4
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
;label-unmounted = %mountpoint% not mounted
;label-unmounted-foreground = ${colors.foreground-alt}
;
;
;[module/xbacklight]
;type = internal/xbacklight
;
;format = <label> <bar>
;label = BL
;
;bar-width = 10
;bar-indicator = 
;bar-indicator-foreground = #ff
;bar-indicator-font = 2
;bar-fill = -
;bar-fill-font = 2
;bar-fill-foreground = #9f78e1
;bar-empty = -
;bar-empty-font = 2
;bar-empty-foreground = ${colors.foreground-alt}
;bar-empty-background = ${colors.foreground-mod}
;
;[module/backlight-acpi]
;inherit = module/xbacklight
;type = internal/backlight
;card = intel_backlight
;
;[module/cpu]
;type = internal/cpu
;interval = 2
;format-prefix = " "
;format-prefix-foreground = ${colors.foreground-alt}
;format-prefix-background = ${colors.foreground-mod}
;format-underline = #f90000
;label = %percentage%%
;
;[module/memory]
;type = internal/memory
;interval = 2
;format-prefix = " "
;format-prefix-foreground = ${colors.foreground-alt}
;format-underline = #4bffdc
;label = %percentage_used%%
; vim:ft=dosini
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
label-padding = 3
;label-underline = ${colors.my_color7}
my_foreground = ${colors.foreground}
format-background = ${colors.my_background}
;label-foreground = ${colors.my_color7}
[module/ewmh]
type = internal/i3
pin-workspaces = true
enable-click = true
enable-scroll = false
strip-wsnumbers = true
label-font = font-5
label-focused-padding = 1
label-unfocused-padding = 1
;
;label-unfocused-background = ${colors.my_background}
;label-unfocused-foreground = ${colors.my_foreground}
label-focused-underline = ${colors.my_color4}
import subprocess
val = subprocess.run(['playerctl status'],shell=True ,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
new = str(val.stdout.strip()).split("'")
if new[1] == "Paused" :
print("")
else:
print("")
#!/usr/bin/python
import dbus
try:
bus = dbus.SessionBus()
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
print(str(" "+props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
exit
except Exception:
print("No song currently playing.")
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment