exclude electron "Cache" and "Code Cache" directories
Electron apps don't really use separate locations for their config, data and cache, but rather store most of the things in the
$XDG_CONFIG_HOME folder. This issue has been known for a while now (electron/electron#8124).
Example for Element (installed via flatpak):
# ~/.var/app/im.riot.Riot/config du -h -d 1 44K ./Service Worker 4,0K ./Crash Reports 44K ./GPUCache 20M ./EventStore 8,0K ./blob_storage 108K ./Local Storage 416K ./Session Storage 141M ./Cache 63M ./IndexedDB 9,4M ./Code Cache 48K ./shared_proto_db 32K ./databases 4,0K ./VideoDecodeStats 6,5M ./Dictionaries 240M
From what I've seen, the biggest directories are usually
Code Cache. Thus, I would propose to add something like
$XDG_CONFIG_HOME/*/(Cache|Code Cache) as well as
.var/app/*/config/*/(Cache|Code Cache) to the regexes that get excluded by default.
I can't think of a way to make those regexes more specific, but accidentally excluding "Cache" or "Code Cache" directories from other non-Electron apps shouldn't be problematic in most cases.
There is currently another ongoing attempt to fix this, which might be successful. But even if this gets merged, it will take some time until this arrives in the individual apps, so this issue may still be relevant for some time.