Contents of /mcore-src/trunk/mcore-tools/daemon/client/include/fluxbox.client.class
Parent Directory | Revision Log
Revision 1253 -
(show annotations)
(download)
Wed Feb 2 21:18:41 2011 UTC (13 years, 7 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/include/session.client.class
File size: 2375 byte(s)
Wed Feb 2 21:18:41 2011 UTC (13 years, 7 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/include/session.client.class
File size: 2375 byte(s)
-reworked an renamed all functions to fluxbox, because they are fluxbox-specific
1 | # $Id$ |
2 | |
3 | # what does this plugin provide? |
4 | provide fluxbox |
5 | |
6 | # helper |
7 | helper_rebuild_fluxbox_menu() |
8 | { |
9 | local MMINCLUDE |
10 | local CONFIG |
11 | |
12 | MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include" |
13 | CONFIG="${MMINCLUDE}" |
14 | clearconfig |
15 | |
16 | for file in ${MCORE_CONFIG_PATH}/fluxbox/menu/* |
17 | do |
18 | addconfig "[include] (${file})" |
19 | done |
20 | |
21 | # rebuild the user menu too atm |
22 | CONFIG="${MCORE_UNPRIV_HOME}/.fluxbox/menu" |
23 | if [[ ! -d ${MCORE_UNPRIV_HOME}/.fluxbox ]] |
24 | then |
25 | install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MCORE_UNPRIV_HOME}/.fluxbox |
26 | fi |
27 | |
28 | # fluxbox menu header |
29 | clearconfig |
30 | local ver="$(< /etc/mageversion)" |
31 | addconfig "[begin] (mCore-${ver} #${MCORE_SERIAL})" |
32 | |
33 | # add a newline (maybe there is no crlf in the header) |
34 | addconfig |
35 | |
36 | # our specific menu include |
37 | addconfig "[include] (${MMINCLUDE})" |
38 | |
39 | # fluxbox menu footer |
40 | addconfig '[nop] (__________)' |
41 | addconfig '[exec] (Neustarten) {sudo reboot}' |
42 | addconfig '[exec] (Herunterfahren) {sudo halt}' |
43 | addconfig '[end]' |
44 | |
45 | # add a newline (maybe there is no crlf in the footer) |
46 | addconfig |
47 | } |
48 | |
49 | help_fluxbox_addmenuitem() |
50 | { |
51 | mecho "set fluxbox.addmenuitem [name] [exec] [workdir] [icon]" |
52 | mecho " adds a fluxbox menu entry" |
53 | mecho " name - menu entry name" |
54 | mecho " exec - executable to start" |
55 | mecho " workdir - working directory for the executable - optional" |
56 | mecho " icon - pixmap icon of the entry - optional" |
57 | } |
58 | |
59 | # set_fluxbox_addmenuitem $name $exec $workdir $icon |
60 | set_fluxbox_addmenuitem() |
61 | { |
62 | local name="$1" |
63 | local exec="$2" |
64 | local workdir="$3" |
65 | local icon="$4" |
66 | local CONFIG |
67 | |
68 | [[ -z ${name} ]] && help_session_addmenuitem && return 1 |
69 | [[ -z ${exec} ]] && help_session_addmenuitem && return 1 |
70 | |
71 | CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}" |
72 | clearconfig |
73 | addconfig "[exec] (${name}) {${exec}}" |
74 | |
75 | # rebuild the menu now |
76 | helper_rebuild_fluxbox_menu |
77 | } |
78 | |
79 | help_fluxbox_delmenuitem() |
80 | { |
81 | mecho "set session.delmenuitem [name]" |
82 | mecho " Deletes a fluxbox menu entry." |
83 | mecho " name - menu entry name" |
84 | mecho " If no [name] given, all entries are deleted." |
85 | } |
86 | |
87 | # set_fluxbox_delmenuitem [$name] |
88 | set_fluxbox_delmenuitem() |
89 | { |
90 | local name="$1" |
91 | |
92 | if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]] |
93 | then |
94 | rm ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} |
95 | elif [[ -z ${name} ]] |
96 | then |
97 | # delete all items |
98 | rm ${MCORE_CONFIG_PATH}/fluxbox/menu/* |
99 | fi |
100 | |
101 | # rebuild the menu now |
102 | helper_rebuild_fluxbox_menu |
103 | } |