Last active
January 29, 2018 18:07
-
-
Save Demonstrandum/9b00c36c78bf302f8d75d322eaf34e2f 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
#!/bin/bash | |
time="$(date '+%H:%M')" | |
printf " $time" |
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
[colors] | |
transparent = #00000000 | |
foreground = #3c3836 | |
background = #25232A | |
black = ${xrdb:color8} | |
red = ${xrdb:color9} | |
green = ${xrdb:color10} | |
yellow = ${xrdb:color11} | |
blue = ${xrdb:color12} | |
magenta = ${xrdb:color13} | |
cyan = ${xrdb:color14} | |
white = ${xrdb:color15} | |
grey = #928374 | |
bblack = ${xrdb:color0} | |
bred = ${xrdb:color1} | |
bgreen = ${xrdb:color2} | |
byellow = ${xrdb:color3} | |
bblue = ${xrdb:color4} | |
bmagenta = ${xrdb:color5} | |
bcyan = ${xrdb:color6} | |
bwhite = ${xrdb:color7} | |
bgrey = #7c6f64 | |
t1 = #332D35 | |
t2 = #7D6297 | |
t6 = #CAB8D1 | |
t3 = #AD9CC3 | |
t4 = #B6A5C8 | |
t5 = #C0AECD | |
t7 = #D3C1D6 | |
t8 = #DDCADB | |
[bar/top] | |
monitor = DP-1 | |
bottom = false | |
width = 3840 | |
height = 25 | |
override-redirect = true | |
enable-ipc = true | |
padding-left = 0 | |
padding-right = 0 | |
offset-x = 0 | |
offset-y = 0 | |
tray-detached = false | |
tray-position = right | |
tray-offset-x = 0 | |
tray-offset-y = 0 | |
tray-maxsize = 16 | |
tray-padding = 0 | |
tray-scale = 0 | |
background = ${colors.background} | |
foreground = ${colors.foreground} | |
border-left-size = 15 | |
border-right-size = 15 | |
border-color = ${self.background} | |
font-0 = Fantasque Sans Mono:style:SemiBold:size=10;2 | |
font-1 = FontAwesome:size=10;2 | |
font-2 = Cousine for Powerline:size=18;2 | |
modules-right = pkg volume temps memory cpu weather clock | |
modules-left = mpd | |
wm-restack = i3 | |
[module/mpd] | |
type = internal/mpd | |
host = 127.0.0.1 | |
port = 6600 | |
label-song = %artist% - %title% | |
label-song-maxlen = 40 | |
label-song-ellipsis = true | |
format-online = <label-song><toggle> | |
# <icon-seekb> <toggle> <icon-seekf> <icon-next> <icon-random> <icon-repeat> | |
label-song-foreground = ${colors.foreground} | |
label-song-background = ${colors.t5} | |
icon-pause-background = ${self.label-song-background} | |
icon-play-background = ${self.label-song-background} | |
icon-pause-foreground = ${self.label-song-foreground} | |
icon-play-foreground = ${self.label-song-foreground} | |
icon-next-background = ${self.label-song-background} | |
icon-next-foreground = ${self.label-song-foreground} | |
icon-prev-background = ${self.label-song-background} | |
icon-prev-foreground = ${self.label-song-foreground} | |
gap-foreground = ${self.label-song-background} | |
space-background = ${self.label-song-background} | |
label-song-padding = 2 | |
icon-pause-padding-right = 2 | |
icon-play-padding-right = 2 | |
icon-prev = | |
icon-seekb = | |
icon-stop = | |
icon-pause = | |
icon-play = | |
icon-next = | |
icon-seekf = | |
icon-random = | |
icon-repeat = | |
toggle-off-foreground = ${colors.grey} | |
toggle-on-foreground = ${colors.blue} | |
format-online-prefix = | |
;format-online-prefix-foreground = ${module/xwindow.format-background} | |
format-online-prefix-background = ${self.label-song-background} | |
format-online-suffix = | |
format-online-suffix-foreground = ${self.label-song-background} | |
label-offline = 🎜 mpd is offline | |
interval = 2 | |
[module/memory] | |
type = internal/memory | |
interval = 2 | |
format = <label> | |
label = %percentage_used%% | |
label-background = ${colors.t5} | |
format-underline = ${colors.cyan} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = #D3C1D6 | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-background = ${self.label-background} | |
format-suffix-foreground = ${module/cpu.format-background} | |
[module/cpu] | |
format-label = internal/cpu | |
format = <label> | |
format-background = ${colors.t3} | |
format-padding = 2 | |
type = internal/cpu | |
interval = 2 | |
label = %percentage%% | |
padding = 0 | |
[module/wlan] | |
type = internal/network | |
interface = wlp3s0 | |
interval = 3.0 | |
label-connected-padding = 2 | |
label-disconnected-padding = 2 | |
format-connected = <label-connected> | |
format-disconnected = <label-disconnected> | |
label-connected-foreground = ${colors.foreground} | |
label-connected-background = ${colors.t7} | |
label-disconnected-foreground = ${colors.bgrey} | |
label-disconnected-background = ${colors.t7} | |
label-connected = %essid% | |
label-disconnected = | |
format-connected-prefix = | |
format-connected-prefix-background = ${module/cpu.format-background} | |
format-connected-prefix-foreground = ${self.label-connected-background} | |
format-disconnected-prefix = | |
format-disconnected-prefix-background = ${module/cpu.format-background} | |
format-disconnected-prefix-foreground = ${self.label-connected-background} | |
[module/eth] | |
type = internal/network | |
interface = enp0s25 | |
interval = 3.0 | |
format-connected = <label-connected> | |
format-disconnected = <label-disconnected> | |
label-connected-padding = 2 | |
label-disconnected-padding = 2 | |
label-connected = connected | |
label-disconnected = | |
label-connected-foreground = ${colors.foreground} | |
label-connected-background = ${colors.t7} | |
label-disconnected-foreground = ${colors.bgrey} | |
label-disconnected-background = ${colors.t7} | |
format-connected-suffix = | |
format-connected-suffix-foreground = ${module/battery.format-background} | |
format-connected-foreground = ${self.label-connected-background} | |
format-disconnected-suffix = | |
format-disconnected-suffix-foreground = ${module/battery.format-background} | |
format-disconnected-suffix-background = ${self.label-connected-background} | |
[module/date] | |
type = internal/date | |
interval = 2 | |
date = " %d.%m.%Y" | |
date-alt = " %A, %d. %B" | |
time = " %H:%M" | |
time-alt = "%H:%M:%S" | |
label-background = ${colors.t7} | |
#label-foreground = ${colors.cyan} | |
label-padding = 2 | |
format-padding = 0 | |
format = <label> | |
label = %time% | %date% | |
format-prefix = | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-foreground = ${self.label-background} | |
[module/volume] | |
type = internal/volume | |
format = <label> | |
format-muted-background = #B6A5C8 | |
format-volume-background = #B6A5C8 | |
format-volume = <bar-volume> | |
format-muted = <label-muted> | |
label-muted = sound muted | |
format-muted-padding = 0 | |
format-padding = 2 | |
bar-volume-width = 8 | |
bar-volume-gradient = false | |
bar-volume-indicator = | |
bar-volume-indicator-font = 4 | |
bar-volume-indicator-foreground = #25232A | |
bar-volume-fill = | |
bar-volume-fill-font = 4 | |
bar-volume-fill-foreground = #25232A | |
bar-volume-empty = | |
bar-volume-empty-font = 4 | |
bar-volume-empty-foreground = #25232A | |
bar-volume-background = ${colors.t4} | |
label-muted-background = ${colors.t4} | |
bar-volume-empty-background = #B6A5C8 | |
bar-volume-fill-background = #B6A5C8 | |
bar-volume-indicator-background = #B6A5C8 | |
format-volume-prefix = | |
format-volume-prefix-foreground = #B6A5C8 | |
format-volume-prefix-background = #DDCADB | |
format-volume-suffix = | |
format-volume-suffix-foreground = #D3C1D6 | |
format-volume-suffix-background = #B6A5C8 | |
format-muted-prefix = | |
format-muted-prefix-foreground = #B6A5C8 | |
format-muted-prefix-background = #DDCADB | |
format-muted-suffix = | |
format-muted-suffix-foreground = #D3C1D6 | |
format-muted-suffix-background = #B6A5C8 | |
[module/battery] | |
type = internal/battery | |
battery = BAT0 | |
adapter = AC | |
full-at = 98 | |
format-charging = <animation-charging> <label-charging> | |
time-format = %H:%M | |
format-discharging = <ramp-capacity> <label-discharging> | |
label-discharging = %percentage% (%time%) | |
format-full-prefix = " " | |
format-padding = 2 | |
format-background = ${colors.t6} | |
#format-foreground = ${colors.magenta} | |
format-foreground = ${colors.foreground} | |
format-full-background = ${self.format-background} | |
format-charging-background = ${self.format-background} | |
format-discharging-background = ${self.format-background} | |
format-full-foreground = ${self.format-foreground} | |
format-charging-foreground = ${self.format-foreground} | |
format-discharging-foreground = ${self.format-foreground} | |
format-full-padding = ${self.format-padding} | |
format-charging-padding = ${self.format-padding} | |
format-discharging-padding = ${self.format-padding} | |
ramp-capacity-0 = | |
ramp-capacity-1 = | |
ramp-capacity-2 = | |
ramp-capacity-3 = | |
ramp-capacity-4 = | |
animation-charging-0 = | |
animation-charging-1 = | |
animation-charging-2 = | |
animation-charging-3 = | |
animation-charging-4 = | |
animation-charging-framerate = 750 | |
[module/temperature] | |
type = internal/temperature | |
thermal-zone = 0 | |
warn-temperature = 80 | |
format = <ramp><label> | |
format-background = ${colors.t5} | |
label-background = ${colors.t5} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = ${module/battery.format-background} | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-foreground = ${self.label-background} | |
format-warn-prefix = | |
format-warn-prefix-background = ${module/battery.format-background} | |
format-warn-prefix-foreground = ${self.label-warn-background} | |
format-warn-suffix = | |
format-warn-suffix-foreground = ${self.label-warn-background} | |
format-warn = <label-warn> | |
label-warn-background = ${colors.t2} | |
ramp-background = ${colors.t5} | |
label = %temperature% | |
label-warn = %temperature% | |
ramp-0 = " " | |
ramp-1 = " " | |
ramp-2 = " " | |
[module/weather] | |
type = custom/script | |
interval = 300 | |
format = <label> | |
exec = .config/polybar/weather.sh | |
label-background = ${colors.t7} | |
format-underline = ${colors.cyan} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = #B6A5C8 | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-background = ${self.label-background} | |
format-suffix-foreground = #AD9CC3 | |
[module/clock] | |
type = custom/script | |
interval = 1 | |
format = <label> | |
exec = .config/polybar/clock.sh | |
label-background = ${colors.t8} | |
format-underline = ${colors.cyan} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = #AD9CC3 | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-background = #DDCADB | |
format-suffix-foreground = #25232A | |
[module/pkg] | |
type = custom/script | |
interval = 120 | |
format = <label> | |
label = "%output:0:30%" | |
exec = .config/polybar/pkg.sh | |
exec-if = "ping -q -w 2 -c 1 176.34.135.167 > /dev/null" | |
label-background = ${colors.t3} | |
format-underline = ${colors.cyan} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = #25232A | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-background = ${self.label-background} | |
format-suffix-foreground = #DDCADB | |
[module/temps] | |
type = custom/script | |
interval = 1 | |
format = <label> | |
exec = .config/polybar/cputemp.sh | |
label-background = ${colors.t5} | |
format-underline = ${colors.cyan} | |
label-padding = 2 | |
format-prefix = | |
format-prefix-background = #D3C1D6 | |
format-prefix-foreground = ${self.label-background} | |
format-suffix = | |
format-suffix-background = ${self.label-background} | |
format-suffix-foreground = #B6A5C8 |
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/bash | |
tempGPU=$(sensors | grep temp1 | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/') | |
tempCore0=$(sensors | grep -i "Core 0" | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/' | grep -oP '.*?(?=\.)') | |
tempCore1=$(sensors | grep -i "Core 1" | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/' | grep -oP '.*?(?=\.)') | |
tempCore2=$(sensors | grep -i "Core 2" | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/' | grep -oP '.*?(?=\.)') | |
tempCore3=$(sensors | grep -i "Core 3" | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/' | grep -oP '.*?(?=\.)') | |
tempCore4=$(sensors | grep -i "Physical id 0" | head -n1 | sed -r 's/.*:\s+[\+-]?(.*C)\s+.*/\1/' | grep -oP '.*?(?=\.)') | |
tempCPU=$(bc -l <<< "($tempCore0 + $tempCore1 + $tempCore2 + $tempCore3 + $tempCore4)/5" | awk '{print substr($0,0,4)}') | |
tempCPU="$tempCPU°C" | |
printf " CPU: $tempCPU / GPU: $tempGPU" |
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/bash | |
# Terminate already running bar instances | |
killall -q polybar | |
# Wait until the processes have been shut down | |
while pgrep -x polybar >/dev/null; do sleep 1; done | |
# Launch bar1 and bar2 | |
polybar top & | |
echo "Bars launched..." |
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/bash | |
pac=$(checkupdates | wc -l) | |
aur=$(cower -u | wc -l) | |
check=$((pac + aur)) | |
if [[ "$check" != "0" ]] | |
then | |
echo "$pac %{F#25232A}%{F-} $aur" | |
else | |
echo "%{F#25232A}%{F-} No updates!" | |
fi |
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
.config/polybar/ 0000755 0001750 0000144 00000000000 13233660662 012743 5 ustar weet users .config/polybar/weather.sh 0000755 0001750 0000144 00000004536 13164766103 014751 0 ustar weet users #!/bin/bash | |
### API Information ### | |
# This script uses the Dark Sky weather API. You will need to register an account to get an API key. The first 1000 API requests you make every day are free of charge. | |
# Documentation overview: https://darksky.net/dev/docs | |
# Account overview: https://darksky.net/dev/account | |
# Define your location. api.darksky.net/forecast/api_key/latitude,longitude?... If you want Fahrenheit, use units=us | |
address="https://api.darksky.net/forecast/224d4ae65447ccbfaf102bc5a86cfa63/51.5033640,-0.1276250?units=si&exclude=minutely,hourly,daily,alerts,flags" | |
weather="$(wget -q -O- $address)" | |
# Look for the current weather conditions | |
[[ "$weather" =~ \"icon\":\"([^\"]*)\" ]] | |
condition="${BASH_REMATCH[1]}" | |
# Look for the current apparent temperature. Use \"temperature\", if you like. | |
[[ "$weather" =~ \"apparentTemperature\":([^,]*), ]] | |
temperature="${BASH_REMATCH[1]}" | |
# Print some spacing, and a cloud icon. If you can't see the icon, install otf-fontawesome from the AUR or find it for your distribution | |
printf "\040" | |
# Print a rounded temperature value | |
LC_ALL=C /usr/bin/printf '%.0f' " $temperature" | |
# Use either Celsius or Fahrenheit character | |
if grep -qi 'units=us' <<< $address; then | |
printf "°F" | |
else | |
printf "°C" | |
fi | |
# Print edgy shit about the weather | |
if grep -qi 'rain' <<< $condition; then | |
printf " Pluviophile dreams" | |
elif grep -qi 'partly-cloudy' <<< $condition; then | |
printf " It's alright" | |
elif grep -qi 'cloudy' <<< $condition; then | |
printf " Grey and dull" | |
elif grep -qi 'clear-day' <<< $condition; then | |
printf " Diffuse sky radiation" | |
elif grep -qi 'clear-night' <<< $condition; then | |
printf " Look up at the stars." | |
elif grep -qi 'snow' <<< $condition; then | |
printf " It's snowing!" | |
elif grep -qi 'fog' <<< $condition; then | |
printf " Spooky." | |
elif grep -qi 'wind' <<< $condition; then | |
printf " Don't fly away" | |
elif grep -qi 'sleet' <<< $condition; then | |
printf " Sleet. Stay inside" | |
# Next 3 may not be defined yet. | |
elif grep -qi 'thunderstorm' <<< $condition; then | |
printf " The gods are wrathful" | |
elif grep -qi 'hail' <<< $condition; then | |
printf " Hail. Stay inside" | |
elif grep -qi 'tornado' <<< $condition; then | |
printf " Tornado. Stay inside. Or don't. You'll probably never see this text. Basement? Be careful." | |
else | |
printf " Look out the window" | |
fi | |
# Powered by Dark Sky. See more: https://darksky.net/poweredby/ | |