Annotation of /mcore-src/trunk/mcore-tools/daemon/client/include/fluxbox.client.class
Parent Directory | Revision Log
Revision 1248 -
(hide annotations)
(download)
Wed Feb 2 20:20:24 2011 UTC (13 years, 7 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/include/session.client.class
File size: 2057 byte(s)
Wed Feb 2 20:20:24 2011 UTC (13 years, 7 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/include/session.client.class
File size: 2057 byte(s)
-initial version
1 | niro | 1248 | # $Id$ |
2 | |||
3 | # what does this plugin provide? | ||
4 | provide fluxbox | ||
5 | |||
6 | # helper | ||
7 | helper_session_rebuild_fluxbox_menu() | ||
8 | { | ||
9 | :> ${SETTINGSPATH}/fluxbox/alxmenu | ||
10 | |||
11 | for file in ${SETTINGSPATH}/fluxbox/menu/* | ||
12 | do | ||
13 | echo "[include] (${file})" >> ${SETTINGSPATH}/fluxbox/alxmenu | ||
14 | done | ||
15 | |||
16 | # rebuild the user menu too atm | ||
17 | cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
18 | |||
19 | # now fix it with proper messages :P | ||
20 | local ver="$(< /etc/mageversion)" | ||
21 | sed -i "s:@CHANGEME@:tinyALX-${ver} #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
22 | |||
23 | # add a newline (maybe there is no crlf in the header) | ||
24 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
25 | |||
26 | # our specific include | ||
27 | echo "[include] (${SETTINGSPATH}/fluxbox/alxmenu)" >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
28 | |||
29 | # fluxbox menu footer | ||
30 | cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
31 | |||
32 | # add a newline (maybe there is no crlf in the footer) | ||
33 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
34 | } | ||
35 | |||
36 | help_session_addmenuitem() | ||
37 | { | ||
38 | mecho "set session.addmenuitem [name] [exec] [workdir] [icon]" | ||
39 | mecho " adds a fluxbox menu entry" | ||
40 | mecho " name - menu entry name" | ||
41 | mecho " exec - executable to start" | ||
42 | mecho " workdir - working directory for the executable - optional" | ||
43 | mecho " icon - pixmap icon of the entry - optional" | ||
44 | } | ||
45 | |||
46 | # set_session_addmenuitem $name $exec $workdir $icon | ||
47 | set_session_addmenuitem() | ||
48 | { | ||
49 | local name="$1" | ||
50 | local exec="$2" | ||
51 | local workdir="$3" | ||
52 | local icon="$4" | ||
53 | |||
54 | echo "[exec] (${name}) {${exec}}" > ${SETTINGSPATH}/fluxbox/menu/${name} | ||
55 | |||
56 | # rebuild the menu now | ||
57 | helper_session_rebuild_fluxbox_menu | ||
58 | } | ||
59 | |||
60 | help_session_delmenuitem() | ||
61 | { | ||
62 | mecho "set session.delmenuitem [name]" | ||
63 | mecho " deletes a fluxbox menu entry" | ||
64 | mecho " name - menu entry name" | ||
65 | } | ||
66 | |||
67 | # set_session_delmenuitem [$name] | ||
68 | set_session_delmenuitem() | ||
69 | { | ||
70 | local name="$1" | ||
71 | |||
72 | if [[ -f ${SETTINGSPATH}/fluxbox/menu/${name} ]] | ||
73 | then | ||
74 | rm ${SETTINGSPATH}/fluxbox/menu/${name} | ||
75 | elif [[ -z ${name} ]] | ||
76 | then | ||
77 | # delete all items | ||
78 | rm ${SETTINGSPATH}/fluxbox/menu/* | ||
79 | fi | ||
80 | |||
81 | # rebuild the menu now | ||
82 | helper_session_rebuild_fluxbox_menu | ||
83 | } |