Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #64 from moexmen/jsyeo-show-battery-percent
Browse files Browse the repository at this point in the history
Add osx::menubar::show_battery_percent
  • Loading branch information
jacobbednarz authored Oct 16, 2017
2 parents 27697a8 + f2da0d9 commit 2aa59f8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
13 changes: 13 additions & 0 deletions manifests/menubar.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Internal: Restart the Menubar aka the SystemUIServer when necessary.
#
# Example
#
# boxen::osx_defaults { 'Do a thing':
# # ... other stuff here ...
# notify => Exec['killall SystemUIServer'];
# }
class osx::menubar {
exec { 'killall SystemUIServer':
refreshonly => true
}
}
18 changes: 18 additions & 0 deletions manifests/menubar/show_battery_percent.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Public: Shows battery percentage
#
# Example
#
# include osx::menubar::show_battery_percent
#
class osx::menubar::show_battery_percent {
include osx::menubar

boxen::osx_defaults { 'Shows battery percentage':
domain => 'com.apple.menuextra.battery',
key => 'ShowPercent',
type => 'string',
value => 'YES',
user => $::boxen_user,
notify => Exec['killall SystemUIServer'];
}
}
11 changes: 11 additions & 0 deletions spec/classes/menubar/show_battery_percent_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe 'osx::menubar::show_battery_percent' do
should contain_boxen__osx_defaults('Shows battery percentage').with({
:key => 'ShowPercent',
:domain => 'com.apple.menuextra.battery',
:value => 'YES',
:user => facts[:boxen_user],
:notify => 'Exec[killall SystemUIServer]'
})
end
7 changes: 7 additions & 0 deletions spec/classes/menubar_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe 'osx::menubar' do
it do
should contain_exec('killall SystemUIServer').with( {:refreshonly => true} )
end
end

0 comments on commit 2aa59f8

Please sign in to comment.