# $Id$ provide idesk basic-icons help_idesk_icon() { mecho "get idesk.icon" mecho " Shows all configured icons." mecho mecho "set idesk.icon [action] [name] [command] [icon] [filename] [x,y] [width,height] [default-icon]" mecho " Adds or deletes an desktop icon." mecho " [actions]:" mecho " add - adds an icon" mecho " del - deletes an icon" mecho " if no [name] given, all desktop icons will be deleted" mecho mecho " name - Name of the icon" mecho " command - command which will be run" mecho " icon - icon pixmap [optional]" mecho " filename - filename of the icon [optional]" mecho " x,y - x,y position of the icon on the desktop [optional]" mecho " width,height - width and height of the icon [optional]" mecho " default-icon - default icon which will be selected if the icon pixmap was not found [optional]" } get_idesk_icon() { ${MCORE_LIBDIR}/idesk-generate-icon-info --print | sed 's:\.@@ICON_INFO_SUFFIX@@::g' } set_idesk_icon() { local action="${CLASS_ARGV[0]}" local name="${CLASS_ARGV[1]}" local command="${CLASS_ARGV[2]}" local icon="${CLASS_ARGV[3]}" local filename="${CLASS_ARGV[4]}" local xypos="${CLASS_ARGV[5]}" local widthheight="${CLASS_ARGV[6]}" local deficon="${CLASS_ARGV[7]}" local i local xpos local ypos local iwidth local iheight [[ -z ${action} ]] && help_idesk_icon && return 1 if [[ -n ${xypos} ]] then xpos="${xypos%,*}" ypos="${xypos#*,}" fi if [[ -n ${widthheight} ]] then iwidth="${widthheight%,*}" iheight="${widthheight#*,}" fi case "${action}" in add) # requires name [[ -z ${name} ]] && help_idesk_icon && return 1 # and session [[ -z ${command} ]] && help_idesk_icon && return 1 # create a desktop icon ${MCORE_LIBDIR}/idesk-generate-icon-info \ --add \ --name "${name}" \ --command "${command}" \ --icon "${icon}" \ --filename "${filename}" \ --xpos "${xpos}" \ --ypos "${ypos}" \ --icon-width "${iwidth}" \ --icon-height "${iheight}" \ --default-icon "${deficon}" ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons ;; del) if [[ -n ${name} ]] then ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}" else for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/idesk-generate-icon-info --print) do # basename name="${i%.*}" ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}" done fi ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons ;; *) help_idesk_icon && return 1 ;; esac }