colours yo

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2019-05-15 14:50:52 +03:00
parent 8544bb8cd4
commit 6c714c12df
2 changed files with 10 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class BspwmPager < Worker
if state[:monitors].count > 1 or @my_config['show_single_monitor']
if m[:focused]
out << "%{B#{@config['colours']['mon_focused']}} #{m_name} %{B-}"
out << "%{BC{mon_focused}} #{m_name} %{B-}"
else
out << " #{m_name} "
end
@ -61,7 +61,7 @@ class BspwmPager < Worker
end
if d[:focused]
out << "%{B#{@config['colours']['bg_focused']}} #{d_name} %{B-}"
out << "%{BC{bg_focused}} #{d_name} %{B-}"
elsif d[:urgent]
out << "%{A:bspc desktop -f #{d_name}:}%{R} #{d_name} %{R}%{A}"
elsif d[:occupied]

View File

@ -84,17 +84,21 @@ end
class Panel
attr_accessor :modData
def initialize(template)
def initialize(config)
@modData = {}
@template = template
@config = config
end
def render
panel = @template
panel = @config["format"]
@modData.each do |modName, modData|
panel = panel.gsub(/@{#{modName}}/, modData)
end
@config["colours"].each do |colName, colValue|
panel = panel.gsub(/C{#{colName}}/, colValue)
end
return panel
end
end
@ -186,7 +190,7 @@ lemonbar_cmd = [
printf("Launching lemonbar as:\n %s\n", lemonbar_cmd.join(" "))
p = Panel.new(config['format'])
p = Panel.new(config)
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true