Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2404 - (hide annotations) (download)
Mon Aug 31 08:57:10 2015 UTC (8 years, 8 months ago) by niro
File size: 2589 byte(s)
-renamed icon position variables from {x,y}res to {x,y}pos
1 niro 2041 # $Id$
2    
3     provide idesk basic-icons
4    
5 niro 2375 help_idesk_icon()
6 niro 2041 {
7 niro 2375 mecho "get idesk.icon"
8     mecho " Shows all configured icons."
9     mecho
10 niro 2376 mecho "set idesk.icon [action] [name] [command] [icon] [filename] [x,y] [width,height] [default-icon]"
11 niro 2375 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 niro 2379 ${MCORE_LIBDIR}/idesk-generate-icon-info --print | sed 's:\.@@ICON_INFO_SUFFIX@@::g'
29 niro 2375 }
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 niro 2404 local xypos="${CLASS_ARGV[5]}"
39 niro 2375 local widthheight="${CLASS_ARGV[6]}"
40     local deficon="${CLASS_ARGV[7]}"
41     local i
42 niro 2404 local xpos
43     local ypos
44 niro 2041 local iwidth
45     local iheight
46    
47 niro 2375 [[ -z ${action} ]] && help_idesk_icon && return 1
48 niro 2041
49 niro 2404 if [[ -n ${xypos} ]]
50 niro 2041 then
51 niro 2404 xpos="${xypos%,*}"
52     ypos="${xypos#*,}"
53 niro 2041 fi
54    
55 niro 2375 if [[ -n ${widthheight} ]]
56 niro 2041 then
57 niro 2375 iwidth="${widthheight%,*}"
58     iheight="${widthheight#*,}"
59 niro 2041 fi
60    
61 niro 2375 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 niro 2041
68 niro 2375 # 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 niro 2404 --xpos "${xpos}" \
76     --ypos "${ypos}" \
77 niro 2375 --icon-width "${iwidth}" \
78     --icon-height "${iheight}" \
79     --default-icon "${deficon}"
80 niro 2380 ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons
81 niro 2375 ;;
82 niro 2041
83 niro 2375 del)
84     if [[ -n ${name} ]]
85 niro 2041 then
86 niro 2375 ${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 niro 2041 fi
95 niro 2380 ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons
96 niro 2375 ;;
97 niro 2041
98 niro 2375 *) help_idesk_icon && return 1 ;;
99     esac
100 niro 2041 }