Refactored the idle callback to allow code re-use
Re-using code for XDG menu handling