Xrm(3pm)

πŸ’– Tk::Xrm β€” X Resource/Defaults/Options routines that obey the rules πŸ’–

okay bestie, this is the Tk::Xrm page from the User Contributed Perl Documentation section of the manual. she's a Perl module, she's a little chaotic, and she's about to make your X resources make sense. let's get into it ✨


🌸 SYNOPSIS 🌸

use Tk;
use Tk::Xrm;

that's it. two lines. you're welcome 🫢


✨ DESCRIPTION ✨

so here's the tea, bestie: the moment you load this module, Tk's Option code gets replaced by versions that call routines from <X11/Xresource.h> β€” which is, like, the exact same stuff every other X toolkit out there uses. no cap. πŸ’…

the result? the way name/Class get "matched" against the options database now follows the same rules as every other X toolkit. it's giving predictable. it's giving consistent. it's giving "I can have one single ~/.Xdefaults file and it just works" πŸ˜­πŸ’–

and fr fr, that last part is the whole point β€” one ~/.Xdefaults that gives sensible results for both Tk and (say) Motif applications. iconic behavior. the group chat has been asking for this for years πŸ‘‘


πŸ’€ BUGS πŸ’€

not everything is slay, so let's be honest:

  • optionAdd(key => value?, priority?) currently ignores the optional priority completely and just does XrmPutStringResource(). like, just completely ignores it. πŸ™ˆ maybe it should be more subtle and do XrmMergeDatabases() or XrmCombineDatabase() instead β€” but as of right now, it does not. noted. moving on.
  • this version is a little slower than Tk's re-invention of the wheel 😭 but bestie, there's more optimization that can be done. she's just not there yet. growth mindset ✨
⚠️ real talk: that priority argument is genuinely being dropped on the floor right now. don't build your whole config around it and then act surprised, okay? ily 🫢

πŸ¦‹ SEE ALSO πŸ¦‹

  • Tk::option β€” go read that too, bestie, it's the related one πŸ’œ

πŸŽ€ KEYWORDS πŸŽ€

database, option, priority, retrieve


and that's the whole page, bestie!! this one's from perl v5.40.1, dated 2025-04-13, living in the Xrm(3pm) slot of the User Contributed Perl Documentation. stay predictable, stay matched, stay slaying πŸ’–βœ¨πŸŒΈπŸ¦‹πŸ’…

πŸ“¦ where this page comes from