I wanted to create a custom toggle hotkey to show/hide the viewport grid. So in the properties panel, I looked under the <b>Display</b> section and found out that the variable I should be toggling is <i>SpaceView3D.show_floor</i>. Then under <b>3D View</b> hotkeys, I added a new one, and set the operator to <i>wm.context_toggle</i> and <b>Context Attributes</b> to <i>SpaceView3D.show_floor</i> (I have also tried <i>bpy.types.SpaceView3D.show_floor</i>). When I try to use this hotkey, I get an error: <i><b>Context object has no attribute SpaceView3D</b></i> (or <i>bpy</i> in the latter case).
Obviously I am doing it wrong. I would very much like to learn how to do it right and what is the right way of looking up what group of parameters should be toggled with which operator.