--- alx-src/branches/alxconf-060/functions/config_sessions.sh 2011/08/11 19:50:11 2746 +++ alx-src/branches/alxconf-060/functions/config_sessions.sh 2011/08/11 19:50:58 2747 @@ -195,6 +195,7 @@ { local session_list="$1" local other_menuitem_list="$2" + local plugin_list="$3" local res local xres local yres @@ -307,6 +308,57 @@ y=$((${y} + 80)) done + + for i in ${plugin_list} + do + # abort if empty + [[ -z ${i} ]] && continue + + evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'" + if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]] + then + eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem) + + # abort if name or exec is empty + [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue + [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue + + # new line if x > xres + if [ ${x} -ge ${xres} ] + then + x=50 + y=$((${y} + 80)) + fi + + # new row if y > yres + if [ ${y} -ge ${yres} ] + then + x=$((${x} + 120)) + y=50 + + # re-check x + [ ${x} -ge ${xres} ] && x=50 + fi + + generate_icon \ + --name "${PLUGIN_MENUITEM_NAME}" \ + --command "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ + --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).png" \ + --dest "${dest}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).lnk" \ + --xres "${x}" \ + --yres "${y}" \ + --default-icon "default_item.png" + + y=$((${y} + 80)) + fi + + # unset all variables + unset PLUGIN_MENUITEM_NAME + unset PLUGIN_MENUITEM_EXEC + unset PLUGIN_MENUITEM_PARAM + unset PLUGIN_MENUITEM_WORKDIR + unset PLUGIN_MENUITEM_ICON + done # add shutdown, reboot icons for i in shutdown reboot @@ -387,8 +439,10 @@ # get all session ids from database all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'") - # get all other_menutiem ids from database + # get all other_menuitem ids from database all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'") + # get all plugin ids from database + all_plugin_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'") # get screensaver settings evaluate_table cfg_screensaver @@ -518,13 +572,55 @@ addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}" done + # add plugins + for i in ${all_plugin_ids} + do + evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'" + if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]] + then + eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem) + + # abort if name or exec is empty + [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue + [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue + + # now echo config line for fluxbox-menu + # make it "configureable" :p + if [[ -n ${PLUGIN_MENUITEM_WORKDIR} ]] + then + workdir="--workdir ${PLUGIN_MENUITEM_WORKDIR}" + fi + if [[ -n ${PLUGIN_MENUITEM_ICON} ]] + then + PLUGIN_MENUITEM_ICON="<${PLUGIN_MENUITEM_ICON}>" + fi + + # gen prog startup wrapper + generate_program_sh \ + --name "${PLUGIN_MENUITEM_NAME}" \ + --exec "${PLUGIN_MENUITEM_EXEC}" \ + --param "${PLUGIN_MENUITEM_PARM}" \ + --dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ + "${workdir}" + + addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}" + fi + + # unset all variables + unset PLUGIN_MENUITEM_NAME + unset PLUGIN_MENUITEM_EXEC + unset PLUGIN_MENUITEM_PARAM + unset PLUGIN_MENUITEM_WORKDIR + unset PLUGIN_MENUITEM_ICON + done + # fluxbox menu footer cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu # add a newline (maybe there is no crlf in the footer) addconfig # now it's a good time to generate *all* icons :) - generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" + generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" "${all_plugin_ids}" # fix permissions chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}