Thursday, June 5, 2008

增加Ubuntu的好用度-Nautilus Script

GNOME桌面有提供一個好用的右鍵選單指令稿(Nautilus Script)



安裝Script的方式如下
1. 開啟/home/your account/.gnome2/nautilus-scripts目錄,如果看不到這個目錄,就在檔案總管的"顯示->顯示隱藏檔",就可以看到了(注意!是"."gnome2,有個".")
2. 將script檔案放在此目錄中
3. 將script檔案的可執行權限打開

介紹幾個好用的Script
1. 掛載ISO檔,將下列指令存成script檔(純文字檔案即可),可掛載中文的ISO檔

**掛載script
------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
# mount

gksudo -k /bin/echo "got r00t?"

BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`

sudo mkdir "/media/$BASENAME"

zenity --info --title "ISO Mounter" --text "$BASENAME e $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"


if sudo mount -o loop,iocharset=utf8 -t iso9660 $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS "/media/$BASENAME"
then
if zenity --question --title "ISO Mounter" --text "$BASENAME Successfully Mounted. Open Volume?"

then
nautilus /media/"$BASENAME" --no-desktop
fi

exit 0
else
sudo rmdir "/media/$BASENAME"

zenity --error --title "ISO Mounter" --text "Cannot mount $BASENAME!"

exit 1
fi
----------------------------------------------------------------------------------------------------------------
**卸載
----------------------------------------------------------------------------------------------------------------
#!/bin/bash
# unmount

gksudo -k /bin/echo "got r00t?"

BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`

sudo umount "/media/$BASENAME"

sudo rmdir "/media/$BASENAME"

zenity --info --text "Successfully unmounted /media/$BASENAME"

exit 0
----------------------------------------------------------------------------------------------------------------

2.打開以Root登入的檔案總管
http://www.gnome-look.org/content/show.php/Open+Nautilus+as+Root?content=73610

修改script中****,改為你的root密碼
echo "****" | sudo -S nautilus /home

3.將檔案傳送至隨身碟或外接硬碟
http://www.gnome-look.org/content/show.php/Send+to...?content=67627

4.改變影像檔的尺寸
http://www.gnome-look.org/content/show.php/NScripts+Ultimate?content=68599
其中的這兩個script
Scale Image
Scale Image To Sizes

5.跟影像處理相關的script,可以快速旋轉圖片等
http://www.gnome-look.org/content/show.php/Script+for+Image?content=68754
搭配第4項的script就很完整了

6.由所在的目錄啟動終端機
http://wiki.ubuntu.org.cn/UbuntuHelp:NautilusScriptsHowto/SampleScripts#Open_terminal_here

7.將目錄或檔案在桌面建立連結(Windows中的捷徑)
http://www.gnome-look.org/content/show.php/Send+link+to+Desktop?content=73253
記得要先修改檔案中下面這一行
desk='desktop' 改成 desk='Desktop'

8. 很多好用的功能
http://www.gnome-look.org/content/show.php/NScripts+Ultimate?content=68599

功能列表如下
Gedit Root
ISO Mount
ISO unMount
Naudilus #Convert audio files
Open Terminal Here
Play in XMMS #Select a folder and play it in XMMS
Rootilus #root nautilus in the current dir.
Scale Image
Scale Image To Sizes
Search Here
Set image as Wallpaper
Video Converter

No comments: