From 6e6682fc1f59e5887645d75f0bb4ef497515b745 Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Sun, 7 Apr 2024 23:17:23 +1000 Subject: [PATCH] Enable focus reporting only for hidecursorinactive (#1676) --- client.go | 1 - eval.go | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index db60df4e..559102d2 100644 --- a/client.go +++ b/client.go @@ -36,7 +36,6 @@ func run() { if gOpts.mouse { screen.EnableMouse() } - screen.EnableFocus() if gLogPath != "" { f, err := os.OpenFile(gLogPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) diff --git a/eval.go b/eval.go index bdb7ff88..be3b1c2a 100644 --- a/eval.go +++ b/eval.go @@ -114,6 +114,13 @@ func (e *setExpr) eval(app *app, args []string) { } case "hidecursorinactive", "nohidecursorinactive", "hidecursorinactive!": err = applyBoolOpt(&gOpts.hidecursorinactive, e) + if err == nil { + if gOpts.hidecursorinactive { + app.ui.screen.EnableFocus() + } else { + app.ui.screen.DisableFocus() + } + } case "history", "nohistory", "history!": err = applyBoolOpt(&gOpts.history, e) case "icons", "noicons", "icons!":