How to detect if Sample Recorder is recording?

Hi, is there some way of detecting if the Sample Recorder is recording or not?

I use Esc for edit mode on/off, but Esc also cancels (!) and hides the sample recorder.

How would I go about detecting that if the Sample Recorder is recording, then either stop recording, or at least don’t hide the sample recorder dialog.

EDIT: what i’m seeing is / are:


-- Dialog for recording new samples, floating above the main window.
renoise.app().window.sample_record_dialog_is_visible
  -> [boolean]

-- Start a new sample recording when the sample dialog is visible,
-- otherwise stop and finish it.
renoise.song().transport:start_stop_sample_recording()
-- Cancel a currently running sample recording when the sample dialog
-- is visible, otherwise do nothing.
renoise.song().transport:cancel_sample_recording()

and that’s it.