Skip to content

Instantly share code, notes, and snippets.

@JeremyOttley
Created December 4, 2017 02:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyOttley/609f09a8953650c0d8f7ccd928041b48 to your computer and use it in GitHub Desktop.
Save JeremyOttley/609f09a8953650c0d8f7ccd928041b48 to your computer and use it in GitHub Desktop.
LemonBoy's Bar Ruby Config for BSPWM
### 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