Last active
June 15, 2017 09:38
-
-
Save mintyleaf/dc061cc431e494470946540eaee0fb7e to your computer and use it in GitHub Desktop.
Polybar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; mintyleaf polybar config | |
[colors] | |
background = #383838 | |
background-alt = #444 | |
foreground = #dfdfdf | |
foreground-alt = #555 | |
primary = #999999 | |
secondary = #999999 | |
alert = #ff9999 | |
[bar/def] | |
width = 100% | |
height = 27 | |
fixed-center = true | |
background = ${colors.background} | |
foreground = ${colors.foreground} | |
line-size = 3 | |
line-color = #f00 | |
border-size = 7 | |
border-bottom-size = 1 | |
border-color = #00000000 | |
padding-left = 0 | |
padding-right = 2 | |
module-margin-left = 1 | |
module-margin-right = 2 | |
font-0 = cantarell:pixelsize=9;1 | |
font-1 = FontAwesome:pixelsize=9;1 | |
font-2 = Weather\Icons:pixelsize=9;1 | |
font-3 = siji:pixelsize=10;1 | |
modules-left = i3 xwindow | |
modules-center = mpd | |
modules-right = volume weather xkeyboard date | |
scroll-up = i3wm-wsnext | |
scroll-down = i3wm-wsprev | |
[module/xwindow] | |
type = internal/xwindow | |
label = %title:0:50:...% | |
format-underline = #999999 | |
[module/xkeyboard] | |
type = internal/xkeyboard | |
blacklist-0 = num lock | |
format-prefix = " " | |
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/bspwm] | |
type = internal/bspwm | |
label-focused = %index% | |
label-focused-background = ${colors.background-alt} | |
label-focused-underline= ${colors.primary} | |
label-focused-padding = 2 | |
label-occupied = %index% | |
label-occupied-padding = 2 | |
label-urgent = %index%! | |
label-urgent-background = ${colors.alert} | |
label-urgent-padding = 2 | |
label-empty = %index% | |
label-empty-foreground = ${colors.foreground-alt} | |
label-empty-padding = 2 | |
[module/i3] | |
type = internal/i3 | |
format = <label-state> <label-mode> | |
index-sort = true | |
wrapping-scroll = false | |
label-mode-padding = 2 | |
label-mode-foreground = #000 | |
label-mode-background = ${colors.primary} | |
; focused = Active workspace on focused monitor | |
label-focused = %index% | |
label-focused-background = ${module/bspwm.label-focused-background} | |
label-focused-underline = ${module/bspwm.label-focused-underline} | |
label-focused-padding = ${module/bspwm.label-focused-padding} | |
; unfocused = Inactive workspace on any monitor | |
label-unfocused = %index% | |
label-unfocused-padding = ${module/bspwm.label-occupied-padding} | |
; visible = Active workspace on unfocused monitor | |
label-visible = %index% | |
label-visible-background = ${self.label-focused-background} | |
label-visible-underline = ${self.label-focused-underline} | |
label-visible-padding = ${self.label-focused-padding} | |
; urgent = Workspace with urgency hint set | |
label-urgent = %index% | |
label-urgent-background = ${module/bspwm.label-urgent-background} | |
label-urgent-padding = ${module/bspwm.label-urgent-padding} | |
[module/mpd] | |
type = internal/mpd | |
format-online = <label-song> <icon-prev> <toggle> <icon-next> <bar-progress> | |
bar-progress-width = 15 | |
bar-progress-indicator = | | |
bar-progress-indicator-font = 2 | |
bar-progress-fill = ─ | |
bar-progress-fill-font = 2 | |
bar-progress-empty = ─ | |
bar-progress-empty-font = 2 | |
bar-progress-empty-foreground = ${colors.foreground-alt} | |
icon-prev = | |
icon-stop = | |
icon-play = | |
icon-pause = | |
icon-next = | |
label-song-maxlen = 40 | |
label-song-ellipsis = true | |
[module/date] | |
type = internal/date | |
interval = 5 | |
date = %d.%m.%y | |
date-alt = " %Y-%m-%d" | |
time = %H:%M | |
time-alt = %H:%M | |
format-prefix = " " | |
format-underline = #999999 | |
label = %date% %time% | |
[module/volume] | |
type = internal/volume | |
format-volume = <bar-volume> | |
label-volume-foreground = ${root.foreground} | |
format-volume-underline = #999999 | |
format-muted-prefix = "x" | |
label-muted = " " | |
bar-volume-width = 10 | |
bar-volume-foreground-0 = #ffffff | |
bar-volume-gradient = false | |
bar-volume-indicator = | | |
bar-volume-indicator-font = 2 | |
bar-volume-fill = ─ | |
bar-volume-fill-font = 2 | |
bar-volume-empty = ─ | |
bar-volume-empty-font = 2 | |
bar-volume-empty-foreground = ${colors.foreground-alt} | |
[module/weather] | |
type = custom/script | |
interval = 10 | |
format = <label> | |
label-font=3 | |
format-underline = #999999 | |
exec = python ~/.config/polybar/weather | |
[settings] | |
screenchange-reload = true | |
[global/wm] | |
margin-top = 5 | |
margin-bottom = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
import urllib.request, json | |
city = "почтовый индекс" | |
api_key = "api ключ openweather приложения" | |
units = "Metric" | |
unit_key = "C" | |
d_icons = [u'\uf00d',u'\uf002',u'\uf041',u'\uf013',u'\uf009',u'\uf008',u'\uf010',u'\uf00a',u'\uf003'] | |
n_icons = [u'\uf02e',u'\uf086',u'\uf041',u'\uf013',u'\uf037',u'\uf036',u'\uf03b',u'\uf038',u'\uf04a'] | |
d_data = ['01d','02d','03d','04d','09d','10d','11d','13d','50d'] | |
n_data = ['01n','02n','03n','04n','09n','10n','11n','13n','50n'] | |
weather = eval(str(urllib.request.urlopen("http://api.openweathermap.org/data/2.5/weather?q={}&APPID={}&units={}".format(city, api_key, units)).read())[2:-1]) | |
info = weather["weather"][0]["description"].capitalize() | |
temp = int(float(weather["main"]["temp"])) | |
icon = weather["weather"][0]["icon"] | |
# да простит меня кто-нибудь за такое убожество | |
# да перепишет юзер сего скрипта это в словарь | |
if icon in d_data: | |
id = d_data.index(icon) | |
icon = d_icons[id] | |
elif icon in n_data: | |
id = n_data.index(icon) | |
icon = n_icons[id] | |
else: | |
icon = '' | |
print("%s %s, %i °%s" % (icon, info, temp, unit_key)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment