From aa43dd1e7dcf73fc4e42a4fafaddf7f762060a38 Mon Sep 17 00:00:00 2001 From: fbt Date: Tue, 27 Sep 2016 10:20:03 +0300 Subject: [PATCH] yaml config ftw --- moltenbar | 5 ++--- rc | 15 --------------- rc.yaml | 1 + 3 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 rc diff --git a/moltenbar b/moltenbar index bb87a29..8c5d589 100755 --- a/moltenbar +++ b/moltenbar @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require 'yaml' +require 'erb' $queue = Queue.new $workers = [] @@ -37,8 +38,6 @@ end $config = YAML.load_file('./rc.yaml') -load './rc' - Dir["./mod/*"].each do |file| load file end @@ -61,6 +60,6 @@ trap("SIGUSR1") { $queue << 1 } IO.popen(lemonbar_cmd, "w") do |pipe| while true do data = $queue.pop - pipe.puts draw() + pipe.puts ERB.new($config['format']).result end end diff --git a/rc b/rc deleted file mode 100644 index 2e0d865..0000000 --- a/rc +++ /dev/null @@ -1,15 +0,0 @@ -# vim: ft=ruby - -def draw() - bg_f = $config['colours']['bg_focused'] - - panel = [ - $panel_data[:bspwm_pager], - "%{r}", - "%{F#{bg_f}}%{F-}%{B#{bg_f}} ", - $panel_data[:date], - " %{B-}" - ] - - return panel.join -end diff --git a/rc.yaml b/rc.yaml index 116b575..1a9abf9 100644 --- a/rc.yaml +++ b/rc.yaml @@ -4,6 +4,7 @@ geometry: '1902x14+9+9' fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*' window_name: 'moltenbar' active_areas: '128' +format: "<%= $panel_data[:bspwm_pager] %>%{r}%{F<%= $config['colours']['bg_focused'] %>}%{F-}%{B<%= $config['colours']['bg_focused'] %>} <%= $panel_data[:date] %> %{B-}" colours: fg: '#f9f9f9' fg_focused: '#f9f9f9'