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

View File

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