Mate 必須安裝 caja-actions
才能使用黃金右鍵動作腳本
$ sudo apt-get install caja-actions
caja-actions 動作參數設定介面裡面有範例, 參數過多不舉例.
###################################
基本動作 (Debian/Ubuntu/Arch Linux)
###################################
以管理員權限開啟
$ sudo leafpad /usr/share/file-manager/actions/open-as-root.desktop
[Desktop Entry]
Type=Action
Icon=folder_open
Name=open as root
Name[zh_TW]=以管理員權限開啟
Profiles=profile-zero;
TargetLocation=true
[X-Action-Profile profile-zero]
Exec=sudo caja %f
在此開啟終端機
$ sudo leafpad /usr/share/file-manager/actions/open-terminal-here.desktop
[Desktop Entry]
Type=Action
Icon=utilities-terminal
Name=Open a terminal here
Name[zh_TW]=在此開啟終端機
Profiles=profile-zero;
TargetLocation=true
[X-Action-Profile profile-zero]
Exec=mate-terminal
MimeTypes=inode/directory;
Path=%f
啟動器編輯
sudo leafpad /usr/share/file-manager/actions/launcher-edit.desktop
[Desktop Entry]
Type=Action
Icon=application-x-executable
Name=Open with text editor
Name[zh_TW]=以文字編輯器開啟
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Basenames=*.desktop;
Exec=sudo leafpad %f
Mint-檢查MD5 (Mint專屬)
$ sudo leafpad /usr/share/file-manager/actions/mint-md5sum.desktop
[Desktop Entry]
Type=Action
Icon=gnome-run
Name=Check MD5
Name[zh_TW]=檢查MD5
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Basenames=*.iso;*.ISO;*.nrg;*.NRG;
Exec=mint-md5sum %f
檔案搜尋
$ sudo leafpad /usr/share/file-manager/actions/catfish.desktop
[Desktop Entry]
Type=Action
Icon=gtk-find
Name=Search for Files
Name[zh_TW]=檔案搜尋
Profiles=profile-zero;
TargetLocation=true
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Exec=catfish %f
建立連結(重新載入後連結才會跑出來)
$ sudo leafpad /usr/share/file-manager/actions/create-link.desktop
[Desktop Entry]
Type=Action
Icon=emblem-symbolic-link
Name=Create a Link
Name[zh_TW]=建立連結
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Exec=ln -s %f 'Link to %b'
###################################
掛載映像檔 (Debian/Ubuntu/Arch Linux)
###################################
$ sudo leafpad /usr/share/file-manager/actions/mount-image.desktop
[Desktop Entry]
Type=Action
Icon=media-optical
Name=Mount Image
Name[zh_TW]=掛載映像檔
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Basenames=*.iso;*.ISO;*.nrg;*.NRG;*.squashfs;*.sqfs;*.sfs;
Exec=mount-image %f %b
$ sudo leafpad /usr/bin/mount-image
#!/bin/bash
file=$1
name=$2
case "${1##*.}" in
"iso"|"ISO")
sudo mkdir /run/media
sudo mkdir /run/media/$USER
sudo mkdir /run/media/$USER/$name
sudo mount -o loop $file /run/media/$USER/$name
;;
"nrg"|"NRG")
sudo mkdir /run/media
sudo mkdir /run/media/$USER
sudo mkdir /run/media/$USER/$name
sudo mount -o loop,offset=307200 $file /run/media/$USER/$name
;;
"squashfs"|"sfs"|"sqfs")
sudo mkdir /run/media
sudo mkdir /run/media/$USER
sudo mkdir /run/media/$USER/$name
sudo mount -t squashfs $file /run/media/$USER/$name
;;
esac
賦予權限
$ sudo chmod 755 /usr/bin/mount-image
###################################
initramfs 加解密 (Debian/Ubuntu/Arch Linux)
###################################
$ sudo leafpad /usr/share/file-manager/actions/initrd-unpack.desktop
[Desktop Entry]
Type=Action
Icon=gnome-package
Name=Unpack initrd
Name[zh_TW]=解壓縮 initrd
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Basenames=initrd.img;initrd.gz;initrd.lz;initramfs-linux.img;manjaro.img;archiso.img;
Exec=initrd-unpack %f %b
$ sudo leafpad /usr/share/file-manager/actions/initrd-pack.desktop
[Desktop Entry]
Type=Action
Icon=gnome-package
Name=Rebuild initrd
Name[zh_TW]=重建 initrd
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Basenames=rootfs;
Exec=initrd-pack %b
$ sudo leafpad /usr/bin/initrd-unpack
#!/bin/bash
file=$1
name=$2
ftype=$(file -b $file)
case $ftype in
"XZ"*)
mv $name initrd.xz
xz -d initrd.xz
mkdir rootfs
;;
"LZMA"*)
mv $name initrd.lzma
lzma -d initrd.lzma
mkdir rootfs
;;
"gzip"*)
mv $name initrd.gz
gzip -d initrd.gz
mkdir rootfs
;;
esac
cd rootfs
cpio -i -F ../initrd
rm ../initrd
zenity --title="initramfs utility" --info --text="extract initramfs successfully."
$ sudo leafpad /usr/bin/initrd-pack
#!/bin/bash
name=$1
cd $name
find . | cpio -o --format=newc > ../initrd
cd ../
gzip -c initrd > initrd.gz
rm -rf initrd
rm -rf rootfs
zenity --title="initramfs utility" --info --text="rebuild initramfs successfully."
賦予權限
$ sudo chmod 755 /usr/bin/initrd-unpack
$ sudo chmod 755 /usr/bin/initrd-pack
###################################
DEB加解密 (Debian/Ubuntu)
###################################
DEB解壓縮/打包(修改DEB套件使用)
$ sudo leafpad /usr/share/file-manager/actions/deb-unpack.desktop
[Desktop Entry]
Type=Action
Icon=gnome-mime-application-x-deb
Name=Unpack DEB
Name[zh_TW]=解壓縮DEB
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=application/vnd.debian.binary-package;
Exec=sudo deb-unpack %b
$ sudo leafpad /usr/share/file-manager/actions/deb-pack.desktop
[Desktop Entry]
Type=Action
Icon=softwarecenter-debian
Name=Rebuild DEB
Name[zh_TW]=重建DEB
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Basenames=*.deb.upk;
Exec=sudo deb-pack %b
$ sudo leafpad /usr/bin/deb-unpack
#!/bin/bash
name=$1
dpkg -X $name deb
cd deb
dpkg -e ../$name
cd ../
rm $name
rm deb/DEBIAN/md5sums
mv deb $name".upk"
zenity --title="DEB Utility" --info --text="Extract DEB binary-package Successfully."
$ sudo leafpad /usr/bin/deb-pack
#!/bin/bash
name=$1
debname="${name%.*}"
md5dir="bin lib lin64 opt sbin usr"
cd $name
find $md5dir -type f -exec md5sum {} > DEBIAN/md5sums \;
cd ../
sudo dpkg -b $name $debname
zenity --title="DEB Utility" --info --text="Rebuild DEB binary-package Successfully."
賦予權限
$ sudo chmod 755 /usr/bin/deb-pack
$ sudo chmod 755 /usr/bin/deb-unpack
###################################
DEB解壓縮 (Arch Linux)
###################################
$ sudo leafpad /usr/share/file-manager/actions/deb-unpack.desktop
[Desktop Entry]
Type=Action
Icon=gnome-mime-application-x-deb
Name=Unpack DEB
Name[zh_TW]=解壓縮DEB
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=application/vnd.debian.binary-package;
Exec=sudo deb-unpack %b
$ sudo leafpad /usr/bin/deb-unpack
#!/bin/bash
name=$1
mkdir deb
cd deb
ar p ../$name data.tar.xz | tar Jxvf -
mkdir DEBIAN
cd DEBIAN
ar p ../../$name control.tar.gz | tar -zxvf -
cd ../../
rm $name
mv deb $name".upk"
zenity --title="DEB Utility" --info --text="Extract DEB binary-package Successfully."
賦予權限
$ sudo chmod 755 /usr/bin/deb-unpack
###################################
PKG加解密 (Arch Linux)
###################################
$ sudo leafpad /usr/share/file-manager/actions/pkg-unpack.desktop
[Desktop Entry]
Type=Action
Icon=package-x-generic
Name=Unpack PKG
Name[zh_TW]=解壓縮PKG
Profiles=profile-zero;
[X-Action-Profile profile-zero]
Basenames=*.pkg.tar.xz;
Exec=sudo pkg-unpack %b
$ sudo leafpad /usr/share/file-manager/actions/pkg-pack.desktop
[Desktop Entry]
Type=Action
Icon=package-x-generic
Name=Rebuild PKG
Name[zh_TW]=重建PKG
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Basenames=*.pkg;
Exec=sudo pkg-pack %b
$ sudo leafpad /usr/bin/pkg-unpack
#!/bin/bash
name=$1
filename="${name%.*.*}"
mkdir $filename
cd $filename
tar Jxvf ../$name
rm .MTREE
rm ../$name
zenity --title="PKG Utility" --info --text="Extract PKG binary-package Successfully."
$ sudo leafpad /usr/bin/pkg-pack
#!/bin/bash
name=$1
cd $name
local comp_files=('.PKGINFO')
if [ -e ".INSTALL" ]; then
comp_files+=(".INSTALL")
fi
if [ -e ".BUILDINFO" ]; then
comp_files+=(".BUILDINFO")
fi
LANG=C bsdtar -czf .MTREE --format=mtree \
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
"${comp_files[@]}" *
comp_files+=(".MTREE")
tar Jcvf ../$name.tar.xz "${comp_files[@]}" *
zenity --title="PKG Utility" --info --text="Rebuild PKG binary-package Successfully."
賦予權限
$ sudo chmod 755 /usr/bin/pkg-unpack
$ sudo chmod 755 /usr/bin/pkg-pack
如果不喜歡右鍵蝸牛殼子選單模式
去除蝸牛殼子選單模式
$ mkdir /etc/xdg/caja-actions
$ sudo leafpad /etc/xdg/caja-actions/caja-actions.conf
[runtime]
items-create-root-menu=false