Created
April 17, 2011 11:42
-
-
Save cutalion/923970 to your computer and use it in GitHub Desktop.
Allows add or remove icons to unity panel white-list, so that they can be show on unity panel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'json' | |
def save_settings(settings) | |
`gsettings set com.canonical.Unity.Panel systray-whitelist "#{settings.to_json.gsub('"', "'")}"` | |
end | |
def current_settings | |
settings = `gsettings get com.canonical.Unity.Panel systray-whitelist` | |
JSON.parse(settings.gsub("'", '"')) | |
end | |
command = ARGV.shift | |
case command | |
when 'get' then | |
puts current_settings | |
when 'add' then | |
save_settings(current_settings + ARGV) | |
puts "Current settings:" | |
puts current_settings | |
when 'remove' then | |
save_settings(current_settings - ARGV) | |
puts "Current settings:" | |
puts current_settings | |
else | |
puts "Unknown command. Available commands are: get, add, remove." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment