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 2379 - (show annotations) (download)
Wed Aug 26 11:42:48 2015 UTC (8 years, 8 months ago) by niro
File size: 2485 byte(s)
-remove the dot too
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 xyres="${CLASS_ARGV[5]}"
39 local widthheight="${CLASS_ARGV[6]}"
40 local deficon="${CLASS_ARGV[7]}"
41 local i
42 local xres
43 local yres
44 local iwidth
45 local iheight
46
47 [[ -z ${action} ]] && help_idesk_icon && return 1
48
49 if [[ -n ${xyres} ]]
50 then
51 xres="${xyres%,*}"
52 yres="${xyres#*,}"
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 --xres "${xres}" \
76 --yres "${yres}" \
77 --icon-width "${iwidth}" \
78 --icon-height "${iheight}" \
79 --default-icon "${deficon}"
80 ;;
81
82 del)
83 if [[ -n ${name} ]]
84 then
85 ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}"
86 else
87 for i in $(NOCOLORS=true ${MCORE_LIBDIR}/idesk-generate-icon-info --print)
88 do
89 # basename
90 name="${i%.*}"
91 ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}"
92 done
93 fi
94 ;;
95
96 *) help_idesk_icon && return 1 ;;
97 esac
98 }