3 ms·
Nice! I also use inotifywait for hot reload when writing https://www.oilshell.org/ https://www.oilshell.org/ I never heard of the xdotool method ... although
by chubot 4y ago
Nice! I also use inotifywait for hot reload when writing https://www.oilshell.org/ https://www.oilshell.org/
I never heard of the xdotool method ... although it sounds like it has some drawbacks?
https://github.com/adityaathalye/shite/blob/master/bin/hotreload.sh https://github.com/adityaathalye/shite/blob/master/bin/hotre...
I do it with a crappy Python web server that dynamically inserts some JavaScript. This also has bugs and drawbacks, though I don't think any fundamental ones ... At some point I would like to "make it nice", but it has been working well in practice for years
I think the method is reasonable, and doesn't depend on your local desktop environment as much.
I also have a Makefile for incremental rebuilds, but I would really like to replace that with Ninja. Ninja goes pretty well with shell (although it also has the issue of needing to escape $ as $$)
- adityaathalye 4y agoLovely to hear from you, Andy! Thank you for sharing. It's good to know this work is in fine company :) > although it sounds like it has some drawbacks? Oh yes. The Xdotool Reload Method emulates keystrokes, so it has... drawbacks... as you put it mildly :) For my use-case, it literally does F5, or it fills out a url and hits Enter. cf. this `case` statement: https://github.com/adityaathalye/shite/blob/master/bin/hotreload.sh#L114 https://github.com/adityaathalye/shite/blob/master/bin/hotre... I wanted to keep /mandatory/ moving parts to a minimum in a hand-rolled setup. So I sort of went hardline about avoiding prerequisites like a server process, and especially a JS client. The xdotool trick worked surprisingly well (for the most part), and so I stuck with it! > it has been working well in practice for years This is the holy grail. I really hope I get years-long stability out of it. Based on my experience so far, I feel good about the long-term odds. > I also have a Makefile for incremental rebuilds, but I would really like to replace that with Ninja. I was going to write a Makefile at some point. I'll have a look at Ninja. Thanks for the tip!