Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/daemon/client/include/fluxbox.client.class revision 1257 by niro, Fri Feb 4 19:55:56 2011 UTC mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox.client.class.in revision 2269 by niro, Tue Jan 14 10:34:57 2014 UTC
# Line 5  Line 5 
5  # what does this plugin provide?  # what does this plugin provide?
6  provide fluxbox  provide fluxbox
7    
 # 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  
 }  
   
8  help_fluxbox_menuitem()  help_fluxbox_menuitem()
9  {  {
10   mecho "get fluxbox.menuitem"   mecho "get fluxbox.menuitem"
# Line 70  help_fluxbox_menuitem() Line 27  help_fluxbox_menuitem()
27  # set_fluxbox_menuitem $name $exec $workdir $icon  # set_fluxbox_menuitem $name $exec $workdir $icon
28  set_fluxbox_menuitem()  set_fluxbox_menuitem()
29  {  {
30   local action="$1"   local action="${CLASS_ARGV[0]}"
31   local name="$2"   local name="${CLASS_ARGV[1]}"
32   local exec="$3"   local exec="${CLASS_ARGV[2]}"
33   local workdir="$4"   local workdir="${CLASS_ARGV[3]}"
34   local icon="$5"   local icon="${CLASS_ARGV[4]}"
35   local CONFIG   local CONFIG
36    
37   [[ -z ${action} ]] && help_fluxbox_menuitem && return 1   [[ -z ${action} ]] && help_fluxbox_menuitem && return 1
# Line 83  set_fluxbox_menuitem() Line 40  set_fluxbox_menuitem()
40   add)   add)
41   [[ -z ${name} ]] && help_fluxbox_menuitem && return 1   [[ -z ${name} ]] && help_fluxbox_menuitem && return 1
42   [[ -z ${exec} ]] && help_fluxbox_menuitem && return 1   [[ -z ${exec} ]] && help_fluxbox_menuitem && return 1
43   CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"
44   clearconfig   clearconfig
45   addconfig "[exec] (${name}) {${exec}}"   addconfig "[exec] (${name}) {${exec}}"
46   ;;   ;;
47   del)   del)
48   if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]   if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]
49   then   then
50   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/"${name}"   rm ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/"${name}"
51   elif [[ -z ${name} ]]   elif [[ -z ${name} ]]
52   then   then
53   # delete all items   # delete all items
54   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/*   find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu -type f | xargs --no-run-if-empty rm
55   fi   fi
56   ;;   ;;
57   *)   *)
# Line 103  set_fluxbox_menuitem() Line 60  set_fluxbox_menuitem()
60   esac   esac
61    
62   # rebuild the menu now   # rebuild the menu now
63   helper_rebuild_fluxbox_menu   fluxbox-rebuild-menu
64  }  }
65    
66  # get_fluxbox_menuitem  # get_fluxbox_menuitem
67  get_fluxbox_menuitem()  get_fluxbox_menuitem()
68  {  {
69   local i   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu
  local item  
   
  for i in $(find ${MCORE_CONFIG_PATH}/fluxbox/menu -type f | sort)  
  do  
  item="${item} $(basename ${i})"  
  done  
   
  mecho "${item}"  
70  }  }
71    
72  help_fluxbox_theme()  help_fluxbox_theme()
# Line 134  help_fluxbox_theme() Line 83  help_fluxbox_theme()
83    
84  set_fluxbox_theme()  set_fluxbox_theme()
85  {  {
86   local theme="$1"   local theme="${CLASS_ARGV[0]}"
87   local stylesdir="/usr/share/fluxbox/styles"   local stylesdir="@@DATADIR@@/fluxbox/styles"
88    
89   [[ -z ${theme} ]] && help_fluxbox_theme && return 1   [[ -z ${theme} ]] && help_fluxbox_theme && return 1
90   [[ ! -x $(which fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1   [[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
91    
92   if [[ -e ${stylesdir}/${theme} ]]   if [[ -e ${stylesdir}/${theme} ]]
93   then   then
94   x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"   x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
95   else   else
96   eechoe "Theme '${theme}' does not exist!"   eecho "Theme '${theme}' does not exist!"
97   fi   fi
98  }  }
99    
100  get_fluxbox_theme()  get_fluxbox_theme()
101  {  {
102   local method="$1"   local method="${CLASS_ARGV[0]}"
103   local stylesdir="/usr/share/fluxbox/styles"   local stylesdir="@@DATADIR@@/fluxbox/styles"
104   local value   local value
105   local i   local i
106    
# Line 159  get_fluxbox_theme() Line 108  get_fluxbox_theme()
108    
109   case "${method}" in   case "${method}" in
110   system)   system)
111   for i in $(find ${stylesdir} -mindepth 1 -maxdepth 1 | sort)   list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
  do  
  value="${value} $(basename ${i})"  
  done  
  mecho "${value}"  
112   ;;   ;;
113    
114   current)   current)
115   value=$(grep -i '^session.stylefile' ${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')   value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
116   mecho "${value}"   rvecho "${value}"
117   ;;   ;;
118   *) help_fluxbox_theme && return 1 ;;   *) help_fluxbox_theme && return 1 ;;
119   esac   esac

Legend:
Removed from v.1257  
changed lines
  Added in v.2269