Sunday, November 05, 2023

Re: [new] x11/srandrd 0.6.3 - the missing hotplug daemon for X outputs

On Sun, Nov 05, 2023 at 04:37:06PM +0100, Stefan Hagen wrote:

[...]

> > > SUBST_VARS = ${WRKSRC}/Makefile

[...]

> >
> > CFLAGS += -I${X11BASE}/include
> > LDFLAGS += -L${X11BASE}/lib
>
> I mixed this up. This should have been:
>
> post-patch:
> ${SUBST_CMD} ${WRKSRC}/Makefile
>
> To replace X11BASE in the Makefile.
>
> But I like your solution better and took it over. New version attached.

You now have the CFLAGS and LDFLAGS in both the port Makefile and the
Makefile in WRKSRC, the latter expanded to /usr/X11R6 in 2 places.

I was thinking of something like:

CFLAGS := $(CFLAGS) -Wall -g -pedantic -std=c99

My Makefile-fu isn't good enough to get this to work similarly for
LDFLAGS without resorting to renaming the variable in
${WRKSRC}/Makefile...

Either way, you should probably pass those include and link dirs only
in one place, and not both Makefiles.

>
> > This makes it easier to amend in the future if the need arises.
> >
> > Lastly, as this is a demon, should this come with an rc file and a
> > dedicated user, so that it can be run on system startup? With X11
> > applications, this makes it a bit weirder to launch before .xsession.
> > Not sure if that's worth a consideration, but I'm thinking of it
> > because of some contortions that I've done with sensorsd(8) and
> > something like in the sensorsd script:
> >
> > su -l thfr -c "env DISPLAY=:0 $command"
>
> srandrd needs to be started while X is running. If it can't connect to
> X, it will just print an error and quit. So a traditional daemon won't
> work.
>
> I got it to work from xenodm/Xsetup_0. But when the switch to the
> user happens, the login session is closed and srandrd will quit.
> So you still need to add it to .xsession as well.
>
> If you find a better solution, I'm all ears.

This makes sense... an rc file would not be useful at all then. Thanks
for the clarification!

>
> If you want to switch from sensorsd, you could use the "srandrd list"
> output as check. This doesn't daemonize. But I wouldn't want to wait
> for the next sensorsd check when I plug a screen in. The srandrd daemon
> switches immediately.
>
> Thanks for the feedback!
> - Stefan

No comments:

Post a Comment