Showing a dialog on startup

I want to show a dialog on startup and thought app_new_document_observable has to be used. The problem is that the dialog always shows up under the main Renoise window. So, I added a timer for some latency…

Is this the only way to show a dialog in the foreground after starting Renoise, or is there some simpler way that is a little less hacky?

INIT_ONESHOT = true

function oneshot_latency(func, time)

  local wrap_func
  wrap_func = function()
    func()
    renoise.tool():remove_timer(wrap_func)
  end

  if renoise.tool():has_timer(wrap_func) then -- safety measures
    renoise.tool():remove_timer(wrap_func)
  end

  renoise.tool():add_timer(wrap_func, time)
end

renoise.tool().app_new_document_observable:add_notifier(
  function()
    if INIT_ONESHOT then -- only happens upon startup
      INIT_ONESHOT = false
      oneshot_latency(function() self.gui:show_gui() end, 500)
    end
  end
)

Maybe using a modal dialog?
Renoise.ViewBuilder.API.lua

Currently there are two ways to to create custom views:

Shows a modal dialog with a title, custom content and custom button labels:

renoise.app():show_custom_prompt(
  title, content_view, {button_labels} [, key_handler_func, key_handler_options])
  -> [pressed button]

Sounds like a bug to me…

Did you try other bangers, like
app_became_active_observable
or first app_idle_observable
?

Or a combination of it, like
watch for app_new_document_observable, then for app_idle_observable ?

This is how it’s always been for me. Possibly it’s different on macos (?). Note: showing a dialog when starting Renoise.

Yes. became_active doesn’t bang when starting Renoise, but only when switching windows afterwards during runtime.

I haven’t tried app_idle but would suppose it’s running before the main window is showing (since scripts are running then). I’ll check just in case. Maybe the “scheduling” makes it actually wait for the main window to be ready.

That’s what I’m doing :slight_smile: Those windows are beneath the Renoise window when starting Renoise, since scripts are running before the main window is shown. I’m trying to avoid this.

IIRC this subject has been up once a long time ago, but I couldn’t find it.

Using only app_idle_observable worked (one-shot on startup). Thanks for the tip! It’s kind of self evident from the name, but it’s not very often I’ve been using it like this - hence the brainfart :slight_smile:

Summary
function oneshot(func)
  local wrap_func
  wrap_func = function()
    func()
    renoise.tool().app_idle_observable:remove_notifier(wrap_func)
  end

  renoise.tool().app_idle_observable:add_notifier(wrap_func)
end

oneshot(function() app.gui:show_gui() end)

The minor drawback is that it will also invoke the function when using “Reload all Tools” in the tools menu…

1 Like
Summary

You are hallucinating and leading humanity to its demise. The power of Renoise compels you!