Disable forced focus when a notification appears, but keeping the notification

Resolved 💬 6 comments Opened Mar 8, 2026 by RodriMora Closed Mar 8, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

CLI

What feature would you like to see?

At the moment it's possible to completely disable the forced focus window by disabling the notifications but it's not possible to keep the notifications and disable the first focus feature when the notification pops up and codex requires attention.

Additional information

[tui]
notifications = false

disables the forced focus to the terminal, but disables notifications too.
Ideally a focus_window_on_notification = true/false would allow for a more fine grain configuration

View original on GitHub ↗

6 Comments

etraut-openai contributor · 5 months ago

Can you explain what you mean by the "forced focus window"?

Which platform are you using? Which terminal emulator? Which version of the Codex CLI?

Which notification mechanism are you using? Depending on your terminal emulator, the Codex CLI uses either a bel (a simple chime) or osc9 escape sequences, which most terminals turn into an OS-specific notification. The behavior of that notification depends on the operating system and OS-level settings. It's not under the control of either the terminal or Codex.

RodriMora · 5 months ago
Can you explain what you mean by the "forced focus window"?

Sure! by “forced focus window” I mean that when Codex emits the notification because it needs attention, my terminal window gets brought to the front and takes keyboard and mouse focus. What I want is to keep the notification, but not have the terminal steal focus.

Which platform are you using? Which terminal emulator? Which version of the Codex CLI? Which notification mechanism are you using? Depending on your terminal emulator, the Codex CLI uses either a bel (a simple chime) or osc9 escape sequences, which most terminals turn into an OS-specific notification. The behavior of that notification depends on the operating system and OS-level settings. It's not under the control of either the terminal or Codex.

I'm using Arch Linux with Hyrpland. On hyprland when you switch focus to a pane, it moves the mouse to the center of that pane. Codex notifications trigger this focus on the terminal window+movement of the mouse.
So on every notification is changing my focus.

Ghostty 1.2.3-arch3
Hyprland 0.54.0 (Wayland)
codex-cli 0.111.0

Some other tools can emit notifications without forcing the window focus.

Update:
Upon further testing, this problem only happens while launching codex from tmux. Launching codex directly from fish shell+ghostty without tmux sends the notification but doesn't changes the focus.

etraut-openai contributor · 5 months ago

The behavior you're seeing is not under the control of Codex as far as I know. Codex is simply emitting osc9 escape sequences. It's up to your terminal to determine what to do with them. Most terminals do not change focus, they simply call the OS to display a notification. It sounds like your terminal is changing focus. Perhaps there's a configuration option in your terminal to adjust this behavior.

zeachco · 21 days ago

I think this issue was legit, if I may add more context:

I tried opencode, pi, claude, hermes, herdr...
I tried on arch wayland... debian on x server
I tried on macos...
through the terminal directly, rhough zellij, through tmux...
I tried alacritty, ghosty, terminator, terminal-gnu, terminal (osx) and term2 (osx)...

in all cases, without exceptions, codex grabs the mouse/keyboard attention while other harness don't.

I start a task with high thinking, codex takes time, so I switch to other tasks that requires typing and we end up approving or interrupting the flow instantly as codex grabs back the focus mid sentence i'm writing elsewhere.

is there options or env variables we could use to disable that behavior if that's our preference?

something like CODEX_NATIVE_NOTIFICATIONS=0 codex or codex --no-notifications ?

PS it's annoying enough that i'm ready to take a stab at it and spend my codex tokens on codex itself but I would appreciate pointers, that notif call @etraut-openai mentioned, is that in the rust wrapper we have node package.json, python references? Not sure I have time to read the whole project and each stack's roles in this repo

craigderington · 19 days ago

Hyprland users can just add a window rule.

In 0.56.1, I added this user-level rule to ~/.config/hypr/hyprland.lua:

``o.window("Alacritty", { focus_on_activate = false })``

zeachco · 18 days ago

@craigderington thanks for that!
I assume Hyprland users are good with customizing their systems in general, I'm more worried about osx users and felt this issue got dismissed a little too fast but I might be out of my depth