123 |
local iheight |
local iheight |
124 |
local deficon |
local deficon |
125 |
local CONFIG |
local CONFIG |
126 |
|
local utility |
127 |
|
|
128 |
# very basic getops |
# very basic getops |
129 |
for i in $* |
for i in $* |
143 |
done |
done |
144 |
|
|
145 |
# some sanity checks: |
# some sanity checks: |
146 |
|
|
147 |
# abort if name or command not given |
# abort if name or command not given |
148 |
[[ -z ${name} ]] && return 1 |
[[ -z ${name} ]] && return 1 |
149 |
[[ -z ${command} ]] && return 1 |
[[ -z ${command} ]] && return 1 |
150 |
|
|
151 |
|
# which utility are we using idesk|xtdesk ? |
152 |
|
if [ -x /usr/bin/idesk ] |
153 |
|
then |
154 |
|
utility="idesk" |
155 |
|
[[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk" |
156 |
|
else |
157 |
|
utility="xtdesk" |
158 |
|
[[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk" |
159 |
|
fi |
160 |
|
|
161 |
# use some defaults for icon, dest, {x,y}res |
# use some defaults for icon, dest, {x,y}res |
162 |
[[ -z ${xres} ]] && xres=30 |
[[ -z ${xres} ]] && xres=30 |
163 |
[[ -z ${yres} ]] && xres=30 |
[[ -z ${yres} ]] && xres=30 |
|
[[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk" |
|
164 |
if [[ -z ${icon} ]] || [ ! -f ${icon} ] |
if [[ -z ${icon} ]] || [ ! -f ${icon} ] |
165 |
then |
then |
166 |
# if no default icon is given use default.png |
# if no default icon is given use default.png |
172 |
clearconfig |
clearconfig |
173 |
|
|
174 |
addconfig 'table Icon' |
addconfig 'table Icon' |
175 |
addconfig ' Type: Program' |
[[ ${utility} = xtdesk ]] && addconfig ' Type: Program' |
176 |
addconfig " Caption: ${name}" |
addconfig " Caption: ${name}" |
177 |
addconfig " Command: ${command}" |
addconfig " Command: ${command}" |
178 |
addconfig " Icon: ${icon}" |
addconfig " Icon: ${icon}" |
182 |
# add these only if not zero |
# add these only if not zero |
183 |
if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]] |
if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]] |
184 |
then |
then |
185 |
addconfig " IconWidth: ${iwidth}" |
if [[ ${utility} = xtdesk ]] |
186 |
addconfig " IconHeight: ${iheight}" |
then |
187 |
|
addconfig " IconWidth: ${iwidth}" |
188 |
|
addconfig " IconHeight: ${iheight}" |
189 |
|
fi |
190 |
|
if [[ ${utility} = idesk ]] |
191 |
|
then |
192 |
|
addconfig " Width: ${iwidth}" |
193 |
|
addconfig " Height: ${iheight}" |
194 |
|
fi |
195 |
fi |
fi |
196 |
|
|
197 |
addconfig 'end' |
addconfig 'end' |
209 |
local i |
local i |
210 |
local name |
local name |
211 |
local progsh_path |
local progsh_path |
212 |
|
local utility |
213 |
|
local dest |
214 |
|
local rc |
215 |
|
|
216 |
|
# which utility are we using idesk|xtdesk ? |
217 |
|
if [ -x /usr/bin/idesk ] |
218 |
|
then |
219 |
|
utility="idesk" |
220 |
|
dest="${ALX_UNPRIV_HOME}/.idesktop" |
221 |
|
rc="${ALX_UNPRIV_HOME}/.ideskrc" |
222 |
|
else |
223 |
|
utility="xtdesk" |
224 |
|
dest="${ALX_UNPRIV_HOME}/.xtdesktop" |
225 |
|
rc="${ALX_UNPRIV_HOME}/.xtdeskrc" |
226 |
|
fi |
227 |
|
|
228 |
|
|
229 |
# progsh path |
# progsh path |
230 |
progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
234 |
|
|
235 |
# split res to x & y |
# split res to x & y |
236 |
xres="${res%x*}" |
xres="${res%x*}" |
237 |
xres="${res#*x}" |
yres="${res#*x}" |
238 |
|
|
239 |
# top left edge of the icon is given in config file |
# top left edge of the icon is given in config file |
240 |
# remove a little bit to simulate the bottom-right edge |
# remove a little bit to simulate the bottom-right edge |
241 |
xres="$(( ${xres} - 120 ))" |
xres="$(( ${xres} - 120 ))" |
242 |
yres="$(( ${yres} - 80 ))" |
yres="$(( ${yres} - 80 ))" |
243 |
|
|
|
# basic config |
|
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
|
|
|
|
244 |
# clean desktop icon location |
# clean desktop icon location |
245 |
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
[ -d ${dest} ] && rm -rf ${dest} |
246 |
install -d ${ALX_UNPRIV_HOME}/.xtdesktop |
[ -f ${rc} ] && rm -f ${rc} |
247 |
|
install -d ${dest} |
248 |
|
|
249 |
|
if [[ ${utility} = xtdesk ]] |
250 |
|
then |
251 |
|
# basic config |
252 |
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdesktop/xtdeskrc |
253 |
|
fi |
254 |
|
|
255 |
# default settings |
# default settings |
256 |
declare -i x=30 |
declare -i x=30 |
283 |
fi |
fi |
284 |
|
|
285 |
generate_icon \ |
generate_icon \ |
286 |
--name "${cfg_session_session}" \ |
--name "${cfg_sessions_session}" \ |
287 |
--command "nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_session_filename})" \ |
--command "nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})" \ |
288 |
--icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_session_session}).png" \ |
--icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_sessions_session}).png" \ |
289 |
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/$(fix_whitespaces ${cfg_session_session}).lnk" \ |
--dest "${dest}/$(fix_whitespaces ${cfg_sessions_session}).lnk" \ |
290 |
--xres "${x}" \ |
--xres "${x}" \ |
291 |
--yres "${y}" |
--yres "${y}" |
292 |
|
|
320 |
|
|
321 |
generate_icon \ |
generate_icon \ |
322 |
--name "${cfg_other_menuitems_name}" \ |
--name "${cfg_other_menuitems_name}" \ |
323 |
--command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_exec})" \ |
--command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
324 |
--icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \ |
--icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \ |
325 |
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \ |
--dest "${dest}/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \ |
326 |
--xres "${x}" \ |
--xres "${x}" \ |
327 |
--yres "${y}" \ |
--yres "${y}" \ |
328 |
--default-icon "default_item.png" |
--default-icon "default_item.png" |
352 |
--name "${sysinfo}" \ |
--name "${sysinfo}" \ |
353 |
--command "exit 0" \ |
--command "exit 0" \ |
354 |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
355 |
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ |
--dest "${dest}/sysinfo.lnk" \ |
356 |
--xres "${xres}" \ |
--xres "${xres}" \ |
357 |
--yres "${yres}" \ |
--yres "${yres}" \ |
358 |
--icon-width "1" \ |
--icon-width "1" \ |
408 |
# add autostart session |
# add autostart session |
409 |
if [[ ! -z ${cfg_autostart_session} ]] |
if [[ ! -z ${cfg_autostart_session} ]] |
410 |
then |
then |
411 |
addconfig "[startup] {nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
# sleep one second to wait until busybox is fully initialized and the screen is really centered |
412 |
|
addconfig "[startup] {sleep 1 && nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
413 |
fi |
fi |
414 |
|
|
415 |
# fluxbox hotkeys |
# fluxbox hotkeys |