barabara 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fc704ae054747cbedd0ddd81d1306b8fbb0f430839f80aaafda64cdf29225cd
4
- data.tar.gz: 4357e8b018f5b770808f31b35747e30586289295e2b7834b39438608631a6103
3
+ metadata.gz: 7a5a8677921fc942822f26bce8282a47153496ab564969fb27609454ecba6fab
4
+ data.tar.gz: 36facf5e163322d9fb0b6325f3a2296b3bb104117e9e8bff2eebc8ebeabd81b7
5
5
  SHA512:
6
- metadata.gz: 1ea2f0049b07c412363316266425db72818b56e5fbd3aa122a1006eae248ecbbaf51432964a2c8bc2920117900d610d3d92c1525137906ee1417ce7d591bad25
7
- data.tar.gz: 5159919bf03b2314c5f8ae990a177dcd55b3ff84667de3db2a4446c6d2cbfb30a077fdd16088398bbb0c8818c043877086eb399b8fe7e3e5e429d87a1004032d
6
+ metadata.gz: e37e4b9dc3b5939398c475c7e97182d8b6be50561ecfd26bdaab1afc480ae2360753a2367caf98304307aaab940858f6a05e4079bec8557ff3252d1dfe243bf9
7
+ data.tar.gz: 242704e57c26b2e802905f7a4c4e5af036e185c7de7dfec38c7b618a4e691a127b355642a3f885c4a968727fbd129f9a7cfb2958b3c86f4853c5cc3279fa6040
@@ -64,8 +64,8 @@ module Barabara
64
64
  name: "barabara", height: 12,
65
65
  format: "%%{S%<monitor>s}%%{l}%<tags>s%<sep>s %%{c} %<window_title>s %%{r} %<volume>s %<battery>s %<sep>s %<time>s %<sep>s %<weather>s\n",
66
66
  fonts: {
67
- text: "-lucy-tewi-medium-*-normal-*-11-*-*-*-*-*-*-*",
68
- glyphs: "-wuncon-siji-medium-r-normal-*-10-100-75-75-c-80-iso10646-1"
67
+ text: { name: "-lucy-tewi-medium-*-normal-*-11-*-*-*-*-*-*-*", offset: 0 },
68
+ glyphs: { name: "-wuncon-siji-medium-r-normal-*-10-100-75-75-c-80-iso10646-1", offset: 0 }
69
69
  },
70
70
  snippets: { sep: "%%{B-}%%{F%<ac_winbr>s}|%%{F-}" },
71
71
  extra_opts: ["| sh"]
@@ -34,12 +34,11 @@ module Barabara
34
34
  cmd_opts = [
35
35
  "-B '#{@colors[:in_framebr]}'",
36
36
  "-F '#{@colors[:ac_text]}'",
37
- "-g x#{options[:height]}+0+0",
38
- "-n #{options[:name]}", '-a 30',
39
- "-f #{options[:fonts][:text]}",
40
- "-f #{options[:fonts][:glyphs]}"
37
+ "-g 'x#{options[:height]}+0+0'",
38
+ "-n '#{options[:name]}'", '-a 30'
41
39
  ]
42
- cmd_opts << options[:extra_opts] if options.key?(:extra_opts)
40
+ cmd_opts.concat font_opts(options[:fonts])
41
+ cmd_opts.concat options[:extra_opts] if options.key?(:extra_opts)
43
42
  cmd_opts
44
43
  end
45
44
 
@@ -64,7 +63,7 @@ module Barabara
64
63
  monitor: monitor
65
64
  ))
66
65
  end
67
- string
66
+ string.delete "\n"
68
67
  end
69
68
 
70
69
  def render
@@ -75,6 +74,20 @@ module Barabara
75
74
  @panel_data.merge!(data)
76
75
  render
77
76
  end
77
+
78
+ private
79
+
80
+ def font_opts(fonts = {})
81
+ fonts.flat_map do |type, font_def|
82
+ if font_def.is_a? String
83
+ ["-f '#{font_def}'"]
84
+ elsif font_def.key? :offset
85
+ ["-o '#{font_def[:offset]}'", "-f '#{font_def[:name]}'"]
86
+ else
87
+ ["-f '#{font_def[:name]}'"]
88
+ end
89
+ end
90
+ end
78
91
  end
79
92
  end
80
93
  end
@@ -1,3 +1,3 @@
1
1
  module Barabara
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barabara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serge Tkatchouk