diff --git a/manifests/menubar.pp b/manifests/menubar.pp new file mode 100644 index 0000000..7755ae6 --- /dev/null +++ b/manifests/menubar.pp @@ -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 + } +} diff --git a/manifests/menubar/show_battery_percent.pp b/manifests/menubar/show_battery_percent.pp new file mode 100644 index 0000000..834d819 --- /dev/null +++ b/manifests/menubar/show_battery_percent.pp @@ -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']; + } +} diff --git a/spec/classes/menubar/show_battery_percent_spec.rb b/spec/classes/menubar/show_battery_percent_spec.rb new file mode 100644 index 0000000..887036d --- /dev/null +++ b/spec/classes/menubar/show_battery_percent_spec.rb @@ -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 diff --git a/spec/classes/menubar_spec.rb b/spec/classes/menubar_spec.rb new file mode 100644 index 0000000..3c951c5 --- /dev/null +++ b/spec/classes/menubar_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe 'osx::menubar' do + it do + should contain_exec('killall SystemUIServer').with( {:refreshonly => true} ) + end +end