Coder Social home page Coder Social logo

cookbook-desktop's Introduction

Description

LWRP to manage desktop's settings for an user.

There are a lot of user's settings that are managed by a desktop setting system as gconf, gsetting and so. This LWRP let you manage the keys and values for those settings.

Right now it's just supported gconf and gsettings, but I hope that more desktop settings systems be supported in the future. For example, the one used by KDE.

This LWRP born as a need for a project called GECOS which is being developed by the Junta de Andalucía, a local government from the lovely region of Spain: Andalusia.

Requirements

In order to use this LWRP from your cookbook or recipe you need to add this cookbook as a dependency at the metadata.rb file.

After doing that you can do things like:

node['my_cookbook']['users'].each do |username|
  desktop_settings "picture-uri" do
    schema   "org.gnome.desktop.background"
    type     "string"
    value    "/usr/share/background/supecoolbackgroung.jpg"
    user     username
  end
end

Usage

To see how this works and how could be used from another cookbook, let's see some examples.

The LWRP provider by default is gsettings as this is the new kid on the block and the current default system for GNOME and GNOME apps. If you like to set a specific background to an user you could do something like:

Let's say we have a recipe named background with this at the attributes.rb:

defaults['background']['image'] = '/usr/share/background/supecoolbackgroung.jpg'
defaults['background']['user']  = 'joe'

And this inside the recipe:

desktop_settings "picture-uri" do
  schema   "org.gnome.desktop.background"
  type     "string"
  value    node['background']['image']
  user     node['background']['user']
end

But we can use also the gconf provider to set the background is this is the setting system that use our desktop:

desktop_settings '/desktop/gnome/background/picture_filename' do
  type     'string'
  value    node['background']['image']
  user     node['background']['user']
  provider 'desktop_gconf'
end

License and Author

Authors:

Copyright 2011-2012 Junta de Andalucía
Copyright 2012 Juanje Ojeda [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

cookbook-desktop's People

Contributors

juanje avatar sometimesfood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cookbook-desktop's Issues

NoMethodError: undefined method `gsettings' for Chef::Resource::Execute

The gsettings method of the gsettings provider should not be private. Chef::Resource::Execute cannot see private methods:

Generated at Thu Feb 02 15:41:01 +0100 2012
NoMethodError: desktop_settings[gtk-key-theme] (foucault::default line 15) had an error: NoMethodError: undefined method `gsettings' for Chef::Resource::Execute
/usr/lib/ruby/vendor_ruby/chef/resource.rb:147:in `method_missing'
/home/sebastian/src/cookbooks-foucault/desktop/providers/gsettings.rb:14:in `class_from_file'
/usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `instance_eval'
/usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `method_missing'
/home/sebastian/src/cookbooks-foucault/desktop/providers/gsettings.rb:12:in `class_from_file'
/usr/lib/ruby/vendor_ruby/chef/provider.rb:104:in `instance_eval'
/usr/lib/ruby/vendor_ruby/chef/provider.rb:104:in `action_set'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160:in `run'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:192:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:183:in `loop'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:183:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
/usr/bin/chef-solo:24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.