#!/bin/bash # ~/.local/share/nemo/actions/iconshare.sh (MagicMint) O1212 # Show Shared Icon on Selected Folders # (ɔ) GPL-2, see /usr/share/common-licenses/GPL-2 MYNAME=`basename "$0" | cut -d'.' -f1` ACTIONS=~/.local/share/nemo/actions # When this script is to install case "$1" in "--install" ) # Take it from the share to the local repository mkdir --parents $ACTIONS # The first file is iconshare.sh LINE=`awk '/^# iconshare.nemo_action/{print NR - 2; exit 0;}' "$0"` head -n$LINE "$0" > $ACTIONS/"$MYNAME".sh # The second file is iconshare.nemo_action awk '/^\[Nemo Action\]/,/^# dirface.nemo_action/' "$0" \ | head -n-2 > $ACTIONS/"$MYNAME".nemo_action # The third file is dirface.nemo_action LINE=`awk '/^# dirface.nemo_action/{print NR - 1; exit 0;}' "$0"` tail -n+$LINE "$0" \ | head -n-2 > $ACTIONS/dirface.nemo_action chmod --quiet u+x $ACTIONS/"$MYNAME".sh if [ -x $ACTIONS/$MYNAME.sh ]; then echo Action iconshare installed else echo Action iconshare could not be installed! fi exit ;; # When the action is called on an image "--face" ) shift MYDIR="`dirname "$*"`" # Check whether the folder has a face already MYFACE="$MYDIR"/.dirface if [ -e "$MYFACE" ]; then if ! zenity --question --title=$MYNAME \ --text="Do you want to overwrite the existing symbol?" \ --ok-label="Yes" --cancel-label="No"; then exit 0 fi fi # Make the image the face of the current folder mv --force "$*" "$MYFACE" ;; # Otherwise process each selected folder *) for dir in "$@"; do # When the folder has no face if ! gvfs-info "$dir"/.dirface >/dev/null; then # Reset its custom icon 'gvfs-set-attribute' "$dir" -t unset 'metadata::custom-icon' continue # When the folder isn’t a remote one elif echo "$dir" | grep -q ^file: ; then # Ask the user what to do if ! zenity --question --title=$MYNAME \ --text="\"`basename "$dir"`\" isn’t a remote folder.\r\r Do you want to change its face all the same?" \ --ok-label="Yes" --cancel-label="No"; then continue fi fi # Set the folder’s icon to its face 'gvfs-set-attribute' "$dir" 'metadata::custom-icon' "$dir"/.dirface done # Refresh Nemo’s display which xdotool && xdotool key F5 ;; esac exit 0 [Nemo Action] # iconshare.nemo_action (MagicMint) O1103 # (ɔ) GPL-2, see /usr/share/common-licenses/GPL-2 # Standard tokens for the Name, Comment (tooltip) and Exec fields: # # %U - insert URI list of selection # %F - insert path list of selection # %P - insert path of parent (current) directory # %f or %N (deprecated) - insert display name of first selected file # %p - insert display name of parent directory # %D - insert device path of file (i.e. /dev/sdb1) Exec= Icon-Name=emblem-shared # Localized names Name=Show Shared Icon on %N Name[en_US]=Show Shared Icon on %N Name[de_DE]=Zeige %N mit dem gemeinsamen Symbol Name[eo]=Montru kunhavigis ikonon sur %N Name[es_ES]=Mostrar el icono compartido sobre %N Name[fr_FR]=Montrer l’icône partagée de %N Name[hu_HU]=%N saját megosztott ikonnal Name[it_IT]=Mostra la icona condivisa sul %N Name[ru_RU]=Показать значок общего на %N # Localized comments which show up in Nemo’s status line Comment=The folder %N will be shown with its own face Comment[en_US]=The folder %N will be shown with its own face Comment[de_DE]=Der Ordner %N bekommt sein eigenes Symbol Comment[eo]=Dosierujo %N montros lia propra vizaĝo Comment[es_ES]=La carpeta %N se muestra con su propio icono Comment[fr_FR]=Le dossier %N aura sa propre icône personnalisée Comment[hu_HU]=A(z) %N mappa a saját megosztott ikonját fogja használni Comment[it_IT]=La cartella %N verrà visualizzato con propria faccia Comment[ru_RU]=Папка будет показано с собственным лицом # What type of selection: # [s]ingle, [m]ultiple, any, notnone, none (background click), or # a number representing how many files must be selected to display. Selection=notnone # What extensions to display on - this is an array, end with a semicolon # Single entry options, ending in a semicolon: # "dir" for directory selection # "none" for no extension. # "nodirs" for any selection, but not including directories. # "any" for any file type, including directories. # Individual specific extensions can be a semicolon-terminated list Extensions=dir; # Dependencies - program executables required for this action to work. # Nemo will search in the path for these program(s) # and not display the action if any are missing. # This is an array, separate entries and terminate with a semicolon. Dependencies=gvfs-set-attribute;gvfs-info; [Nemo Action] # dirface.nemo_action (MagicMint) O1103 # (ɔ) GPL-2, see /usr/share/common-licenses/GPL-2 # Standard tokens for the Name, Comment (tooltip) and Exec fields: # # %U - insert URI list of selection # %F - insert path list of selection # %P - insert path of parent (current) directory # %f or %N (deprecated) - insert display name of first selected file # %p - insert display name of parent directory # %D - insert device path of file (i.e. /dev/sdb1) Exec= Icon-Name=emblem-shared # Localized names Name=Set as Folder Face Name[en_US]=Set as Folder Face Name[de_DE]=Als Ordnersymbol festlegen Name[eo]=Fiksi kiel ikono de la dosierujo Name[es_ES]=Establecer como icono de carpeta Name[fr_FR]=Définir en tant qu’icône du dossier Name[hu_HU]=Beállítás a mappa ikonjaként Name[it_IT]=Imposta come l’icona della cartella Name[ru_RU]=Установить как значок общего # Localized comments which show up in Nemo’s status line Comment=The current folder will have %N as a symbol Comment[en_US]=The current folder will have %N as a symbol Comment[de_DE]=%N wird zum Symbol dieses Ordners Comment[eo]=%N estas la simbolo de ĉi tiu dosierujo Comment[es_ES]=%N convertirá se en el icono de esta carpeta Comment[fr_FR]=L’image %N sera transformée en icône du dossier Comment[hu_HU]=%N lesz a tartalmazó mappa saját ikonja Comment[it_IT]=L’immagine %N sarà trasformato in l’icona della cartella Comment[ru_RU]=%N является символом этой папке # What type of selection: # [s]ingle, [m]ultiple, any, notnone, none (background click), or # a number representing how many files must be selected to display. Selection=s # What extensions to display on - this is an array, end with a semicolon # Single entry options, ending in a semicolon: # "dir" for directory selection # "none" for no extension. # "nodirs" for any selection, but not including directories. # "any" for any file type, including directories. # Individual specific extensions can be a semicolon-terminated list Extensions=jpg;jpeg;jp2;png;svg; # Dependencies - program executables required for this action to work. # Nemo will search in the path for these program(s) # and not display the action if any are missing. # This is an array, separate entries and terminate with a semicolon. Dependencies=gvfs-set-attribute;gvfs-info; # End of script