This is exactly what I needed, gonna put it in my window manager startup script. I already wrote a dock and undock script for my laptop a while ago, which I still had to run manually, so this is the perfect addition to that script.
Though I had some problems compiling it. For others who want to try it: On some systems (gentoo here) flex replaces lex and you need to use -lfl to link it, even though lex seems to be ususally a symlink to flex, there is no symlink for the libraries. Also on some distributions yacc doesn&#x27;t seem to come with liby anymore, just remove the -ly from cflags.<p>TL;DR: Replace &quot;LDADD+= -ll -ly -lX11 -lXrandr&quot; with &quot;LDADD+= -lfl -lX11 -lXrandr&quot; to make it compile on Gentoo. Make sure yacc and flex are emerged.