Repository navigation
Conversation
xapp_get_tmp_dir() never consulted the environment: it probed /dev/shm first and fell back to g_get_tmp_dir(), so the location of XApp's temporary files could not be redirected on any system with a writable /dev/shm. Give the environment priority, using the first writable location: 1. $TMPDIR 2. $XDG_RUNTIME_DIR 3. /dev/shm (previous behaviour, kept as a fallback) 4. g_get_tmp_dir() This fixes blank tray icons. xapp-sn-watcher materialises a StatusNotifierItem's IconPixmap to <tmpdir>/xapp-tmp-<heap-ptr>-<idx>.png and hands the path to panel applets. The name embeds the icon item's live heap pointer, so it changes on every watcher restart, and the watcher g_unlinks the file on item finalisation. An applet that cached the path fails to load it and renders an empty slot. Observed with Chromium/ Electron apps that export IconPixmap only and have no IconName property (e.g. Bitwarden). XDG_RUNTIME_DIR is per-boot and user-owned and is not purged mid-session, so the temp file outlives a watcher restart within a session. The returned pointer is cached in a static for the process lifetime, so the chosen value is g_strdup()ed rather than pointing into getenv() storage. The access(W_OK) probe is preserved for every candidate.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xapp_get_tmp_dir()never consults the environment: it probes/dev/shmfirst and only falls back tog_get_tmp_dir(). That makes the location of XApp's temporary files unredirectable on any system with a writable/dev/shm— which is essentially all of them.This patch gives the environment priority, using the first writable location:
$TMPDIR$XDG_RUNTIME_DIR/dev/shm(previous behaviour, retained as a fallback)g_get_tmp_dir()Why it matters — it causes blank tray icons
xapp-sn-watchermaterialises a StatusNotifierItem'sIconPixmapto a file and hands the path to panel applets (xapp-sn-watcher/sn-item.c:244):where
filenameisxapp-tmp-%p-%d.png. Two properties of that scheme combine badly:%pis the icon item's live heap pointer, so the name changes on every watcher restart and the previous file is orphaned.g_unlinks the pixmap on item finalisation and sweepsrm -f <dir>/xapp-tmp-*.pngon startup (xapp-sn-watcher/xapp-sn-watcher.c:542).A panel applet that caches the path — as Cinnamon's
xapp-statusdoes; it readsproxy.icon_nameonce and only re-reads on a property change — is then left holding a dead path.load_image_from_file_asyncfails and the tray slot renders blank.Reproduced on Cinnamon 6.4.10 / Debian 13 with Chromium/Electron apps that export
IconPixmaponly and noIconNameproperty at all (Bitwarden:Id=Bitwarden_status_icon_1,IconPixmap512×512 ARGB,IconNameabsent). Two unrelated apps showed blank slots from the same cause. Log evidence:An app whose temp file still existed rendered correctly at the same moment, isolating the cause to the missing file rather than the applet.
Using
$XDG_RUNTIME_DIRwhen it is available fixes this class of failure, because it is per-boot and user-owned and is not purged mid-session, so the file outlives a watcher restart within a session.The change
g_strdup()is required because the returned pointer is cached in astaticfor the process lifetime, so it must not point intogetenv()'s storage. Theaccess(W_OK)probe is preserved for every candidate, so an unwritable directory still falls through. The ABI is unchanged.Notes
/dev/shmwhen writable. After this patch it is$XDG_RUNTIME_DIRin a normal systemd session. That is the intended behavioural change.g_get_tmp_dir, but includes the/dev/shmramdisk as the first choice", which describes the old behaviour./dev/shmis retained as a fallback so behaviour is unchanged on systems withoutTMPDIRorXDG_RUNTIME_DIR.Testing
Built against the Debian
xapp2.8.8-1 source and verified in the compiled library:strings libxapp.so.1—TMPDIRandXDG_RUNTIME_DIRnow present (neither existed before).xapp_get_tmp_dirshows the expected sequence:g_getenv("TMPDIR")→ null/empty check →g_getenv("XDG_RUNTIME_DIR")→access(W_OK)→/dev/shm→g_get_tmp_dir().$TMPDIR/$XDG_RUNTIME_DIRthat the function returns the environment value, and that an unwritable value falls through.Happy to rework the precedence or add a configure option if you would prefer this to be opt-in rather than default.