Last active
August 29, 2015 14:12
-
-
Save Aesthetikx/5298b33785f29e35cc67 to your computer and use it in GitHub Desktop.
LemonBoy's Bar Ruby Config
This file contains hidden or 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 Start | |
width = 2560 | |
height = 24 | |
fg = "'#66FFFFFF'" | |
bg = "'#AA000000'" | |
font = "-xos4-terminus-*-*-*-*-18-*-*-*-*-*-*-*" | |
def workspace | |
case `bspc query -D -d`.chomp | |
when "I" | |
" x---" | |
when "II" | |
" -x--" | |
when "III" | |
" --x-" | |
when "IV" | |
" ---x" | |
else | |
`bspc query -D -d` | |
end | |
end | |
def volume | |
`amixer get Master | grep -o "\[[0-9]*\%\]" | cut -c2-3`.chomp | |
end | |
def battery | |
`acpi | cut -d',' -f2`.chomp | |
end | |
def date | |
`date +"%A %B %d, %Y, %r"`.chomp | |
end | |
def inet | |
`ifconfig wlp3s0 | grep inet | head -n 1 | awk '{print $2}'`.chomp | |
end | |
left = Proc.new do | |
workspace | |
end | |
center = Proc.new do | |
date | |
end | |
right = Proc.new do | |
"#{inet} Battery #{battery}%% Volume #{volume}%%" | |
end | |
period = 0.25 | |
### Config End | |
trap("SIGINT") { exit 0 } # Allow ctrl-c | |
IO.popen("bar -g #{width}x#{height}+0+0 -F #{fg} -B #{bg} -f #{font}", "r+") do |pipe| | |
loop do | |
pipe.puts "%{l}#{left.call} %{c}#{center.call} %{r}#{right.call}" | |
sleep period | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment