How's possible to minimize an extension window?

Dialog window minimize and restore are not exposed to the Ruby API.

You can close() and when you need to reopen, reattach the callbacks then call show() again.


If you are only concerned about Windows platform, you can use the Windows Scripting Host Shell object and it’s SendKeys method. But your dialog must have the focus.

# MS Windows using English ...
def minimize_dialog(dialog)
  dialog.bring_to_front
  dialog.execute_script("window.focus();")
  require 'win32ole' unless defined?(WIN32OLE)
  shell = WIN32OLE.new("Wscript.Shell")
  shell.SendKeys("%( )") # ALT+SPACE, to activate the window menu
  shell.SendKeys("n") # then N to choose Minimize from the menu
end

However, be aware that the hotkeys for menus may vary if Windows is using a language other than English.

1 Like