Mostrando entradas con la etiqueta Nautilus. Mostrar todas las entradas
Mostrando entradas con la etiqueta Nautilus. Mostrar todas las entradas

Script Nautilus DropBox Shared

d
Autor: Kalpa
Descripción: Script que nos permite compartir directamente un archivo a nuestra carpeta de DropBox. Para hacer uso de el lo copiamos en .gnome2/nautilus-scripts y se da los permisos respectivos.

#!/bin/sh
#
# W.H. Kalpa Pathum 
# 1st June, 2010
#

# Dropbox directory
DROPBOX_DIR="$HOME/Dropbox/"

# creates a temporary file
file_list=$(mktemp)

# writes the URIs of the selected file to the temp file
echo $NAUTILUS_SCRIPT_SELECTED_URIS | sed 's/ \//\n/g' > $file_list

# iterete through the file list
for file in $(cat $file_list)
  do
 # extract the last filed from the URI, that is the file name
    filename="$(echo $file | awk -F'/' '{print $NF}' | sed 's/%20/ /g')"
    
    # creates the symbolic link
    ln -s "$(pwd)/$filename" "$DROPBOX_DIR$filename"
    
    # sets the emblem
    gvfs-set-attribute -t stringv "$filename" metadata::emblems default
    done

exit 0
Leer más...

[Nautilus Script] - Compilador C y C++

d
Nombre: Compilador.sh Autor:Leogtzr Descripción : Script que integra en Nautilus un lanzador para poder compilar archivos c y c++
#!/bin/bash

case ${1#*.}
in
 c)
  GCC=`which gcc`
  $GCC "$1" -o "${1%%.*}" && {
   Xdialog --msgbox "Archivo compilado correctamente: \n${1%%.*}" 10 50
   exit 0;
  } || {
   Xdialog --msgbox "Compilación fallida" 10 30
   exit 1; 
  }
  ;;
 cpp)
  GPP=`which g++`
  $GPP "$1" -o "${1%%.*}" && {
   Xdialog --msgbox "Archivo compilado correctamente: \n${1%%.*}" 10 50
   exit 0;
  } || {
   Xdialog --msgbox "Compilación fallida" 10 30
   exit 1; 
  }

  ;;
 *)
  echo -e "Error, código fuente no C ó C++";
  exit 1;
esac




Instalación

Dar permisos de escritura

chmod +x ./Compilar.sh

Copiar en el directorio nautilus-scripts

~/.gnome2/nautilus-scripts
Leer más...

[Nautilus Script]Compresion de Imagen

d
Nautilus script: Compress image
Descripción:  Reduce la calidad de imagen de archivos.
Autor: soleilpqd[at]gmail[dot]com
Licencia: GNU GPL

INSTALACION 

Copiar en la carpeta

~/.gnome2/nautilus-scripts

Dar permisos de ejecucion y listo!

#!/bin/bash


function doCompress() {
 if [ $overwritable -eq 1 ] && [ ! -e "_compressed" ]; then
  mkdir "_compressed"
  if [ ! $? -eq 0 ]; then
   zenity --error --title="Compress image" --text="Can not create destination folder"
   exit 1
  fi
 fi
 failedCount=0
 tmp=$IFS
 IFS=$'\n'
 for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
  s=$( identify -format "%m" "$f" )
  if [ "$s" == "JPEG" ]; then
   if [ $overwritable -eq 1 ]; then
    dest="_compressed/$( basename "$f" )"
   else
    dest=$f
   fi
   echo "Proccessing $f"
   convert "$f" -quality $ratio "$dest"
   if [ ! $? -eq 0 ]; then
    let failedCount++
   fi
  else
   let failedCount++
  fi
 done
 IFS=$tmp
 if [ $failedCount -eq 0 ]; then
  zenity --info --title="Compress image" --text="All files was compressed successfully"
 else
  zenity --warning --title="Compress image" --text="There were $failedCount files failed"
 fi
}

# checking input file & get 1 file to preview simple
imgAvailable=0
tmp=$IFS
IFS=$'\n'
for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
 s=$( identify -format "%m" "$f" )
 if [ "$s" == "JPEG" ]; then
  imgAvailable=1
  previewFile=$f
  break
 fi
done
IFS=$tmp

if [ $imgAvailable -eq 0 ]; then
 zenity --error --title="Compress images" --text="Please select JPEG file(s)"
 exit 1
fi

zenity --question --title="Compress images" --text="Overwrite the original file?"
overwritable=$?
zenity --question --title="Compress images" --text="Preview?"
previewable=$?
stopable=0
ratio=90
while [ $stopable -eq 0 ]; do
 # Ask for compress ratio
 ratio=$( zenity --scale --title="Compress images ratio" --text="High number make high quality image but big file size" --min-value=1 --max-value=100 --value=$ratio )

 if [ $? -eq 0 ]; then
  if [ $previewable -eq 0 ]; then
   previewedFile=$( echo "/tmp/$( basename "$previewFile" )")
   if [ -e "$previewedFile" ]; then
    rm "$previewedFile"
   fi
   convert "$previewFile" -quality $ratio "$previewedFile" | zenity --progress --title="Making preview..." --auto-close --no-cancel --pulsate
   gvfs-open "$previewedFile"
   zenity --question --title="Agree with ratio $ratio?" --text="Origin: $( du -h "$previewFile" ). Result: $( du -h "$previewedFile" )."
   if [ $? -eq 0 ]; then
    doCompress | zenity --progress --title="Compressing..." --auto-close --no-cancel --pulsate
    stopable=1
   fi
   rm "$previewedFile"
  else
   doCompress | zenity --progress --title="Compressing..." --auto-close --no-cancel --pulsate
   stopable=1
  fi
 else
  stopable=1
 fi
done
Leer más...