Checking when SCREEN_RESOURCES property is updated

Chris Sorenson csoren at cpinternet.com
Sun Jan 9 16:56:58 UTC 2022


>

> Today's Topics:
>
> 1. Checking when SCREEN_RESOURCES property is updated (Xaro)
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 07 Jan 2022 08:29:50 +0000
> From: Xaro
> To: xorg at lists.x.org
> Subject: Checking when SCREEN_RESOURCES property is updated
> Message-ID: <3d4c9e62-5bcb-4238-8e4c-dd1689e810a7 at www.fastmail.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello,
>
> I have an application that reads some Xresources file configs to update its theme.
>
> So i use XOpenDisplay, XResourceManagerString and XrmGetStringDatabase from
> libx11 to get the fields that i want.
>
> My problem is when the user update the Xresources file then run `xrdb ~/.Xresources`
> my version of the database is not updated, and i don't know how to detect such an event.
>
> I can retrieve the theme for example every 10 seconds but that is too much. Is there a
> way or a blocking function I can use to detect if the SCREEN_RESOURCES
> property for a screen has been updated so that i can retrieve it and update the
> application theme?
>
> I'm not very knowledgeable about C or X11 in general but I'm trying my best to learn,
> couldn't find what i want in the documentation.
>
> If someone knows the direction i should be looking for I will really appreciate it.
>
> Thanks.
>

At the risk of being overly obvious, you do realize you can pass in your resources as the sixth argument to XtOpenApplication, yes?

Like so:

String fallbacks[] = 
{
"myAppClassName*background: #ff0000",
 "myAppClassName*foreground: #ffffff",
"myAppClassName*XmList.fontList: -*-courier-medium-r-*--12-*",
"myAppClassName*XmText.fontList: -*-courier-medium-r-*--12-*",
 /* list the rest of the default resources here ... */
 NULL
};


More information about the xorg mailing list