Mat

Mat

想問的問題: xdg 是什麼? 如何變更設定?

xdg-mime query filetype /tmp/zim-live/print-to-browser.html
xdg-open http://www.google.com
xdg-open /tmp/zim-live/print-to-browser.html

yan : xdg 應該是像 windows 設定預設開啟檔案的程式

// 查詢此檔案的 mime type
$ xdg-mime query filetype index.html
text/html

// 設定此檔案類型的開啟程式, 
// 如下設定 firefox 為預設開啟 html 的程式, firefox.desktop 不用指定完整檔案路徑, 他會依序在以下資料夾找尋是否有此檔案
    /home/yan/.local/share/applications/firefox.desktop
    /usr/local/share/applications/firefox.desktop
    /usr/share/applications/firefox.desktop
// 可以 trace /usr/bin/xdg-open 的 open_generic_xdg_mime()
$ xdg-mime default firefox.desktop text/html  

$ cat ~/.local/share/applications/defaults.list

$ xdg-open index.html