regnarg / urxvt-config-reload

42 stars 13 forks source link

removed dependency on Linux::FD #17

Closed branflakes2 closed 6 months ago

branflakes2 commented 5 years ago

I'm not sure if you had a specific reason for using Linux::FD, but Linux::FD broke with a recent Perl update for me and I was too lazy to figure out how to fix it so I did some reading instead. I found AnyEvent has built in support for catching signals, so I thought it might be nice to remove a dependency. I've literally never written any Perl in my life though, so if you have a good reason please ignore me :)

qualiaa commented 5 years ago

Heh, I did exactly this, but for some reason it wasn't working. I just re-implemented it on my fork and it works fine, so I guess I sent the wrong signal by mistake?

The alternative I went with in the meantime is to remove the AnyEvent dependency, as URxvt has a built-in AnyEvent implementation (urxvt::anyevent), but that version of AnyEvent doesn't have the signal watcher. I prefer the version using AnyEvent->signal.

regnarg commented 5 years ago

I have been thinking about this for some time and all ways of handling singals seem simply too messy. Perhaps it would be best to use a pipe or socket instead...

qualiaa commented 5 years ago

Ah, a problem I ran into which has cropped up again here is that even when you undef $watch, the AnyEvent signal handler doesn't close, keeping the URxvt process alive and holding the fd open. I'm not sure if there's a way to force-destroy the handler but I haven't found one.

branflakes2 commented 5 years ago

ah nice catch. I didn't notice that until now

rnhmjoj commented 4 years ago

I tested this and it works but is somewhat slower at picking up the signal than with Linux::FD. Also it sometimes happens the colors are not updated until I resize or click on the window.