自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。

[Ubuntu] 設定 scratch2 檔案關聯

2016年12月30日 星期五



資料來源:https://scratch.mit.edu/discuss/topic/187916/


1. define .sb2 file's type

sudo vi /usr/share/mime/package/***.xml

*** is new file's name. Set is as you like. ex)scratch2

write text below in the file




<?xml version=“1.0” encoding=“UTF-8”?>

<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info“>

<mime-type type=”application/x-scratch2“>

<comment></comment>

<glob pattern=”*.sb2“/>

</mime-type>

</mime-info>




2. associate .sb2 file with scratch 2 application

Find ”edu.media.mit.scratch2editor.desktop" file under directory of /usr/share/applications/ ,

and add only one line in the last line of that desktop file.

MimeType=application/x-scratch2




3. update
sudo update-desktop-databese
sudo update-mime-database

4. change sb2 file's icon
sudo cp /opt/Scratch\ 2/share/icons/ProjectIcon48.png /usr/share/icons/gnome/scalable/mimetypes/application-x-scratch2.png

(參考:http://wiki.ubuntu.com.cn/UbuntuHelp:AddingMimeTypes)

5. 更新圖示cache
sudo gtk-update-icon-cache  /usr/share/icons/gnome/ -f

4. reboot PC




0 意見:

張貼留言