Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ Shows the current date and/or time.
| `${LOAD}` | Current load in % |
| `${TEMP}` | Current temperature |

#### Free Text

Displays a string of text. Useful for creating a set of clickable areas or creating space.

`free = Barr::Blocks::FreeText.new text: 'Hello'`

| Option | Value | Description | Default |
| --- | --- | --- | --- |
| `text` | string | The text to display in the block. Supports Lemonbar syntax | `''` |


#### HDD

Shows selected filesystem's used and free space.
Expand Down
2 changes: 1 addition & 1 deletion examples/time_and_date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@man = Barr::Manager.new

time = Barr::Blocks::Clock.new format: '%H:%M', icon: "\uf017", bgcolor: '#114152', fgcolor: '#DAC1DE', align: :l
date = Barr::Blocks::Clock.new format: '%m of %b %Y', bgcolor: '#570B7A', fgcolor: '#FFFFFF', align: :r, icon: "\uf073"
date = Barr::Blocks::Clock.new format: '%d of %b %Y', bgcolor: '#570B7A', fgcolor: '#FFFFFF', align: :r, icon: "\uf073"

@man.add time
@man.add date
Expand Down
1 change: 1 addition & 0 deletions lib/barr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require 'barr/blocks/clock'
require 'barr/blocks/conky'
require 'barr/blocks/cpu'
require 'barr/blocks/free_text'
require 'barr/blocks/hdd'
require 'barr/blocks/http_grab'
require 'barr/blocks/hue_light'
Expand Down
18 changes: 18 additions & 0 deletions lib/barr/blocks/free_text.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'barr/block'

module Barr
module Blocks
class FreeText < Block
attr_accessor :text

def initialize(opts = {})
super
@text = opts[:text] || ''
end

def update!
@output = @text
end
end
end
end
14 changes: 14 additions & 0 deletions spec/blocks/free_text_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

require 'barr/blocks/free_text'

RSpec.describe Barr::Blocks::FreeText do
describe '#update!' do

it 'sets the text correctly' do
subject.text = 'Text Test'
subject.update!
expect(subject.output).to eq 'Text Test'
end

end
end