Есть ли команда DBus для добавления кнопки запуска программы на плазменную панель KDE?

484
Stefan Endrullis

В KDE3 была хорошая команда, которая позволила мне программно добавить кнопку запуска программы на панель кикера:

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

Интересно, есть ли что-то подобное для KDE4?

1

1 ответ на вопрос

0
Stefan Endrullis

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" 

Похожие вопросы