In it, I drag and drop JPEGs and other image files that I download. When my script detects that there are new files in “tmp” on the desktop, it goes through them, convert them all to PNGs and then move them to a different location.
If I have Dolphin opened and viewing “tmp” on the desktop while this happens, it gets into a “stale” state where it only reloads if you actively press F5 – it never does it on its own.
As soon as I press F5, the view is updated and the files are gone.
I asked about this in the help category at first, but it seems like an actual bug/lacking feature, so I was told to post here.
Is Dolphin really not “tracking” its opened views for changes? Or is it meant to be doing so, but it’s got some bug? Is there any command that I can run in the mean time to force-reload Dolphin from my script, after it has moved the files?
To clarify, for me dolphin normally does what you want, and has always done so as far as I can remember. So it’s not a missing feature, or a general bug, it may be a bug affecting your dolphin.
Maybe your system has something creating lots of watches, and so has run out. I suggest reading this stack overflow post. I tried the bash script and it was quick.
As I mentioned in the other topic, I can not reproduce the issue. Dolphin refreshes instantly regardless what I do in it. If it only happens when the script is activated I suggest to have a look at the script. Fairly easy to check. Convert a couple of jpeg’s to png and move the lot to a certain directory without the script. Check if that temp file gets refreshed.
You could use this servicemenu for the time being. To be placed in ~/.local/share/kservices5/servicemenus. Make executable. Don’t forget to change the pathname in the file.
[Desktop Entry]
Actions=To png and move
MimeType=image/*
Name=To png and move
ServiceTypes=KonqPopupMenu/Plugin,image/*
X-KDE-Priority=TopLevel
Type=Service
X-KDE-Submenu=
[Desktop Action To png and move]
Exec=filename=%f; convert %f ${filename%.}.png && kdemv5 ${filename%.}.png /path/to/where/you/want/them
Icon=image-png
Name=To png and move
Okay, so I just made a test where I put a JPEG into the tmp dir and then simply moved it using “mv” in a terminal. It moved, and the view updated. So, somehow, it apparently is “due to the script”, even though all the (PHP CLI) script does is move the file, just like the terminal command.
I’m going to have to look into what you said about “creating lots of watches”…
Thanks, but I already have my specific logic and stuff that has to be run. I want to resolve the underlying problem of it not updating for some reason, but apparently only when my script runs.
Interestingly, when I run my script’s move code “stand alone”, Dolphin does update its view. But not when my script is running with the exact same code as a daemon (eternal loop)…
The script does lots of private things and uses my custom PHP library, so I cannot share it. But it seems to depend on how long the script has been running; initially/early in the day, it seems like Dolphin’s view does update when it runs. But later, or after some condition is met, it stops working.
But later, or after some condition is met, it stops working.
That fits with the idea that some resource is running out. To reply to your other post, “watch” in the inotify subsystem is a something a process registers if it is interested in a file changing, and dolphin registers a watch on the directory it is displaying, so that it is notified when something changes. On the system I’m typing this there are 335 watches with a limit of 122889, but there are 85 “INotify instances” with a limit of 128. sysctl fs.notify tells me that “max_queued_events” is 16384.
Researching this I found a report of a sublime text user where sublime text was setting up a watch on every file in a large source repo, hundreds of thousands of files.
Well, if something is doing that, it’s not consciously by my script. Today, it has worked every time I have tried it, but this was not the case yesterday. I notice it now and then. When I posted the question/report, it seemed to happen every time. Very frustrating. I wonder if it’s creating those “watches” in large numbers so the system runs out… But why is there a maximum anyway? You’d think it would just delete/expire the oldest ones if it runs out.
My idea about inotify resources may be no good. I just abused my system by trying to open dolphin instances on 90,000 directories, and one of the inotify numbers expanded well over its limit.
But perhaps some other resource, like memory, runs out for you.