Programmatically adding plasmoid widgets to the plasma panel?
Stephen Dowdy
sdowdy at ucar.edu
Thu Jun 2 20:02:24 BST 2011
I have hunted around a bit, but not come up with anything i can
run with yet, but want to populate the plasma panel with "standard"
widgets. Below is a shell script i use on KDE3 to allow user to
quickly select some standard widgets to add to 'kicker' panel,
but i'd like the equivalent for KDE4. At least i'd like to know
how to programmatically install a widget similar to what i'm
doing below.
Anyway, 'kwriteconfig' is certainly not a viable tool to manipulate
either KDE3's kicker panel config file, nor the plasma config file
(that one's even more horrific requiring a full parse to figure
out indexes of multi-variant arrays, blah...)
I ran across some cursory ECMAscript docs for plasma, and if that's
the way to go, any example code anybody's got is welcome.
Anyway, any pointers appreciated.
thanks,
--stephen
#!/bin/sh
# Title: kde3-install-kicker-buttons
# Purpose: Install some standard default buttons on the KDE3 kicker panel
# Author: Stephen Dowdy (sdowdy @ ucar.edu)
if ! dcop >/dev/null 2>&1 ; then
echo "This must be run in a KDE3 user session"
exit 1
fi
add_xfreerdp_button() { winserver="$1" windomain="$2"
dcop kicker Panel addNonKDEAppButton \
"XFreeRDP to ${winserver}" \
"XFreeRDP session to Windows terminal server ${winserver}" \
/usr/local/freerdp/bin/xfreerdp samba.png \
"-u \${USER} ${windomain:+-d ${windomain}} -g 90% -x m --plugin cliprdr --plugin rdpdr --data disk:LNXWIN:\${HOME}/tsclient -- ${winserver}" \
true
if [ ! -d ${HOME}/tsclient ]; then
mkdir ${HOME}/tsclient
chmod 700 ${HOME}/tsclient
fi
}
add_xfreerdp_WINSERVER_button() { add_xfreerdp_button WINSERVER WINDOMAIN ;}
add_locklogout_button() {
# Add Lock/Logout button if it doesn't already exist
if ! dcop kicker Panel listApplets | grep -q 'lockout.desktop'; then
echo "Adding Lock/Logout button to Kicker Panel"
dcop kicker Panel insertApplet lockout.desktop $(dcop kicker Panel listApplets | wc -l)
else
echo "NOTICE: Lock/Logout button already installed"
fi
}
add_konsole_button() {
# Add Konsole button if it doesn't already exist
if ! dcop kicker Panel listApplets | grep -q 'Konsole'; then
echo "Adding Lock/Logout button to Kicker Panel"
dcop kicker Panel addServiceButton Konsole
else
echo "NOTICE: Konsole button already installed"
fi
}
add_firefox_button() {
# Add Firefox button if it doesn't already exist (can't really tell easily)
dcop kicker Panel addNonKDEAppButton "Firefox" "Mozilla Firefox Web Browser" "/usr/local/firefox/firefox" /usr/local/firefox/icons/mozicon128.png "" false
}
add_thunderbird_button() {
# Add Thunderbird button if it doesn't already exist (can't really tell easily)
dcop kicker Panel addNonKDEAppButton "Thunderbird" "Mozilla Thunderbird E-mail client" "/usr/local/thunderbird/thunderbird" /usr/local/thunderbird/chrome/icons/default/default256.png "" false
}
for button in \
$(kdialog --geometry 600x400 --title "Jazzing up the KDE3 Kicker Panel" \
--checklist "Select Buttons to add to KDE3 Kicker Panel" \
firefox "Firefox Browser" on \
thunderbird "Thunderbird E-Mail client" on \
xfreerdp_WINSERVER "XFreeRDP session to WINSERVER" off \
konsole "Konsole Terminal Button" on \
locklogout "Lock/Logout Button" on \
| tr -d '"'
)
do
echo "Selected: ${button}"
eval add_${button}_button
done
--
Stephen Dowdy - Systems Administrator - NCAR/RAL
303.497.2869 - sdowdy at ucar.edu - http://www.ral.ucar.edu/~sdowdy/
___________________________________________________
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.
More information about the kde
mailing list