我正在使用 KDE Plasma 运行 Kubuntu 20.04。我最近从 Google Chrome 切换到 Brave 浏览器版本(取自brave://settings/help
)1.34.81 Chromium: 97.0.4692.99 (Official Build) (64-bit)
,从勇敢的回购协议。
我已在 KDE 选项中将默认浏览器设置为 Brave。
xdg-open
但是,仍然使用 Chrome 打开 URL。
每当我打开 KDE 默认应用程序设置时,这就是我看到的设置,就好像它无法设置默认值一样,无论我使用“以下应用程序”还是“以下命令”设置:
我尝试过的其他事情:
sensible-browser
并且x-www-browser
都正确打开 Brave,而不是 Chrome。只xdg-open
打开 Chrome。XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default text/html
返回:
Running KDE trader query "text/html" mimetype and "Application" servicetype
google-chrome.desktop
XDG_UTILS_DEBUG_LEVEL=2 xdg-mime default brave-browser.desktop text/html
返回(错误代码0):
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop text/html
Updating /home/adriano/.config/mimeapps.list
XDG_UTILS_DEBUG_LEVEL=2 xdg-settings set default-web-browser brave-browser.desktop
返回(错误代码为 4:根据手册,操作失败):
Running KDE trader query "text/html" mimetype and "Application" servicetype
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop text/html
Updating /home/adriano/.config/mimeapps.list
Running KDE trader query "text/html" mimetype and "Application" servicetype
make_default_kde: No kde runtime detected
make_default_generic google-chrome.desktop text/html
Updating /home/adriano/.config/mimeapps.list
sudo XDG_UTILS_DEBUG_LEVEL=2 xdg-settings set default-web-browser brave-browser.desktop
返回(错误代码为 0):
Checking /root/.config/mimeapps.list
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop text/html
Updating /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop x-scheme-handler/http
Updating /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop x-scheme-handler/https
Updating /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop x-scheme-handler/about
Updating /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
make_default_kde: No kde runtime detected
make_default_generic brave-browser.desktop x-scheme-handler/unknown
Updating /root/.config/mimeapps.list
Checking /root/.config/mimeapps.list
- Chrome 和 Brave 桌面文件都正常。事实上,它们几乎是相同的。这是以下的输出
diff /usr/share/applications/google-chrome.desktop /usr/share/applications/brave-browser.desktop
:
3c3
< Name=Google Chrome
---
> Name=Brave Web Browser
108c108
< Exec=/usr/bin/google-chrome-stable %U
---
> Exec=/usr/bin/brave-browser-stable %U
111c111
< Icon=google-chrome
---
> Icon=brave-browser
114c114
< MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
---
> MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ipfs;x-scheme-handler/ipns;
169c169
< Exec=/usr/bin/google-chrome-stable
---
> Exec=/usr/bin/brave-browser-stable
221c221
< Exec=/usr/bin/google-chrome-stable --incognito
---
> Exec=/usr/bin/brave-browser-stable --incognito
- 这是输出
grep html ~/.config/mimeapps.list
(只列出了brave):
application/xhtml+xml=brave-browser.desktop;brave-browser.desktop;code.desktop;org.kde.kate.desktop;libreoffice-writer.desktop;okularApplication_txt.desktop;vim.desktop;firefox.desktop;
text/html=brave-browser.desktop;code.desktop;firefox.desktop;org.kde.kate.desktop;libreoffice-writer.desktop;rstudio.desktop;okularApplication_txt.desktop;vim.desktop;
application/xhtml+xml=brave-browser.desktop;
text/html=brave-browser.desktop
- 手动编辑
~/.config/mimeapps.list
和/usr/share/applications/defaults.list
/或更新 mime 数据库这里和这里使用 Brave 代替 Chrome 没有任何作用。
为什么我无法将 Brave 设置为默认 xdg-open 浏览器?
在类似的 Arch 机器上,这一切都不会发生,一切都按预期进行。
我认为问题可能出在make_default_kde: No kde runtime detected
消息中,但我不知道如何解决它。
答案1
你的勇敢是从Discover还是从其官方网站安装的?
我遇到了和你一样的问题,我通过从我的机器上删除 Brave(从 Discover 安装)解决了这个问题,之后我使用其网站上的说明安装了 Brave:https://brave.com/linux/。
答案2
最后,解决方案是按照中找到的说明进行操作这个答案。
在手动编辑文件后,为我做到这一点的魔术~/.config/mimeapps.list
是使用kbuildsycoca5
.
这引发了警告:
kf5.kservice.sycoca: Parse error in "/home/adriano/.config/menus/applications-merged/xdg-desktop-menu-dummy.menu" , line 1 , col 1 : "unexpected end of file"
,但浏览器链接现在可以在 Brave 中正确打开。