Copy to clipboard and send notification with libnotify


/ Published in: Bash
Save to your folder(s)

This nautilus script was written for Wuala to duplicate the "Copy Public Link" feature from Dropbox.


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. #||||||||||||||||||||||||||||||||
  4. #
  5. # ---- BASH SCRIPT FOR WUALA ----
  6. # ---- DOWNLOAD LINK ----
  7. # __by flexgrip at gmail dot com_
  8. # http://rayaguilar.net/portfolio
  9. #
  10. # predicts the wuala public files link and copies it to the clipboard (paste it with CTRL+v)
  11. # REMEMBER you must enter your username and name of your public folder.
  12. # required packages: (These are in the ubuntu repositories... use apt-get)
  13. # xclip (to copy ip to the clipboard)
  14. # notify-send (to send notifications)
  15.  
  16. uname='flex1grip'
  17. publicfolder='Public'
  18.  
  19.  
  20. # build the url
  21. buildurl='http://content.wuala.com/contents/'$uname'/'$publicfolder'/'$@'?dl=1'
  22.  
  23. if [ -n "$buildurl" ]; then
  24.  
  25. # copy url into clipboard
  26. echo $buildurl | xclip -selection clipboard
  27.  
  28. # echo wuala public link in console
  29. echo "Copied public Wuala link: $buildurl"
  30.  
  31. # confirm successful fetch of ip with notification
  32. notify-send --icon=/usr/share/icons/gnome/32x32/actions/edit-paste.png "Download link copied!" "$buildurl"
  33.  
  34. else
  35.  
  36. # echo wuala public link in console
  37. echo "Error... Wuala link not copied: $buildurl"
  38.  
  39. # confirm successful fetch of ip with notification
  40. notify-send --icon=/usr/share/icons/gnome/32x32/actions/gtk-stop.png "Error! Link was not copied..."
  41.  
  42. fi

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.