#!/bin/sh
#
# Usage: op-tkdesk [file ...]
# Opens the specified files by performing the default action of their
# associated TkDesk popup menu (this is the first menu item), or asks
# for a command to execute if no files are given.

if [ $# -gt 0 ]; then
  FILES=
  for f in $@; do
    if [ -z "`echo $f | grep '^[/~]'`" ]; then
      FILES="`pwd`/$f $FILES"
    else
      FILES="$f $FILES"
    fi
  done
  tkdeskclient "cd `pwd`; dsk_open {} `echo $FILES`; cd"
else
  tkdeskclient 'dsk_ask_exec'
fi
