# $Id$ # control_input_keymap $serial control_input_keymap() { local serial="${CLASS_ARGV[0]}" push_config_input_keymap "${serial}" } push_config_input_keymap() { local serial="$1" local value value=$(mysqldo "select keymap from cfg_input where serial='${serial}'") control_client "${serial}" set input.keymap "${value}" } help_idesk_icon() { local serial="${CLASS_ARGV[0]}" control_client "${serial}" 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]" } set_idesk_icon() { local serial="${CLASS_ARGV[0]}" local action="${CLASS_ARGV[1]}" local name="${CLASS_ARGV[2]}" local command="${CLASS_ARGV[3]}" local icon="${CLASS_ARGV[4]}" local filename="${CLASS_ARGV[5]}" local xypos="${CLASS_ARGV[6]}" local widthheight="${CLASS_ARGV[7]}" local default_icon="${CLASS_ARGV[8]}" local xpos local ypos local width local height local id local enabled [[ -z ${action} ]] && help_idesk_icon && return 1 if [[ -n ${xypos} ]] then xpos="${xypos%,*}" ypos="${xypos#*,}" fi if [[ -n ${widthheight} ]] then width="${widthheight%,*}" height="${widthheight#*,}" fi case "${action}" in add) enabled=1 ;; del) enabled=0 ;; *) eecho "Unknown action '${action}'" return 1 ;; esac id=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}' and name='${name}';") if [[ -n ${id} ]] then mysqldo "update cfg_idesk_icon set name='${name}', command='${command}', icon='${icon}', filename='${filename}', xpos='${xpos}', ypos='${ypos}', width='${width}', height='${height}', default_icon='${default_icon}', enabled='${enabled}' where id=${id};" else mysqldo "insert into cfg_idesk_icon(serial, name, command, icon, filename, xpos, ypos, width, height, default_icon, enabled) values('${serial}', '${name}', '${command}', '${icon}', '${filename}', '${xpos}', '${ypos}', '${width}', '${height}', '${default_icon}', '${enabled}');" fi } control_idesk_icon() { local serial="${CLASS_ARGV[0]}" local values local id values=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}';") for id in ${values} do evaluate_table_xml cfg_idesk_icon "where serial='${serial}'" if [[ -z ${cfg_idesk_icon_name} ]] then eecho "Name must not be empty id->'${id}'" continue fi if [[ -z ${cfg_idesk_icon_command} ]] then eecho "Command must not be empty id->'${id}'" continue fi if [[ -z ${cfg_idesk_icon_enabled} ]] then eecho "Enabled must not be empty id->'${id}'" continue fi if [[ ${cfg_idesk_icon_enabled} = 1 ]] then control_client "${serial}" set idesk.icon add "${cfg_idesk_icon_name}" "${cfg_idesk_icon_command}" "${cfg_idesk_icon_icon}" "${cfg_idesk_icon_filename}" "${cfg_idesk_icon_xpos},${cfg_idesk_icon_ypos}" "${cfg_idesk_icon_width},${cfg_idesk_icon_height}" "${cfg_idesk_icon_default_icon}" elif [[ ${cfg_idesk_icon_enabled} = 0 ]] control_client "${serial}" set idesk.icon del "${cfg_idesk_icon_name}" # remove from database too mysqldo "delete from cfg_idesk_icon where id='${id}';" else eecho "unknown enabled value id->'${id}', cfg_idesk_icon_enabled -> '${cfg_idesk_icon_enabled}'" return 1 done }