I don't know the answer but am also interested in knowing how to do this.
The man page of logind.conf says that systemd runs everything you put in /usr/lib/systemd/system-sleep/ before sleep, so first I was thinking that perhaps this could be used by setting IdleAction to ignore. That perhaps it then nevertheless reaches sleep.target or some other similar state and then you could hook your script to switch off the display at that target. However, I believe that this might not be the case, the ignore might just not do anything at all even if you set IdleActionSec to some amount of time.
Yet another idea would be to modify the exist sleep so that it does not actually do anything, but that it enters the target state and then perform stuff in that target only. This can be done in systemd-sleep.conf (see man)
Then I started thinking that perhaps you could jus make your own target to reach at some time of idle, set a timer and bind your script to the target. However, I wonder if you would be able to turn the screen on anymore, and how this could be done exactly?
Because as I undertand it, the standard sleep is set up so that you can put a script in /usr/lib/systemd/system-sleep/ and have it do stuff before and after reaching sleep.target. And you could make simple shell script to turn off screen and turn on screen. The only problem is that it would then do these btasks before either suspend, hibernate or other such state that you do not want. If state ignore does nothing but still executes the content nof that folder, then that would be really easy. However, it might not, hard to say, the manpage does not say. It says, however, that this is
the default behavior. One would assume that the only sensible thing to make default would be "do nothing", in this case.
The manpage of systemd-sleep(8) says that
systemd-suspend.service is a system service that is pulled in by suspend.target and is responsible for the actual system suspend
That sounds like that when normally you have idle time, then when it passes what you mark in logind.conf as the threshold for idle time, this triggers the IdleAction, and if it is sleep, then you enter suspend.target, possible additional scripts are run and then systemd-suspend.service is run to go to sleep. But what if you made suspend.service into an empty service? Most likely you could then use the pre/post scripts and reach suspension without suspending the system. That kind of hackish and would probably result in suspend no longer working normally, so would
be a dumb idea if you need suspend also.
EDIT: a third option that I came up with is that since systemd can monitor file and path states, that perhaps a service that monitors /dev/input/yourkeyboard could be used with a time, so that if no change for 10 min, then shut off monitor.