Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.65 KB | None | 0 0
  1. #!/bin/bash
  2. ##script dlc directory-link-creator## open directory with pcmanfm##pizuxmepis ate gmail point com ,thx to anubisg1 IRC#lxde
  3. ##the .desktop create got the suffix (dlc-)foo.desktop for dissociate from other one
  4. ########################################################################################
  5. #this is the desktop file you can copy to /usr/local/share/applications name it dlc.desktop
  6. #  [Desktop Entry]
  7. #   Name=dlc
  8. #   Comment[fr]=créer un raccourci sur le bureau
  9. #   Comment[us]=create desktop shortcut
  10. #   Exec=dlc
  11. #   Terminal=false
  12. #   Icon=gtk-preferences
  13. #   Categories=Settings;
  14. #   Type=Application
  15. #   OnlyShowIn=LXDE;
  16. ##########################################################
  17. old_IFS=$IFS     # sauvegarde du séparateur de champ  
  18. IFS=$'\n'     # nouveau séparateur de champ
  19.  
  20. DIX() {
  21. cd $HOME
  22.  
  23. if [[ -e .config/user-dirs.dirs ]]; then
  24. . .config/user-dirs.dirs
  25. else
  26. XDG_DESKTOP_DIR="$HOME/Desktop"
  27. fi
  28.  
  29. mkdir -p $XDG_DESKTOP_DIR
  30.  
  31. if [[ $LANG = fr_* ]]; then #####check lang
  32. TXT=$"Choisir un dossier à lier sur votre bureau"
  33. TXT2=$"Ce lien vers ce dossier existe Déjà, choisissez en un autre ou éffacez le depuis votre bureau"
  34. else
  35. TXT=$"Choose a directory to link on your desktop"
  36. TXT2=$"This directory link already exist, please choose another one or delete it from your desktop"
  37. fi
  38.  
  39. name="$(zenity --file-selection \
  40. --directory --title="$TXT")"
  41. if [[ $? -ne 0 ]];then exit; fi;
  42.  
  43. base="$(basename "$name")"
  44. cd  $XDG_DESKTOP_DIR
  45.  
  46. if [[ -e dlc-$base.desktop ]]; then
  47. zenity --warning --text=\
  48. "$TXT2"; cd $HOME ; DIX
  49. else
  50.  
  51. icon=$(zenity --width=100 --entry --title="please choose your icon type" \
  52. --text="default icon is folder but you can choose yourself selecting BROWNSE" --entry-text="folder" \
  53.  BROWNSE folder-open video sound image document applications-office applications-education \
  54. applications-internet applications-mutimedia applications-games applications-graphics \
  55. printer network camera-photo camera-video camera-web computer drive-optical drive-harddisk \
  56. dvd cdrom removable-usb)
  57. fi
  58.  
  59. if [[ $? -ne 0 ]];then exit; fi;
  60.  
  61. if [[ "$icon" = BROWNSE ]]; then
  62. icon=$(zenity --file-selection --filename=/usr/share/icons/ --title="choose manually your icon")
  63. fi
  64.  
  65. if [[ $? -ne 0 ]];then exit; fi;
  66.  
  67. echo "[Desktop Entry]
  68. Comment=pcmanfm link to directory "$name"
  69. Name="$base"
  70. Exec=pcmanfm "$name"
  71. Icon="$icon"
  72. Type=Application
  73. Terminal=false
  74. OnlyShowIn=LXDE;" >>dlc-$base.desktop ;
  75.  
  76. zenity --question --text="link have been created on your desktop, do you want to create another one ?" --window-icon=open-folder
  77.  
  78.  
  79. if [[ $? -ne 0 ]];then exit;
  80. else
  81.  
  82. DIX
  83. fi
  84. }
  85. DIX
  86. IFS=$old_IFS
  87. exit o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement