5

I made a shortcut to my home folder by dragging and dropping it to the panel.

Is there a way that I can drag and drop files to that applet in order to save the file in the folder location?

What I really want is to make a shortcut to one of my Ubuntu One folders, that when I drag and drop a file, selected text or url to that applet, it saved the dropped 'element' in the folder for synchronization purposes.

EDIT

Like the trash can but with a custom selected folder.

1 Answer 1

3

The following script will act according to your desciption. I believe this is not the best approach for this situation, but there is not an applet with the functionality described by you that I know of.

Create a file in your home folder with the following content:

#!/bin/sh

ubuntuone_loc="/home/user/Ubuntu One/"

if [ $# -eq 0 ] ;
then 
  nautilus "$ubuntuone_loc"
else
  (
    i=0
    for file in "$@" ; 
    do
      echo $(($i * 100 / $#))
      i=$(($i+1))
      cp "$file" "$ubuntuone_loc"
    done
    echo 100
  )|zenity --progress --title="Copy files progress" --text="Copying $# files to $ubuntuone_loc..." --auto-close &

  RUNNING=0
  while [ $RUNNING -eq 0 ]
  do
    if [ -z "$(pidof zenity)" ]
    then
      kill $(pidof cp)
      RUNNING=1
    fi
  done

fi

Make sure you replace "/home/user/Ubuntu One" with your ubuntu one folder. Now create a new custom launcher, and fill in "sh /path/to/the/created/file". The new launcher should work with clicking and drag and drop.

I hope this works for you. A custom Ubuntu One applet with this sort of behaviour would be nice.

2
  • 1
    I did this and indeed it's working. The only problem is that it works only for files, no for dropping of links nor selected text. I modified your code for testing and when dropping a selected text or link $# equals 0. I guess one have to do a 'proper' applet using C or python. Any ideas?
    – Cesar
    Oct 21, 2010 at 16:30
  • Well, I must say I think that is a great idea. The problem is that I don't think an applet is the best approach. I personally feel like applets don't fit well in to the desktop. If you want to continue with this idea make sure you let me know.
    – W. Goeman
    Oct 21, 2010 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.