Sending text selections from android to debian's kdeconnect-1.3.1-1 on an xfce desktop opens an xterm with vim. I see that plugins/share/shareplugin.cpp invokes QDesktopServices::openUrl() on a temp file when kate is not available. How would I tell that to use another app?
When plain text is sent (which isn't a file), it uses kate (to which you can pass data via stdin). When Kate isn't installed (which I assume is the case for your xfce setup) then it will download it into a temp filder. The file will be something like /tmp/kdeconnectd.something, but lack a ".txt" suffix and as such there's no guarantee a "text editor" will open it since it tries to guess from the contents. This can probably be fixed by doing tmpFile.setFileTemplate(QStringLiteral("kdeconnect-XXXXXX.txt")); in the plugin
As Kai mentioned, when Kate isn't found then the default program associated with text/plain is opened (which probably is vim on your system). I've posted https://phabricator.kde.org/D15813 which 1) Uses the default editor even if Kate is available and 2) may improve the MIME type detection with a .txt extension
Hey thanks for the swift reaction! Even without .txt extension, mime type seems to be correctly identified, but it might be a good idea nevertheless. by ways of looking at `sh -xv /usr/bin/xdg-open sample.txt` I figured out it invokes exo-open on xfce, which does have a `exo-preferred-applications` settings dialog but that can only configure WebBrowser, MailReader, FileManager & TerminalEmulator. So I found https://wiki.archlinux.org/index.php/XDG_MIME_Applications#mimeapps.list and from that, solved my issue by creating a `/etc/xdg/mimeapps.list` with [Removed Associations] text/plain=vim.desktop;diffuse.desktop;gvim.desktop;libreoffice-writer.desktop;okularApplication_txt.desktop Text sent to kdeconnect now indeed does open with the appropriate mousepad xfce text editor.. which actually makes me `apt install kate` ; )
Git commit 47749792f32f4500a9efd3e3644309830723db2a by Nicolas Fella. Committed on 08/02/2019 at 23:00. Pushed by nicolasfella into branch 'master'. Respect users prefered text editor for shared text Summary: A user may have Kate installed but another editor set as default for text/plain. Respect that. Also add .txt extension to the temp file name to make mime-type detection easier. Test Plan: Set default text editor to Kate -> Text opens in Kate Set default text editor to Atom -> Text opens in Atom Reviewers: #kde_connect, broulik, apol Reviewed By: #kde_connect, broulik, apol Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D15813 M +1 -1 CMakeLists.txt M +1 -0 plugins/share/CMakeLists.txt M +8 -2 plugins/share/shareplugin.cpp https://invent.kde.org/kde/kdeconnect-kde/commit/47749792f32f4500a9efd3e3644309830723db2a
Git commit 62e2c4c1ea8d51b7c4da6d469677ebe6595c803f by Nicolas Fella. Committed on 13/02/2019 at 17:43. Pushed by nicolasfella into branch 'qmlsettings'. Respect users prefered text editor for shared text Summary: A user may have Kate installed but another editor set as default for text/plain. Respect that. Also add .txt extension to the temp file name to make mime-type detection easier. Test Plan: Set default text editor to Kate -> Text opens in Kate Set default text editor to Atom -> Text opens in Atom Reviewers: #kde_connect, broulik, apol Reviewed By: #kde_connect, broulik, apol Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D15813 M +1 -1 CMakeLists.txt M +1 -0 plugins/share/CMakeLists.txt M +8 -2 plugins/share/shareplugin.cpp https://invent.kde.org/kde/kdeconnect-kde/commit/62e2c4c1ea8d51b7c4da6d469677ebe6595c803f