如何为给定用户在 Ubuntu MATE 20.04 上设置首选应用程序?

Mar*_*cus 6 mime-type default-programs mate ubuntu-mate

在 Ubuntu MATE 18.04 上,我可以为给定用户添加和设置首选应用程序,如下所示:

# Create an application entry

cat > ~/.local/share/applications/browser.desktop << EOF
[Desktop Entry]
Version=1.0
Name=My Browser
Comment=Browse the World Wide Web
...
EOF

# Replace the entry in the list of preferred applications

sed -i "1clocation:$HOME/.local/share/applications/browser.desktop" ~/.config/mate-menu/applications.list

# Associate the MIME types

xdg-mime default "browser.desktop" "x-scheme-handler/http"
xdg-mime default "browser.desktop" "x-scheme-handler/https"
Run Code Online (Sandbox Code Playgroud)

问题是在 20.04 上,这两个目录不存在。

我看到存在全局文件,但我仍然希望仅针对用户进行更改(因为创建的条目调用仅适用于该用户的文件)。

如果我创建丢失的目录和内容,则没有任何效果。

这可能吗?

小智 0

我知道这已经很旧了,但我遇到了同样的问题并找到了解决方案。至少从 Ubuntu 22.04 开始,您可以为每个用户设置这些,~/.config/mimeapps.list然后将适当的 mime 类型设置为应用程序的桌面文件,该文件应位于/usr/share/applications.

顺便说一句,我通过查看该工具的源代码找出了需要更改哪些mate-default-application-settings: https: //github.com/mate-desktop/mate-control-center/blob/master/capplets/default-applications/ mate-da-capplet.cset_changed第 66-178 行的函数。)