As a user of KDE Konsole, Dolphin, and Flatpak, I need this. First, use Konsole to open a folder in Dolphin. Second, Konsole automatically returns to its command line. Third, close Konsole. Fourth, Dolphin remains open.
The challenge is only with steps 2 above. Specifically, after Konsole successfully open the folder in Dolphin, somehow Konsole does not return to its command line. In turn, I can not run the exit command to close Konsole. Which is my needed end result.
My needed end result is to add the flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> command, or equivalent command, into a bash script (.sh). Which automatically runs multiples commands one after the other. One of those command is to open a folder in Dolphin.
After the bash script is created, this is how I use it:
Using Dolphin, right-click on the bash script .sh file. For example: my-bash-script.sh
The number 2 in this screenshot show this.
Still using Dolphin, from the menu I expended above, select the option Launch in Konsole / Lancer dans Konsole
The bash script runs in Konsole. Including all the commands in the script.
After all the commands are ran, Konsole either returns to its command prompt or Konsole automatically closes itself. Either way would be success for me and meet my needs.
Details and screenshot about this challenge are into the steps to reproduce below.
Below is the same as above. But with details for those interested.
Using Konsole, run this command to open a folder in Dolphin flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER>"
Konsole does three things:
Konsole successfully open the above folder in Dolphin. Joy
Konsole returned those three errors. Which I ignored.
kf.solid.backends.fstab: Failed to acquire watch file descriptor Trop de fichiers ouverts
kf.config.core: Watching absolute paths is not supported "/usr/share/color-schemes/BreezeDark.colors"
"applications.menu" not found in QList()
kf.solid.backends.fstab: Failed to acquire watch file descriptor Trop de fichiers ouverts
Note. In those error messages above, the “Trop de fichiers ouverts” is in French. It means “Too many folders opened”. Before running the command above, I do not have any folder open in either Dolphin or Nautilus.
After opening Dolphin above, Konsole does not automatically return to its command line. This is the challenge. By “not automatically return” I mean that after Konsole displayed the three error messages up above and aftre Konsole successfully open the folder in Dolphin. Somehow, Konsole does not automatically return to its command line. In other words, I can’t enter the next command. The number 1 in this screenshot shows the location of this challenge. Where the white square is blinking endlessly. But does not return to the command line. In other words, I can not automatically run the next command. The keywords here is “automatically”.
My needed end result is this, using Konsole, automatically run this command to exit Konsole: exit
* Note: I can not automatically run this exit command because, as you know, in the step above, somehow Konsole does not return to its command line. What you see in the screenshot above is what I see from my end. If I type in exit and press return key. Nothing happens. exit is not event display in Konsole.
What I tried that did not work
Read the manual from --help-all
Search Konsole documentation
Add an “/dev/null” suffix command. For example : flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> </dev/null &>/dev/null &
Add an ampersand “&” suffix to each command. For example : run flatpak run org.kde.dolphin &
Add an “nohup” prefix command. For example : nohup flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> &
Add “disown” command. For example : flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> & disown
Add --new-window parameter to the command in Konsole: flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER>"
Using Flatseal allow konsole only permission to GNOME X11. Not GNOME Wayland.
GNOME Terminal and Nautilus
GNOME Terminal and GNOME Nautilus are able to do this. But somehow, I have not yet found a way to do the same using KDE Konsole and Dolphin. My preference would be to use both Konsole and Dolphin. Not Terminal and Nautilus.
Steps with GNOME Terminal and GNOME Nautilus :
Using GNOME Terminal execute this command : nautilus -w "/<PATH TO FOLDER>"
Terminal does three things:
Open the folder in Nautilus.
Display this message: Message: <NUMBER>: Connecting to org.freedesktop.Tracker3.Miner.Files
Automatically close Terminal. But Nautilus remains open. This is what I need. The keywords is “automatically”.
What I do not need
A graphical user interface (GUI). Because I need a command. Details are into the bash script steps up above.
Symlink. Because:
I need the original and full path to the folder. Not a Symlink path.
I need the original folder to open only once. Not multiple times. Same for files.
Using Konsole, using the keyboard, press Ctrl+C to cancel the command in progress. Then, return to the Konsole command line. I do not need this. Because after the folder is open, I need Konsole to automatically return to its command line. Details about this is into the steps to reproduce above. Anyhow, if using Konsole I press Ctrl+C keys, Dolphin also closes. After Konsole launched Dolphin, I need Dolphin to remain open. Whatever happens in Konsole.
Using Konsole, how to open a folder in Dolphin, then, automatically, Konsole returns to its command line?
This is my thought about it with no flatpaks in mind as I don’t use them.
dolphin <path> &
Back to konsole hit Enter , you are back to command prompt and dolphin remains open, that’s & for.
Apart from that there are so many alternative methods, like holding Ctrl and clicking on a directory which opens it automatically as a folder in dolphin, to name one.
Thanks for your reply @ngraham I tried this. But it failed. Same challenge. Konsole successfully open the folder in Dolphin. But somehow, Konsole does not return to its command line.
Steps I did:
Using Konsole, execute this command below. With the suffix &. flatpak run org.kde.dolphin "/<PATH TO FOLDER>" &
Konsole successfully open the folder in Dolphin. But Konsole does not immediately return me to its command prompt. The number 1 in this screenshot below shows this challenge.
As you know, my needed end result is return to the command prompt. In my case the needed end result is the Konsole command prompt line would starts with this prefix <USERNAME>@<DEVISE IS>:~$
Thanks for your reply @lubareac I tried this. But it does not meet my need. Because I need a command. Not a graphical user interface (GUI). My understanding is that, Dolphin’s terminal is a GUI only not a command. Yes it is great and useful. But it is not a command.
My needed end result is to add the flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> command, or equivalent command, into a bash script (.sh) file. Which automatically runs multiples commands one after the other. One of those command is to open a folder in Dolphin.
After the bash script is created, this is how I use it:
Using Dolphin, right-click on the bash script .sh file. For example: my-bash-script.sh
Still using Dolphin, from the menu I expended above, select the option Launch in Konsole
The bash script runs in Konsole. Including all the commands in the script.
After all the commands are ran, Konsole either returns to its command prompt or Konsole automatically closes itself. Either way would be success for me and meet my needs.
Just now I clarified my needed end result in my original post. By adding this new information.
Thanks @rockandstone I tried this. It works within Konsole. But, somehow, this same command failed within a bash script. Because the folder did not open in Dolphin. And Konsole remains open and did not return to its prompt. My needed end result is to run this command from a bash script.
By needed end result I mean this. Add the flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> command, or equivalent command, into a bash script (.sh). Which automatically runs multiples commands one after the other. One of those command is to open a folder in Dolphin.
This is the content of the bash script file I tested
#!/bin/sh
flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER>" & -- ; exit
After the bash script is created, this is how I use it:
Using Dolphin, right-click on the bash script .sh file. For example: my-bash-script.sh
Still using Dolphin, from the menu I expended above, select the option Launch in Konsole
The bash script runs in Konsole. Including all the commands in the script.
After all the commands are ran, Konsole either returns to its command prompt or Konsole automatically closes itself. Either way would be success for me and meet my needs.
It is weird that the ampersand does not send the command into the background, I wonder if it is somehow passed to flatpak instead of being interpreted by the shell.
You could try a subshell
$(flatpak .....) &
One other thing that works for me locally (have not tried with Dolpin from Flatpak) is to start Dolphin as the standard handler for directory URLs.
Thanks @krake I tried this. Unfortunately, it did not work. Somehow the folder did not open in Dolphin. And Konsole remains open and did not return to its prompt.
This is the content of the bash script file I tested
#!/bin/sh
(flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER>") &
Same result with this
#!/bin/sh
(flatpak run org.kde.dolphin) &
EDIT: I added the parenthesis (…) above
I’m trying now your other suggestion now about xdg-open. This is a good idea. Debian as good support for xdg.
That’s all I can go . I’ll leave bash scripting involving flatpak to experts and basically, that’s (one of the many reasons) why I don’t like flatpaks, they add unnecessary complexity imo.
Thanks again @krake This also failed. Bummer. Same result. Somehow the folder did not open in Dolphin. And Konsole remains open and did not return to its prompt.
Both suggestions about (flatpak run …) and xdg-open worked from within Konsole. But they both failed when using the Dolphin’ Launch in Konsole.
Below is the same reply as above. But with details if you’re interested.
This screenshot shows the 3 steps I used to run the bash script from Dolphin.
My needed end result is to add the flatpak run org.kde.dolphin --new-window "/<PATH TO FOLDER> command, or equivalent command, into a bash script (.sh). Which automatically runs multiples commands one after the other. One of those command is to open a folder in Dolphin.
After the bash script is created, this is how I use it:
Using Dolphin, right-click on the bash script .sh file. For example: my-bash-script.sh
The number 2 in the screenshot above show this.
Still using Dolphin, from the menu I expended above, select the option Launch in Konsole. The number 3 in the screenshot above show this.
The bash script runs in Konsole. Including all the commands in the script.
After all the commands are ran, Konsole either returns to its command prompt or Konsole automatically closes itself. Either way would be success for me and meet my needs.
Thanks for all your suggestions @rockandstone. They did help to narrow down the cause of the challenge. This is appreciated.
I really enjoy Flatpak. Because I need stronger security, stronger privacy, and more recent versions of apps. To each their own needs. As you know, both Konsole and Dolphin are available in either Flatpak or non-Flatpak format to choose from.
Definitely not a shell scripting expert myself, but if I can make an observation and suggestion…
Both Konsole and Dolphin have the “Acquire arbitrary permissions” permission granted to their Flatpaks - so if they were malicious, they could grant themselves all possible permissions with no user prompting, and then would not really be much more confined than a distribution-packaged application.
Privacy is completely in the hands of the application - even without any further self-granted permissions, the Dolphin Flatpak comes out of the box with both full read/write to your home folder, and network access. If it were malicious, it could exfiltrate your personal files to a remote server, completely unhampered by the Flatpak container.
(Hopefully it goes without saying that I don’t think Konsole and Dolphin are in any way actually malicious…but using them as Flatpaks in this situation - as far as I can tell - does not offer a security or privacy benefit).
For what it’s worth, if you value more recent upstream versions of applications over feature-frozen versions with backported patches by the distribution maintainers, then you might be better served with a Linux distribution that shares that perspective.
Hope you are able to find a setup you’re happy with
Why do you run the script with “Launch in Konsole” if you don’t need the Konsole window to stay around?
Why not just launch the script directly as an executable?
In any case one other idea I had was to replace the flatpak run invocation with the “command” (wrapper script) that Flatpak has has created to run the application as its own command.
For example I have Zoom installed as a Flatpak.
I can either run it as flatpak run us.zoom.Zoom
I happily tried this. But unfortunately it failed. To clarify my needs, see the steps to reproduce and screenshot in my original comment. Under “After the bash script is created, this is how I use it” line.
I’m assuming that you meant flatpak run org.kde.dolphin <path> &; disown & exit
Because dolphin alone is not a Flatpak command. Using the steps above, with dolphin alone, Konsole returned this error message:
<FULL PATH TO .SH SCRIPT>: 2: Syntax error: “;” unexpected
Why not just launch the script directly as an executable?
The bash script (.sh file) already has the executable permission. Same failed result with both “Launch in Konsole” and launch the script directly as an executable with ./bashscript.sh. I mean, the folder is successfully open in Dolphin. But Konsole remains open.
Good idea. I learned something new. Thanks I tried that. Dolphin does successfully open the correct folder. Which is great. But same failed result. Because Konsole remains open.
In my case, I use this:
#!/bin/sh
/var/lib/flatpak/exports/bin/org.kde.dolphin --new-window "/<PATH TO FOLDER>" &
disown &
exit