Magellan Linux

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

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

revision 1254 by niro, Wed Feb 2 21:19:48 2011 UTC revision 2015 by niro, Mon Aug 13 10:05:03 2012 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3    # todo wallpaper?
4    
5  # what does this plugin provide?  # what does this plugin provide?
6  provide fluxbox  provide fluxbox
7    
# Line 10  helper_rebuild_fluxbox_menu() Line 12  helper_rebuild_fluxbox_menu()
12   local CONFIG   local CONFIG
13    
14   MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include"   MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include"
15   CONFIG="${MMINCLUDE}"   CONFIG="${MROOT}/${MMINCLUDE}"
16   clearconfig   clearconfig
17     for file in $(find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu -type f)
  for file in ${MCORE_CONFIG_PATH}/fluxbox/menu/*  
18   do   do
19     [[ ! -z ${MROOT} ]] && file=$(echo ${file} | sed "s:${MROOT}::")
20   addconfig "[include] (${file})"   addconfig "[include] (${file})"
21   done   done
22    
23   # rebuild the user menu too atm   # rebuild the user menu too atm
24   CONFIG="${MCORE_UNPRIV_HOME}/.fluxbox/menu"   CONFIG="${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/menu"
25   if [[ ! -d ${MCORE_UNPRIV_HOME}/.fluxbox ]]   if [[ ! -d ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox ]]
26   then   then
27   install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MCORE_UNPRIV_HOME}/.fluxbox   install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox
28   fi   fi
29    
30   # fluxbox menu header   # fluxbox menu header
31   clearconfig   clearconfig
32   local ver="$(< /etc/mageversion)"   local ver="$(< ${MROOT}/etc/mageversion)"
33   addconfig "[begin] (mCore-${ver}  #${MCORE_SERIAL})"   addconfig "[begin] (mCore-${ver}  #${MCORE_SERIAL})"
34    
35   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
# Line 37  helper_rebuild_fluxbox_menu() Line 39  helper_rebuild_fluxbox_menu()
39   addconfig "[include] (${MMINCLUDE})"   addconfig "[include] (${MMINCLUDE})"
40    
41   # fluxbox menu footer   # fluxbox menu footer
42   addconfig '[nop]  (__________)'   addconfig '[separator]'
43   addconfig '[exec] (Neustarten) {sudo reboot}'   addconfig '[exit] (Abmelden)'
44   addconfig '[exec] (Herunterfahren) {sudo halt}'   addconfig '[exec] (Neustarten) {sudo /sbin/reboot}'
45     addconfig '[exec] (Herunterfahren) {sudo /sbin/halt}'
46   addconfig '[end]'   addconfig '[end]'
47    
48   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
49   addconfig   addconfig
50  }  }
51    
52  help_fluxbox_addmenuitem()  helper_rebuild_fluxbox_autostart()
53  {  {
  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"  
54   local CONFIG   local CONFIG
55    
56   [[ -z ${name} ]] && help_session_addmenuitem && return 1   CONFIG="${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/apps"
  [[ -z ${exec} ]] && help_session_addmenuitem && return 1  
   
  CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"  
57   clearconfig   clearconfig
58   addconfig "[exec] (${name}) {${exec}}"   for file in $(find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/autostart -type f)
59     do
60     addconfig "$(< ${file})"
61     done
62    
63     # add a newline (maybe there is no crlf in the footer)
64     addconfig
65    }
66    
67    help_fluxbox_menuitem()
68    {
69     mecho "get fluxbox.menuitem"
70     mecho " Shows all custom added menuitems of fluxbox."
71     mecho
72     mecho "set fluxbox.menuitem [action] [name] [exec] [workdir] [icon]"
73     mecho " Adds or deletes a fluxbox menu entry."
74     mecho " Actions:"
75     mecho "   add     - adds a menuitem"
76     mecho "   del     - deletes a menuitem"
77     mecho
78     mecho "   name    - menu entry name"
79     mecho "   exec    - executable to start"
80     mecho "   workdir - working directory for the executable - optional"
81     mecho "   icon    - pixmap icon of the entry - optional"
82     mecho
83     mecho " If no [name] given, all entries will be deleted."
84    }
85    
86    # set_fluxbox_menuitem $name $exec $workdir $icon
87    set_fluxbox_menuitem()
88    {
89     local action="$1"
90     local name="$2"
91     local exec="$3"
92     local workdir="$4"
93     local icon="$5"
94     local CONFIG
95    
96     [[ -z ${action} ]] && help_fluxbox_menuitem && return 1
97    
98     case "${action}" in
99     add)
100     [[ -z ${name} ]] && help_fluxbox_menuitem && return 1
101     [[ -z ${exec} ]] && help_fluxbox_menuitem && return 1
102     CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"
103     clearconfig
104     addconfig "[exec] (${name}) {${exec}}"
105     ;;
106     del)
107     if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]
108     then
109     rm ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/"${name}"
110     elif [[ -z ${name} ]]
111     then
112     # delete all items
113     rm ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/*
114     fi
115     ;;
116     *)
117     help_fluxbox_menuitem && return 1
118     ;;
119     esac
120    
121   # rebuild the menu now   # rebuild the menu now
122   helper_rebuild_fluxbox_menu   helper_rebuild_fluxbox_menu
123  }  }
124    
125  help_fluxbox_delmenuitem()  # get_fluxbox_menuitem
126    get_fluxbox_menuitem()
127  {  {
128   mecho "set session.delmenuitem [name]"   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu
  mecho " Deletes a fluxbox menu entry."  
  mecho "  name - menu entry name"  
  mecho " If no [name] given, all entries are deleted."  
129  }  }
130    
131  # set_fluxbox_delmenuitem [$name]  help_fluxbox_theme()
 set_fluxbox_delmenuitem()  
132  {  {
133   local name="$1"   mecho "get fluxbox.theme [method]"
134     mecho " Displays current installed or system-wide available themes."
135     mecho " Methods:"
136     mecho "   system  - shows systemwide available themes"
137     mecho "   current - shows current selected theme"
138     mecho
139     mecho "set fluxbox.theme [theme]"
140     mecho " Sets a default theme for fluxbox."
141    }
142    
143   if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]  set_fluxbox_theme()
144   then  {
145   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/${name}   local theme="$1"
146   elif [[ -z ${name} ]]   local stylesdir="/usr/share/fluxbox/styles"
147    
148     [[ -z ${theme} ]] && help_fluxbox_theme && return 1
149     [[ ! -x $(which fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
150    
151     if [[ -e ${stylesdir}/${theme} ]]
152   then   then
153   # delete all items   x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
154   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/*   else
155     eechoe "Theme '${theme}' does not exist!"
156   fi   fi
157    }
158    
159   # rebuild the menu now  get_fluxbox_theme()
160   helper_rebuild_fluxbox_menu  {
161     local method="$1"
162     local stylesdir="/usr/share/fluxbox/styles"
163     local value
164     local i
165    
166     [[ -z ${method} ]] && help_fluxbox_theme && return 1
167    
168     case "${method}" in
169     system)
170     list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
171     ;;
172    
173     current)
174     value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
175     rvecho "${value}"
176     ;;
177     *) help_fluxbox_theme && return 1 ;;
178     esac
179  }  }

Legend:
Removed from v.1254  
changed lines
  Added in v.2015