Summary: | dolphin --select opens the URLs instead of selecting them | ||
---|---|---|---|
Product: | [Applications] dolphin | Reporter: | the.betrayer64 |
Component: | general | Assignee: | Dolphin Bug Assignee <dolphin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | arnaud.vergnet, jordan.bucklin, kfm-devel, nate |
Priority: | NOR | ||
Version: | 21.04.0 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/system/dolphin/commit/f190ae1cf8fc1c1bf0d87899a84f796a3e473032 | Version Fixed In: | 21.08 |
Sentry Crash Report: | |||
Attachments: | Screenshot of how it looks |
(In reply to the.betrayer64 from comment #0) > You might ask "why do you even need to launch Dolphin from console"? My > answer is that I'm trying to make a "Reveal in Finder" kind of feature in my > program, so I'm launching it from the following code: > > QProcess proc; > proc.startDetached("dolphin", QStringList() << "--select" << > info.canonicalFilePath()); If you're using KDE Frameworks (specifically, KIO), you can include KIO/OpenFileManagerWindowJob and do: KIO::highlightInFileManager({QUrl(info.canonicalFilePath())}) Does that suffice? I was trying to do a DE agnostic (In reply to Nate Graham from comment #1) > (In reply to the.betrayer64 from comment #0) > > You might ask "why do you even need to launch Dolphin from console"? My > > answer is that I'm trying to make a "Reveal in Finder" kind of feature in my > > program, so I'm launching it from the following code: > > > > QProcess proc; > > proc.startDetached("dolphin", QStringList() << "--select" << > > info.canonicalFilePath()); > If you're using KDE Frameworks (specifically, KIO), you can include > KIO/OpenFileManagerWindowJob and do: > > KIO::highlightInFileManager({QUrl(info.canonicalFilePath())}) > > Does that suffice? This works, thank you so much! But it has a drawback - usually Dolphin, as a really nice app, remembers opened folders in tabs. Once I call "KIO::highlightInFileManager({QUrl(info.canonicalFilePath())})" on closed dolphin - all opened tabs are forgotten. It doesn't bother me personally, but it seems like something fishy. That is not supposed to happen and I specifically added code to prevent it and cannot reproduce the issue. Sounds like a bug. If it's 100% reproducible with default dolphin settings (just in case you forgot you changed something), please file a new bug report. Thanks! It reproduces on my machine: usually it store tabs, but after that call they are clean. I don't remember changing anything in settings about that, and I also might be several days behind the official Archlinux repos, so, if it's something you mended recently - I might not yet have that. I sure can record a video, but not sure if it hepls, is there something I can check in my versions or settings? Also, switching the topic, is that "--select" CLI key is something that have chances to be fixed? Can you file a separate bug about the tab issue? Anyway, can confirm the original bug. Thank you! Sure, i can open another one! Just lemme test on a fresh update This is still happening in KDE neon Unstable Edition. The difference is that the --select command always opens a new instance, so it always opens a new file as an empty folder and opens the related app. As an alternative, I can use the following command to do the same: dbus-send --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"/path/to/file" string:"" It seems this issue specifically occurs when the session is restored from a previous session. If starting a new session, the files/folders are selected properly. A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/251 Git commit f190ae1cf8fc1c1bf0d87899a84f796a3e473032 by Jordan Bucklin. Committed on 01/08/2021 at 22:54. Pushed by ngraham into branch 'release/21.08'. Fix how --select treats files Previously, when passing file URLs with the --select option, Dolphin would open the file in its corresponding application, as well as opening an empty tab in Dolphin as if the file were a directory. This happens specifically when trying to restore a session. This commit prevents Dolphin from opening a file in an application and from opening an empty tab while passing the --select option, and selects the URLs instead. M +5 -1 src/main.cpp https://invent.kde.org/system/dolphin/commit/f190ae1cf8fc1c1bf0d87899a84f796a3e473032 |
Created attachment 138143 [details] Screenshot of how it looks SUMMARY There is a way to start Dolphin from console, for example. There is a key "--select" in dolphin command which is supposed to select file paths that are following that command. Let's say I have a file /home/user/Downloads/picture.jpg If I type in console "dolphin --select /home/user/Downloads/picture.jpg" AND have a running instance of Dolphin everything is going to work just perfect. But if I close all instances of Dolphin on my PC and do the same console launch the same command - then DOlphin is going to open a file as an empty folder, and, also open that file in gwenview You might ask "why do you even need to launch Dolphin from console"? My answer is that I'm trying to make a "Reveal in Finder" kind of feature in my program, so I'm launching it from the following code: QProcess proc; proc.startDetached("dolphin", QStringList() << "--select" << info.canonicalFilePath()); STEPS TO REPRODUCE 1. Close all Dolphin instances 2. Type in console "dolphin --select ~/.bashrc" OBSERVED RESULT Dolphin is going to open .bashrc file as if was an empty folder and also run kate on this file EXPECTED RESULT Dolphin would open home folder and select there .bashrc file if it's visible SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: Archlinux (available in About System) KDE Plasma Version: 5.21.04 KDE Frameworks Version: 5.81.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION