1

There was a nice command in KDE3 that allowed my to add a program start button to a kicker panel programmatically:

dcop kicker $PANEL addNonKDEAppButton "$PROGRAM_NAME" "$PROGRAM_DESCRIPTION" "$PROGRAM_EXECUTABLE" "$PROGRAM_ICON" "" 0

I wonder if there is something similar for KDE4?

1 Answer 1

0

I could find only a partial solution for the problem. The following script does the job of the KDE3 one-liner, but unfortunately it still requires a user interaction since plasma doesn't support script executions without a graphical user interface. That's very disappointing.

If you know a way to execute plasma scripts directly please answer this question.

#!/bin/bash

E_BADARGS=65
PLASMA_SCRIPT_FILE=/tmp/kdePlasmaScript.js

DESKTOP_FILE="$1"
PROGRAM_NAME="$2"
PROGRAM_DESCRIPTION="$3"
PROGRAM_EXECUTABLE="$4"
PROGRAM_ICON="$5"

if [ $# -ne 5 ]; then
  echo "Usage: `basename $0` <DESKTOP_FILE> <PROGRAM_NAME> <PROGRAM_DESCRIPTION> <PROGRAM_EXECUTABLE> <PROGRAM_ICON>"
  exit $E_BADARGS
fi

echo "[Desktop Entry]
Name=$PROGRAM_NAME
GenericName=$PROGRAM_DESCRIPTION
Exec=$PROGRAM_EXECUTABLE
Icon=$PROGRAM_ICON
Path=
Type=Application
" >"$DESKTOP_FILE"

echo "function addStartButton(quicklaunch, panel) {
  quicklaunch.writeConfig('launchers', quicklaunch.readConfig('launchers', '') + ',$DESKTOP_FILE')
}

var template = loadTemplate('org.kde.plasma-desktop.findWidgets')
template.findWidgets('quicklaunch', addStartButton)
" >"$PLASMA_SCRIPT_FILE"

qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole "$PLASMA_SCRIPT_FILE"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .