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

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

Legend:
Removed from v.1248  
changed lines
  Added in v.2014