Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/daemon/client/include/fluxbox.client.class

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1253 - (hide annotations) (download)
Wed Feb 2 21:18:41 2011 UTC (13 years, 3 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 niro 1248 # $Id$
2    
3     # what does this plugin provide?
4     provide fluxbox
5    
6     # helper
7 niro 1253 helper_rebuild_fluxbox_menu()
8 niro 1248 {
9 niro 1253 local MMINCLUDE
10     local CONFIG
11 niro 1248
12 niro 1253 MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include"
13     CONFIG="${MMINCLUDE}"
14     clearconfig
15    
16     for file in ${MCORE_CONFIG_PATH}/fluxbox/menu/*
17 niro 1248 do
18 niro 1253 addconfig "[include] (${file})"
19 niro 1248 done
20    
21     # rebuild the user menu too atm
22 niro 1253 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 niro 1248
28 niro 1253 # fluxbox menu header
29     clearconfig
30 niro 1248 local ver="$(< /etc/mageversion)"
31 niro 1253 addconfig "[begin] (mCore-${ver} #${MCORE_SERIAL})"
32 niro 1248
33     # add a newline (maybe there is no crlf in the header)
34 niro 1253 addconfig
35 niro 1248
36 niro 1253 # our specific menu include
37     addconfig "[include] (${MMINCLUDE})"
38 niro 1248
39     # fluxbox menu footer
40 niro 1253 addconfig '[nop] (__________)'
41     addconfig '[exec] (Neustarten) {sudo reboot}'
42     addconfig '[exec] (Herunterfahren) {sudo halt}'
43     addconfig '[end]'
44 niro 1248
45     # add a newline (maybe there is no crlf in the footer)
46 niro 1253 addconfig
47 niro 1248 }
48    
49 niro 1253 help_fluxbox_addmenuitem()
50 niro 1248 {
51 niro 1253 mecho "set fluxbox.addmenuitem [name] [exec] [workdir] [icon]"
52 niro 1248 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 niro 1253 # set_fluxbox_addmenuitem $name $exec $workdir $icon
60     set_fluxbox_addmenuitem()
61 niro 1248 {
62     local name="$1"
63     local exec="$2"
64     local workdir="$3"
65     local icon="$4"
66 niro 1253 local CONFIG
67 niro 1248
68 niro 1253 [[ -z ${name} ]] && help_session_addmenuitem && return 1
69     [[ -z ${exec} ]] && help_session_addmenuitem && return 1
70 niro 1248
71 niro 1253 CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"
72     clearconfig
73     addconfig "[exec] (${name}) {${exec}}"
74    
75 niro 1248 # rebuild the menu now
76 niro 1253 helper_rebuild_fluxbox_menu
77 niro 1248 }
78    
79 niro 1253 help_fluxbox_delmenuitem()
80 niro 1248 {
81     mecho "set session.delmenuitem [name]"
82 niro 1253 mecho " Deletes a fluxbox menu entry."
83 niro 1248 mecho " name - menu entry name"
84 niro 1253 mecho " If no [name] given, all entries are deleted."
85 niro 1248 }
86    
87 niro 1253 # set_fluxbox_delmenuitem [$name]
88     set_fluxbox_delmenuitem()
89 niro 1248 {
90     local name="$1"
91    
92 niro 1253 if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]
93 niro 1248 then
94 niro 1253 rm ${MCORE_CONFIG_PATH}/fluxbox/menu/${name}
95 niro 1248 elif [[ -z ${name} ]]
96     then
97     # delete all items
98 niro 1253 rm ${MCORE_CONFIG_PATH}/fluxbox/menu/*
99 niro 1248 fi
100    
101     # rebuild the menu now
102 niro 1253 helper_rebuild_fluxbox_menu
103 niro 1248 }