diff --git a/wezterm-gui/src/overlay/debug.rs b/wezterm-gui/src/overlay/debug.rs index fd08481cb..aa1cee057 100644 --- a/wezterm-gui/src/overlay/debug.rs +++ b/wezterm-gui/src/overlay/debug.rs @@ -1,3 +1,4 @@ +use crate::scripting::guiwin::GuiWin; use chrono::prelude::*; use log::Level; use luahelper::ValueWrapper; @@ -64,13 +65,14 @@ impl LineEditorHost for LuaReplHost { } } -pub fn show_debug_overlay(mut term: TermWizTerminal) -> anyhow::Result<()> { +pub fn show_debug_overlay(mut term: TermWizTerminal, gui_win: GuiWin) -> anyhow::Result<()> { term.no_grab_mouse_in_raw_mode(); let lua = config::Config::load()? .lua .ok_or_else(|| anyhow::anyhow!("failed to setup lua context"))?; lua.load("wezterm = require 'wezterm'").exec()?; + lua.globals().set("window", gui_win)?; let mut latest_log_entry = None; let mut host = LuaReplHost { diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index acc74acc9..ae4bf4523 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -1287,8 +1287,10 @@ impl TermWindow { None => return, }; + let gui_win = GuiWin::new(self); + let (overlay, future) = start_overlay(self, &tab, move |_tab_id, term| { - crate::overlay::show_debug_overlay(term) + crate::overlay::show_debug_overlay(term, gui_win) }); self.assign_overlay(tab.tab_id(), overlay); promise::spawn::spawn(future).detach();