Currently, xfig creates the following files at the root of the home directory: .xfig, .xfigrc
I would prefer if xfig saved it's files in the corresponding XDG Base Directories. As .xfigrc contains the last opened documents, and .xfig seemingly contains an auto-save of an xfig document, both of these should reside in $XDG_STATE_HOME/xfig.
The most logical behaviour would be for xfig to look in the root of the home folder for these files (the standard location). If they are not found, then attempt to load the files in $XDG_STATE_HOME/xfig (the new location). It may even make sense for xfig to attempt to use an environment variable to look for it's state files that defaults to $XDG_STATE_HOME/xfig, so that users can completely customise the location these files are saved at.
Yes, it is correct that xfig should adhere to more modern standards for persistent file storage. In my opinion, that would be $XDG_CONFIG_HOME, though, not $XDG_STATE_HOME. On my (stable) debian system, .local/state, the default if $XDG_STATE_HOME is not set or empty, does not even exist. $XDG_STATE_HOME was introduced between version 0.7 [1] and 0.8 [2] of the xdg base directory specification, hence between 2010 and 2021. Since xfig may save two configuration files, .xfigrc and .xfigrcstyle, but rarely writes a .xfig file (Mine was created in Feb. 2025! And I often work with xfig.), I would opt for $XDG_CONFIG_HOME/xfig, falling back to $HOME/.config/xfig.
[1] https://specifications.freedesktop.org/basedir/0.7/
[2] https://specifications.freedesktop.org/basedir/0.8/
In fact, .xfigrc only stores the last recent files, settings are retrieved from X resources or manually from loading a style family, stored in .xfigrcstyle. Presumably, few users know about setting and reloading styles. Nevertheless, I would put these files into ./config/xfig, not under the quite unused .local/state.
I understand that many programs don't seem to use the state folder, but they should. I would love the ability to be able to backup just my $XDG_CONFIG_HOME folder without dragging useless state or cache files along side it. It is rather annoying to have to research what programs use $XDG_CONFIG_HOME for config and what programs use it for everything else I don't want.
It may seem unnecessary, but adhering to this standard would be a great benefit for many people, including me, for a variety of reasons. It would also serve as a great example for how older utilities can adhere to modern standards without introducing compatibility issues.
Ideally, xresources should also be in the $XGD_CONFIG_HOME folder. It does not belong at the root of the home folder (although I'm doubtful this file will ever move, unfortunately).
Under my rolling-release archlinux, there are a few files under .local/state. gnuplot gives a nice example. To recapitulate, the files written by xfig are (i) .xfigrc, which contains the recently opened files. In the freedesktop sepcification, this is given as an example for being stored under $XDG_STATE_HOME. (ii) .xfigrcstyle, which contains user settings, a good example for $XDG_CONFIG_HOME. (iii) .xfig, which is a cut buffer for copying and pasting figures between restarts or different instances of xfig. Also $XDG_STATE_HOME. The only file that is always created is .xfigrc, .xfigrcstyle probably very rarely, .xfig occasionally.
From my experience, most users do not even know about this files (they are not supposed to). Those who care would most probably appreciate to find these files in the correct, or expected place. (There is a slight difference between "correct" and "expected".)
To conclude, I suggest to rename and move (i) .xfigrc to $XDG_STATE_HOME/xfig_recent_files, (ii) .xfigrcstyle to $XDG_CONFIG_HOME/xfig_settings (not styles, what are styles?), and .xfig to $XDG_STATE_HOME/xfig_clipboard.fig. No xfig subdirectory, for a maximum of two files I find a subdirectory unnecessary. In addition, a modern xfig should delete the .xfig, .xfigrc and .xfigrcstyle files.