Aquest article el vaig publicar fa molt temps en el meu antic bloc sobre Xfce, Basat en un altre article publicat al bloc de Xubuntu i els hi deixo novament aquÃ.
El que farem, és crear un buscar de fitxers per a Thunar usant Zenitat. El primer que hem de fer és instal·lar zenity:
$ sudo aptitude install zenity
Després vam obrir un terminal i posem:
$ mkdir ~/.bash-scripts/
D'aquesta manera creem un directori que contindrà l'script que executarà l'acció en si. Ara creem un fitxer anomenat search-for-files endins de la següent manera:
mousepad ~/.bash-scripts/search-for-files
i li peguem això dins:
#! / Bin / bash # search-for-files # change this figuri to suit yourself - I find zenity dies from about 1000 results but YMMV maxresults = 500 # again, change the path to the icon to suit yourself. But who does not like tango? window_icon = "/ usr / share / icons / Tango / Scalable / actions / search.svg" # this script will work for any environment that has bash and zenity, sota the gestor de fitxers is entirely down to you! you can add extra arguments to the string as long as the last argument is the path of the folder you open gestor de fitxers = "Thunar" window_title = "Search for Files" srcPath = "$ *" if! [-D "$ srcPath"]; then cd ~ / srcPath = `zenity --file-selection --directory --title =" $ window_title - Look in folder "--window-icon =" $ window_icon "` fi if [-d "$ srcPath"] ; then fragment = `zenity --entry --title =" $ window_title - Name contains: "--window-icon =" $ window_icon "--text =" motor de strings less than 2 characters are ignored "` if! [$ {# Fragment} -lt 2]; then (fet 10 O = $ IFS IFS = $ '\ n' files = ( `find" $ srcPath "-iname" * $ fragment * "-printf \"% I \ "\ \"% f \ "\ \" % k \ KB \ "\ \"% t \ "\ \"% h \ "\\\ n | head -n $ maxresults`) IFS = $ O trobo 100 selected =` eval zenity --list --title = \ "$ {# files [@]} Files Found - $ window_title \" --window-icon = "$ window_icon" --width = "600" --height = "400" --text = \ "Search results : \ "--print-column = 5 --column \" Type \ "--column \" Name \ "--column \" Size \ "--column \" Dóna't modified \ "--column \" Path \ "$ {files [@]}` if [-e "$ selected"]; then "$ gestor de fitxers" "$ selected"; fi) | zenity --progress --auto-close --pulsate --title = "Searching ..." --window-icon = "$ window_icon" --text = "Searching for \" $ fragment \ "" fi fi exit
i li donem permisos d'execució:
chmod a+x ~/.bash-scripts/search-for-files
Ara fem un backup de el fitxer uca.xml:
$ sudo cp /etc/xdg/Thunar/uca.xml /etc/xdg/Thunar/uca.xml.old
a què li posarem a la fi això:
<action>
<icon>/usr/share/icons/Tango/scalable/actions/search.svg</icon>
<name>Search for Files</name>
<command>bash ~/.bash-scripts/search-for-files %f</command>
<description>Search this folder for files</description>
<patterns>*</patterns>
<directories/>
</action>
Ara el que ens queda és obrir Thunar » Edita » Configura accions personalitzades i creem una de nova. I omplim els següents camps:
A la pestanya BÃ sic:
Nom: Cercador
Descripció: Cercador
comando: bash ~ / .bash-scripts / search-for-files% f
Icona: Seleccionem el que més ens agradi.
Quedant d'aquesta manera:
Ara a la pestanya Condicions d'aparença ho següents camps:
Patró d'arxiu: *
Apareix si la selecció conté: Directori.
I ens queda d'aquesta manera:
ara en Thunar quan obrim el menú amb el clic dret, no surt l'opció de buscar:
I si punxem en ella ens sortirà una finestra on podrem inserir el criteri de cerca:
Quan comencem la recerca veurem alguna cosa com això:
i finalment el resultat de la mateixa:
Si fem doble clic sobre el resultat, se'ns obrirà una finestra de Thunar amb la carpeta on es troba el fitxer. D'aquesta forma li donem molta més potència nostre escriptori Xfce.