#!/usr/local/bin/python
version = "0.0.3"
#####################################################################
# fluxspace-add-idesk-icon
#
# Converted during build from the .py to an executable script.
# The local python path is inserted (e.g. "#!/usr/bin/python") in
# order to make it self-running and to have the proper process name.
#####################################################################

import sys
import os.path
from fluxspace.ideskutil import *

scriptName = os.path.split(sys.argv[0])[1]

######################################################################
class Helper:
######################################################################
    def Message(self, level, message):
        print '%s' % message
    def Trace(self, message):
        print 'Trace: %s' % message

######################################################################
if __name__ == '__main__':
######################################################################
    if len(sys.argv) != 5:
        print '''
Usage: %s <workspace #> <caption> <command> <icon path>
''' % scriptName
        sys.exit(1)

    workspace = int(sys.argv[1])
    caption   = sys.argv[2]
    command   = sys.argv[3]
    iconPath  = sys.argv[4]
    helper    = Helper()
    desktop   = Desktop(helper, workspace)

    (x, y) = desktop.AddIcon(caption, command, iconPath)
    print 'Icon created for %s at (%d,%d)' % (caption, x, y)
