Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2404 - (show annotations) (download)
Mon Aug 31 08:57:10 2015 UTC (8 years, 7 months ago) by niro
File size: 2589 byte(s)
-renamed icon position variables from {x,y}res to {x,y}pos
1 # $Id$
2
3 provide idesk basic-icons
4
5 help_idesk_icon()
6 {
7 mecho "get idesk.icon"
8 mecho " Shows all configured icons."
9 mecho
10 mecho "set idesk.icon [action] [name] [command] [icon] [filename] [x,y] [width,height] [default-icon]"
11 mecho " Adds or deletes an desktop icon."
12 mecho " [actions]:"
13 mecho " add - adds an icon"
14 mecho " del - deletes an icon"
15 mecho " if no [name] given, all desktop icons will be deleted"
16 mecho
17 mecho " name - Name of the icon"
18 mecho " command - command which will be run"
19 mecho " icon - icon pixmap [optional]"
20 mecho " filename - filename of the icon [optional]"
21 mecho " x,y - x,y position of the icon on the desktop [optional]"
22 mecho " width,height - width and height of the icon [optional]"
23 mecho " default-icon - default icon which will be selected if the icon pixmap was not found [optional]"
24 }
25
26 get_idesk_icon()
27 {
28 ${MCORE_LIBDIR}/idesk-generate-icon-info --print | sed 's:\.@@ICON_INFO_SUFFIX@@::g'
29 }
30
31 set_idesk_icon()
32 {
33 local action="${CLASS_ARGV[0]}"
34 local name="${CLASS_ARGV[1]}"
35 local command="${CLASS_ARGV[2]}"
36 local icon="${CLASS_ARGV[3]}"
37 local filename="${CLASS_ARGV[4]}"
38 local xypos="${CLASS_ARGV[5]}"
39 local widthheight="${CLASS_ARGV[6]}"
40 local deficon="${CLASS_ARGV[7]}"
41 local i
42 local xpos
43 local ypos
44 local iwidth
45 local iheight
46
47 [[ -z ${action} ]] && help_idesk_icon && return 1
48
49 if [[ -n ${xypos} ]]
50 then
51 xpos="${xypos%,*}"
52 ypos="${xypos#*,}"
53 fi
54
55 if [[ -n ${widthheight} ]]
56 then
57 iwidth="${widthheight%,*}"
58 iheight="${widthheight#*,}"
59 fi
60
61 case "${action}" in
62 add)
63 # requires name
64 [[ -z ${name} ]] && help_idesk_icon && return 1
65 # and session
66 [[ -z ${command} ]] && help_idesk_icon && return 1
67
68 # create a desktop icon
69 ${MCORE_LIBDIR}/idesk-generate-icon-info \
70 --add \
71 --name "${name}" \
72 --command "${command}" \
73 --icon "${icon}" \
74 --filename "${filename}" \
75 --xpos "${xpos}" \
76 --ypos "${ypos}" \
77 --icon-width "${iwidth}" \
78 --icon-height "${iheight}" \
79 --default-icon "${deficon}"
80 ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons
81 ;;
82
83 del)
84 if [[ -n ${name} ]]
85 then
86 ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}"
87 else
88 for i in $(NOCOLORS=true ${MCORE_LIBDIR}/idesk-generate-icon-info --print)
89 do
90 # basename
91 name="${i%.*}"
92 ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}"
93 done
94 fi
95 ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons
96 ;;
97
98 *) help_idesk_icon && return 1 ;;
99 esac
100 }