Disconnect wireguard vpn when it has been inactive for a long time

Hello!

Is it possible to create a script for wireguard type roadwarrior to disconnect the vpn when it has been inactive for more than X minutes?

BR.