I'd like to set my PC to automatically hibernate after a certain length period of inactivity. How can I do this?

I am able to find the settings in gnome power manager to make it sleep after a certain period of inactivity but no way to make it hibernate instead.