#!/bin/bash # systray-whitelist # # This program lets you modify the "systray-whitelist" added in Ubuntu 11.04. # Programs that implement a "GTK status icon" won't show up in the tray if # they are not in the whitelist. # # Author: # Pontus Östlund # # Copyright (c) 2011 Pontus Östlund # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . function add { new= ok=1 key=`gsettings get com.canonical.Unity.Panel systray-whitelist` for idx in ${key:1:-1}; do idx=${idx:1:-1} idx=${idx//\'/} if test "$idx" == "$2"; then ok=0 else new="$new'$idx'," fi done if test "$ok" == 1; then new="[$new'$2']" `gsettings set com.canonical.Unity.Panel systray-whitelist "$new"` echo "New whitelist: $new" echo "You need to logout/login for the change to take effect" else echo "The program '$2' is already whitelisted" fi } function remove { new= ok=0 key=`gsettings get com.canonical.Unity.Panel systray-whitelist` for idx in ${key:1:-1}; do idx=${idx:1:-1} idx=${idx//\'/} if test "$idx" == "$2"; then ok=1 else new="$new'$idx'," fi done if test "$ok" == 1; then new="[${new:0:-1}]" `gsettings set com.canonical.Unity.Panel systray-whitelist "$new"` echo "New whitelist: $new" echo "You need to logout/login for the change to take effect" else echo "The program '$2' isn't whitelisted" fi } function show { echo "Systray whitelist:" key=`gsettings get com.canonical.Unity.Panel systray-whitelist` echo "$key" } function show_help { echo "Usage:" echo " $0 [action] [program]" echo echo "[action]:" echo " add Adds [program] to whitelist" echo " remove Removes [program] from whitelist" echo " show Displays the whitelist" echo " help Shows this text" echo } case $1 in "add") add $@ ;; "remove") remove $@ ;; "show") show ;; "help") show_help ;; *) show_help ;; esac