Bug 467978

Summary: --select fails when dolphin already displays home directory
Product: [Applications] dolphin Reporter: glyphimor
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kfm-devel
Priority: NOR    
Version: 22.08.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description glyphimor 2023-03-30 16:35:25 UTC
SUMMARY

Normally, running "dolphin --select file1"  displays file1's parent directory and selects file1, in a new or existing dolphin window/tab. However, if a dolphin window is already displaying the user's home directory, running "dolphin --select file1" doesn't work: the existing ~ window receives focus, but nothing else happens. Note that adding the --new-window argument bypasses the bug: "dolphin --select file1 --new-window" works.

STEPS TO REPRODUCE

I have command line tests for 6 scenarios; 4 work and 2 fail. All dolphin windows need to be closed before each test. I included a sleep command so each test can be copy-pasted, rather than run line by line.

#setup
mkdir dolphin_test
cd dolphin_test
touch file1
mkdir dir0

#test 0 works: no dolphin windows
dolphin --select file1

#test 1 works: test dir already open in dolphin
dolphin . &
sleep 3s
dolphin --select file1

#test 2 works: other dir already open in dolphin
dolphin dir0 &
sleep 3s
dolphin --select file1

#test 3 fails: ~ already open in dolphin
dolphin ~ &
sleep 3s
dolphin --select file1

#test 4 works: ~ and test dir already open in dolphin
dolphin ~ . &
sleep 3s
dolphin --select file1

#test 5 fails: ~ and other dir already open in dolphin
dolphin ~ dir0 &
sleep 3s
dolphin --select file1

OBSERVED RESULT

(for a failing test) The dolphin window/tab displaying the user's home directory receives focus.

EXPECTED RESULT

Dolphin displays the dolphin_test directory and selects file1.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

Summarizing, if ~ is already open in a dolphin window/tab, "dolphin --select file1" doesn't work, UNLESS file1's parent directory is already open in dolphin.

Also, all tests work correctly if you add the --new-window argument: "dolphin --select file1 --new-window".

The trigger for failure appears to be the user's home directory, even if a different directory is set as the dolphin default (in Settings -> Configure Dolphin... -> Startup -> Show on startup).

--select used to work normally for me; this bug appeared perhaps a year ago.

To briefly explain a use case for --select: I have an application w/ a "view directory in file browser"-type feature to allow the user to easily rename/move/etc a file. The --select feature is quite helpful, especially when there are a large number of files in the directory. The --new-window argument does work, but can be somewhat annoying if you end up running --select multiple times, especially for files in the same directory.