There is something that has rather intrigued me for a wee while .... how is the use of multiple icons achieved for displaying the status of a particular application, in the tray or panel (KDE)?
Is it difficult to achieve?
Where is it set?
In its simplest form let's say I want to show an icon that indicates if something is switched on or off.
It doesn't matter what the 'something' is ... but I have devised an example, given below.
This example toggles on & off some loopback devices of Pulse Audio, to provide a mixer.
The script is simply launching the PA modules when going on and killing them when turning off.
An icon in the panel can be clicked to toggle the mixer on and off.
But .... it would be nice if the icon in the panel could change to indicate which state the mixer is in ... something like a green tinged icon for on and a red tinged one for off ...... you get the idea hopefully.
So the question is, can this be done in a simple manner, or is it more complicated and not really worth the effort for such an application.
BTW ... in the example below, the state of the mixer can be seen on the PA Volume Control Recording tab with "All Streams" selected to display.
*****
PA Mixer .desktop file .... I am using a Veromix icon in this example, and have added a directory under /usr/bin to hold my experimental files.
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=PulseAudio Mixer
GenericName=Toggle Mixer Devices On/Off
Comment=Set up loopback devices for mixing
Exec=/usr/bin/user/PA-Mix.sh
Icon=/usr/share/kde4/apps/plasma/plasmoids/veromix-plasmoid/contents/icons/veromix-plasmoid-128.png
StartupNotify=true
Type=Application
Categories=AudioVideo;Audio;Mixer;GTK;X-MandrivaLinux-Multimedia-Sound;
X-Desktop-File-Install-Version=0.11The PA-Mix.sh script ... told ye it was simple

#!/bin/bash
### This script sets up two loopback virtual devices and a null sink
### which can then be used to mix inputs and record the result.
### It requires a functioning PulseAudio installation and also
### PulseAudio Volume Control to manage the streams.
# License: GPL 2 or later
# Author: clareoldie
# Date: June 1st 2012
set -x
unload-modules () {
### First detect then unload loopback devices
for i in $(pactl list | grep -B 1 'Name: module-loopback' | grep 'Module #' | cut -d '#' -f 2-)
do
pactl unload-module $i
done
### Next detect and unload the Null-Sink device/s
for i in $(pactl list | grep -B 1 'Name: module-null-sink' | grep 'Module #' | cut -d '#' -f 2-)
do
pactl unload-module $i
done
}
load-modules () {
### Load required modules
pactl load-module module-null-sink sink_name=MySink
pactl load-module module-loopback sink=MySink
pactl load-module module-loopback sink=MySink
}
test-modules () {
## If the modules exist 0$?=0 then unload them, else load them.
pactl list | grep -B 1 'Name: module-loopback'
if [ "$?" = "0" ]
then
unload-modules
exit 0
fi
pactl list | grep -B 1 'Name: module-null-sink'
if [ "$?" = "0" ]
then
unload-modules
exit 0
else
load-modules
fi
}
### Main Programme
test-modules
If you have any ideas on this please post ...... thanks
