# $Id$ # what does this plugin provide? provide fluxbox # helper helper_rebuild_fluxbox_menu() { local MMINCLUDE local CONFIG MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include" CONFIG="${MMINCLUDE}" clearconfig for file in ${MCORE_CONFIG_PATH}/fluxbox/menu/* do addconfig "[include] (${file})" done # rebuild the user menu too atm CONFIG="${MCORE_UNPRIV_HOME}/.fluxbox/menu" if [[ ! -d ${MCORE_UNPRIV_HOME}/.fluxbox ]] then install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MCORE_UNPRIV_HOME}/.fluxbox fi # fluxbox menu header clearconfig local ver="$(< /etc/mageversion)" addconfig "[begin] (mCore-${ver} #${MCORE_SERIAL})" # add a newline (maybe there is no crlf in the header) addconfig # our specific menu include addconfig "[include] (${MMINCLUDE})" # fluxbox menu footer addconfig '[nop] (__________)' addconfig '[exec] (Neustarten) {sudo reboot}' addconfig '[exec] (Herunterfahren) {sudo halt}' addconfig '[end]' # add a newline (maybe there is no crlf in the footer) addconfig } help_fluxbox_addmenuitem() { mecho "set fluxbox.addmenuitem [name] [exec] [workdir] [icon]" mecho " adds a fluxbox menu entry" mecho " name - menu entry name" mecho " exec - executable to start" mecho " workdir - working directory for the executable - optional" mecho " icon - pixmap icon of the entry - optional" } # set_fluxbox_addmenuitem $name $exec $workdir $icon set_fluxbox_addmenuitem() { local name="$1" local exec="$2" local workdir="$3" local icon="$4" local CONFIG [[ -z ${name} ]] && help_session_addmenuitem && return 1 [[ -z ${exec} ]] && help_session_addmenuitem && return 1 CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}" clearconfig addconfig "[exec] (${name}) {${exec}}" # rebuild the menu now helper_rebuild_fluxbox_menu } help_fluxbox_delmenuitem() { mecho "set session.delmenuitem [name]" mecho " Deletes a fluxbox menu entry." mecho " name - menu entry name" mecho " If no [name] given, all entries are deleted." } # set_fluxbox_delmenuitem [$name] set_fluxbox_delmenuitem() { local name="$1" if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]] then rm ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} elif [[ -z ${name} ]] then # delete all items rm ${MCORE_CONFIG_PATH}/fluxbox/menu/* fi # rebuild the menu now helper_rebuild_fluxbox_menu }