When tilde/variable expansion is used in krunner, suggested completions are different than if the complete path had been used. Example: I open krunner and type: ~/foobar or $HOME/foobar Where $HOME/foobar is a directory. The result is that a lot of documents are returned in the search dropdown, followed by the Locations area, which has “Go to file:///home/me/foobar”. However, if instead I enter: /home/me/foobar Just the Locations area shows up and it directly says “Open /home/me/foobar”. The biggest problem with this is that if I type “~/foobar” and hit enter, it opens whatever document happens to be at the top of the list, whereas my expected behavior is that it opens the directory, since I specified it exactly. Essentially, since ~/foo and /home/me/foo are the same thing, they should be treated identically. Reproducible: Always Steps to Reproduce: 1. Hit Alt-F2 to open the krunner dialog 2. Enter a valid path to a file in your home directory, using ~ to represent your home directory Actual Results: If the search string matches documents, they are listed first, meaning you have to navigate down to the Locations area to open the file/directory. Expected Results: If a path to an existing file is specified, that is the first entry in the list so hitting enter causes the file to be opened.
Created attachment 96739 [details] Proof of concept patch to partially address the issue With this patch, search entries using a tilde which exist as local files are treated as such rather than as unknown URLs. It doesn't support variable expansion, so it's really just a proof of concept.
Confirmed here on openSUSE Tumbleweed. I agree, the path if it exists should be the first option.
>With this patch, search entries using a tilde which exist as local files are treated as such rather than as unknown URLs. This is fixed already. Variable expansion is more difficult, but I am on it :)
Git commit 736218793abd50d04bf140cc5cd2a8e9292c47f3 by Alexander Lohnau. Committed on 30/12/2020 at 10:43. Pushed by alex into branch 'master'. Expand ENV variables before displaying results Before the variables would get expanded later and consequently go through another code path than file locations. This leads to the text being differently displayed and users getting confused. Also this allows us to check if the file actually exists. FIXED-IN: 5.21 M +8 -14 runners/locations/locationrunner.cpp https://invent.kde.org/plasma/plasma-workspace/commit/736218793abd50d04bf140cc5cd2a8e9292c47f3