barr 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 783dfa03603c5ca7a7411dae9c9bc66ff8286417
4
- data.tar.gz: f7ff629578dbb0d417c5c8b0b87b0ed8997ae740
3
+ metadata.gz: 1325be83970f3c39bd02fb2cbdae88e2ba56fc06
4
+ data.tar.gz: 6f538d8834b692fa2c738429affdc4ceac7d3e77
5
5
  SHA512:
6
- metadata.gz: 0c1b135b858d7390de3518b7545ad98a677787a4f9c4911a3bad13a3eeb162353b03086243837f611fab6361337302f35248d23c7b9efc82f0427212dfd129d2
7
- data.tar.gz: 3a87c77612eb73638820410b83b32073ecea7cddc77d0eda0e59f2f5a3bf9ff9d1246babfe17107af8f82baf66f13b348c7687f350c683507bbee2d0d9224e3f
6
+ metadata.gz: 83c7b0e7b9c402689db78859badc46f9e56af8b94e6df1450479d711ec8c5e7c8dfad064f89c9923e16a66be559ec98e5ff1b3343e71b0b5f7cff3fe2d09c606
7
+ data.tar.gz: 11a34a6d9d699f5b6947eb6f32c1b836e35bf1067e3c458af7d0d619c04c18f2e335c83c1971b620cc8b43360adb9ce837f1446a642991ee247bc03532fa481e
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  *~
11
11
  [#]*[#]
12
12
  .\#*
13
+ .swp
data/README.md CHANGED
@@ -146,6 +146,17 @@ seperate_block = Barr::Blocks::Whoami.new
146
146
 
147
147
  ### Block Specific Configuration
148
148
 
149
+ #### Battery
150
+
151
+ Show battery status.
152
+
153
+ `battery = Barr::Blocks::Battery.new show_remaining: true`
154
+
155
+ | Option | Value | Description | Default |
156
+ | --- | --- | --- | --- |
157
+ | `show_remaining` | bool | Show the remaining battery time | `true` |
158
+
159
+
149
160
  #### Clock
150
161
 
151
162
  Shows the current date and/or time.
@@ -204,6 +215,14 @@ Shows current RAM usage.
204
215
 
205
216
  There are no `Mem` block specific configurable options.
206
217
 
218
+ #### Processes
219
+
220
+ Shows the number of currently active processes on your system.
221
+
222
+ `proc = Barr::Blocks::Processes.new`
223
+
224
+ There are no `Processes` block specific configurable options.
225
+
207
226
  #### Rhythmbox
208
227
 
209
228
  **Requires Rhythmbox and rhythmbox-client**. Shows currently playing artist and/or track, as well as control buttons. Control buttons use FontAwesome.
@@ -2,12 +2,14 @@ require 'barr/version'
2
2
  require 'barr/manager'
3
3
  require 'barr/block'
4
4
 
5
+ require 'barr/blocks/battery'
5
6
  require 'barr/blocks/clock'
6
7
  require 'barr/blocks/cpu'
7
8
  require 'barr/blocks/hdd'
8
9
  require 'barr/blocks/i3'
9
10
  require 'barr/blocks/ip'
10
11
  require 'barr/blocks/mem'
12
+ require 'barr/blocks/processes'
11
13
  require 'barr/blocks/rhythmbox'
12
14
  require 'barr/blocks/temperature'
13
15
  require 'barr/blocks/whoami'
@@ -0,0 +1,31 @@
1
+ require 'barr/block'
2
+
3
+ module Barr
4
+ module Blocks
5
+
6
+ class Battery < Block
7
+ attr_reader :show_remaining
8
+
9
+ def initialize opts={}
10
+ super
11
+ @show_remaining = opts[:show_remaining].nil? ? true : opts[:show_remaining]
12
+ end
13
+
14
+ def update!
15
+ if @show_remaining == true
16
+ @output = battery_remaining
17
+ else
18
+ @output = battery_no_remaining
19
+ end
20
+ end
21
+
22
+ def battery_remaining
23
+ `acpi | cut -d ',' -f 2-3`.chomp
24
+ end
25
+
26
+ def battery_no_remaining
27
+ `acpi | cut -d ',' -f 2`.chomp
28
+ end
29
+ end
30
+ end
31
+ end
@@ -25,6 +25,12 @@ module Barr
25
25
  end
26
26
 
27
27
  @output = @workspaces.join('')
28
+ rescue => e
29
+ if e.message.match(/broken pipe/i)
30
+ @i3 = i3_connection
31
+ else
32
+ raise
33
+ end
28
34
  end
29
35
 
30
36
  def destroy!
@@ -0,0 +1,16 @@
1
+ require 'barr/block'
2
+
3
+ module Barr
4
+ module Blocks
5
+
6
+ class Processes < Block
7
+ def update!
8
+ @output = sys_cmd
9
+ end
10
+
11
+ def sys_cmd
12
+ `ps -e | wc -l`.chomp
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Barr
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Russell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,12 +126,14 @@ files:
126
126
  - exe/barr_i3ipc
127
127
  - lib/barr.rb
128
128
  - lib/barr/block.rb
129
+ - lib/barr/blocks/battery.rb
129
130
  - lib/barr/blocks/clock.rb
130
131
  - lib/barr/blocks/cpu.rb
131
132
  - lib/barr/blocks/hdd.rb
132
133
  - lib/barr/blocks/i3.rb
133
134
  - lib/barr/blocks/ip.rb
134
135
  - lib/barr/blocks/mem.rb
136
+ - lib/barr/blocks/processes.rb
135
137
  - lib/barr/blocks/rhythmbox.rb
136
138
  - lib/barr/blocks/temperature.rb
137
139
  - lib/barr/blocks/whoami.rb