Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ##script dlc directory-link-creator## open directory with pcmanfm##pizuxmepis ate gmail point com ,thx to anubisg1 IRC#lxde
- ##the .desktop create got the suffix (dlc-)foo.desktop for dissociate from other one
- ########################################################################################
- #this is the desktop file you can copy to /usr/local/share/applications name it dlc.desktop
- # [Desktop Entry]
- # Name=dlc
- # Comment[fr]=créer un raccourci sur le bureau
- # Comment[us]=create desktop shortcut
- # Exec=dlc
- # Terminal=false
- # Icon=gtk-preferences
- # Categories=Settings;
- # Type=Application
- # OnlyShowIn=LXDE;
- ##########################################################
- old_IFS=$IFS # sauvegarde du séparateur de champ
- IFS=$'\n' # nouveau séparateur de champ
- DIX() {
- cd $HOME
- if [[ -e .config/user-dirs.dirs ]]; then
- . .config/user-dirs.dirs
- else
- XDG_DESKTOP_DIR="$HOME/Desktop"
- fi
- mkdir -p $XDG_DESKTOP_DIR
- if [[ $LANG = fr_* ]]; then #####check lang
- TXT=$"Choisir un dossier à lier sur votre bureau"
- TXT2=$"Ce lien vers ce dossier existe Déjà, choisissez en un autre ou éffacez le depuis votre bureau"
- else
- TXT=$"Choose a directory to link on your desktop"
- TXT2=$"This directory link already exist, please choose another one or delete it from your desktop"
- fi
- name="$(zenity --file-selection \
- --directory --title="$TXT")"
- if [[ $? -ne 0 ]];then exit; fi;
- base="$(basename "$name")"
- cd $XDG_DESKTOP_DIR
- if [[ -e dlc-$base.desktop ]]; then
- zenity --warning --text=\
- "$TXT2"; cd $HOME ; DIX
- else
- icon=$(zenity --width=100 --entry --title="please choose your icon type" \
- --text="default icon is folder but you can choose yourself selecting BROWNSE" --entry-text="folder" \
- BROWNSE folder-open video sound image document applications-office applications-education \
- applications-internet applications-mutimedia applications-games applications-graphics \
- printer network camera-photo camera-video camera-web computer drive-optical drive-harddisk \
- dvd cdrom removable-usb)
- fi
- if [[ $? -ne 0 ]];then exit; fi;
- if [[ "$icon" = BROWNSE ]]; then
- icon=$(zenity --file-selection --filename=/usr/share/icons/ --title="choose manually your icon")
- fi
- if [[ $? -ne 0 ]];then exit; fi;
- echo "[Desktop Entry]
- Comment=pcmanfm link to directory "$name"
- Name="$base"
- Exec=pcmanfm "$name"
- Icon="$icon"
- Type=Application
- Terminal=false
- OnlyShowIn=LXDE;" >>dlc-$base.desktop ;
- zenity --question --text="link have been created on your desktop, do you want to create another one ?" --window-icon=open-folder
- if [[ $? -ne 0 ]];then exit;
- else
- DIX
- fi
- }
- DIX
- IFS=$old_IFS
- exit o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement