3
# This is a part of the external demo applet for Cairo-Dock
5
# Copyright : (C) 2010 by Nochka85
6
# modified by matttbe for the new API
7
# (based on the demo.py by Fabounet)
8
# E-mail : nochka85@glx-dock.org
11
# This program is free software; you can redistribute it and/or
12
# modify it under the terms of the GNU General Public License
13
# as published by the Free Software Foundation; either version 2
14
# of the License, or (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
20
# http://www.gnu.org/licenses/licenses.html#GPL
22
### This is a part of the external applet demo_bash.py for cairo-dock
24
### Contact : nochka85@glx-dock.org
27
DBUS_NAME="org.cairodock.CairoDock"
28
DBUS_PATH="/org/cairodock/CairoDock"
29
DBUS_INTERFACE="org.cairodock.CairoDock"
31
SCRIPT_NAME=`basename $COMMAND`
32
APP_NAME="`echo $SCRIPT_NAME | cut -f1 -d '.' `"
37
CONF_FILE="/home/$USER/.config/cairo-dock/current_theme/plug-ins/$APP_NAME/$APP_NAME.conf"
39
#############################################################################################################
41
LIGNE=`cat $CONF_FILE | grep "$1"`
42
PARAM="`echo $LIGNE | cut -f2 -d '=' `"
45
#############################################################################################################
46
get_ALL_conf_params() {
48
get_conf_param "demo_text"
51
get_conf_param "demo_truefalse"
52
demo_truefalse="$PARAM"
54
get_conf_param "demo_value"
59
#############################################################################################################
61
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Left clic !"
62
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Left clic !" int32:2
67
#############################################################################################################
68
action_on_middle_click() {
69
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Middle clic !"
70
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Middle clic !" int32:2
75
#############################################################################################################
76
action_on_scroll_icon() {
77
if [ $SCROLL_UP -eq "0" ]; then
78
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Scroll UP !"
79
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Scroll UP!" int32:1
81
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Scroll DOWN !"
82
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Scroll DOWN!" int32:1
88
#############################################################################################################
89
action_on_drop_data() {
90
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> $DROP_DATA has been dropped on applet !"
93
if [ "`echo $DROP_DATA |grep 'file://'`" != "" ]; then # It's a file !
94
DROP_DATA="`echo $DROP_DATA | cut -c 8-`" # we remove 'file://' before the location
95
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"FILE : $DROP_DATA has been dropped on applet !" int32:4
97
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"URL : $DROP_DATA has been dropped on applet !" int32:4 # we keep the 'http://' in the name
103
#############################################################################################################
107
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_text in config is : $demo_text"
108
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_truefalse in config is : $demo_truefalse"
109
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_value in config is : $demo_value"
111
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is started"
112
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"I'm connected to Cairo-Dock !" int32:4
113
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.SetQuickInfo string:"123"
118
#############################################################################################################
120
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is stopped"
125
#############################################################################################################
129
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_text in config is : $demo_text"
130
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_truefalse in config is : $demo_truefalse"
131
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_value in config is : $demo_value"
133
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is reloaded"
134
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Our module is reloaded" int32:2
139
#############################################################################################################
140
action_on_build_menu() {
141
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Build menu !"
142
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.PopulateMenu array:string:"choice 0","choice 1"
147
#############################################################################################################
148
action_on_menu_select() {
149
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Choice $MENU_SELECT has been selected !"
150
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Choice $MENU_SELECT has been selected !" int32:4
155
#############################################################################################################
156
# START ### DO NOT CHANGE THIS SECTION
157
#############################################################################################################
159
if [ "`echo $ACTION |grep 'register_the_applet'`" != "" ]; then
161
elif [ "`echo $ACTION |grep 'action_on_click'`" != "" ]; then
163
elif [ "`echo $ACTION |grep 'action_on_middle_click'`" != "" ]; then
164
action_on_middle_click
165
elif [ "`echo $ACTION |grep 'action_on_scroll_icon'`" != "" ]; then
166
action_on_scroll_icon
167
elif [ "`echo $ACTION |grep 'action_on_drop_data'`" != "" ]; then
169
elif [ "`echo $ACTION |grep 'action_on_init'`" != "" ]; then
171
elif [ "`echo $ACTION |grep 'action_on_stop'`" != "" ]; then
173
elif [ "`echo $ACTION |grep 'action_on_reload'`" != "" ]; then
175
elif [ "`echo $ACTION |grep 'action_on_build_menu'`" != "" ]; then
177
elif [ "`echo $ACTION |grep 'action_on_menu_select'`" != "" ]; then
178
action_on_menu_select