"Focus console after executing from source" setting not working

When I execute code in RStudio, the cursor moves to the console automatically, which is very annoying. How do I get it to stay in the editor?

Duplicate of Cursor automatically moves from Source to Console after running

What I have found is

  • When the Source Editor window is not popped out, the issue does not occur
  • When the Source Editor window is popped out, the issue occurs
    • Sometimes a different issue occurs in this situation, which is the cursor seems to not be in the editor nor the console. I haven't been able to reproduce this.

I have tried:

  • Tools > Global Options > Code > Exectuon > toggling "Focus console [...]" ON, restarting R, toggling OFF
  • To ~/.config/rstudio/rstudio-prefs.json, adding "focus_console_after_exec": false to the JSON.

Example of the cursor not staying in the editor: https://drive.google.com/file/d/1LnGIZksP-anGt0VUVPXoOD1PZ8nRBx7A/view?usp=drive_link

Version information:

RStudio 2026.08.1+195 "Yellow Yarrow" Release (8d474bc4cfad0e317095cd171e8ef44db6887068, 2026-08-14) for Ubuntu Jammy
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) rstudio/2026.08.1+195 Chrome/148.0.7778.280 Electron/42.7.1 Safari/537.36, Quarto 1.9.38

This looks like an RStudio bug specific to the popped-out Source Editor, rather than a problem with your settings. Your focus_console_after_exec: false setting is the correct option but it apparently isn’t being respected when the editor is detached.
Since the issue disappears when the Source Editor isn’t popped out, the practical workaround is to keep the editor docked. I would also report it as a reproducible bug with your RStudio version and Ubuntu details.

Thank you Emma. By reproducible bug, do you mean on Github (Writing Good Bug Reports · rstudio/rstudio Wiki · GitHub), or somewhere else?

Yes, opening an issue on GitHub is the best practice (in the rstudio/rstudio repo). That's where the RStudio development team (including me) actually go looking for problem reports to investigate.

I can open an issue for this (unless you are super-excited to do it). Post here if you beat me to it, otherwise I'll post a link to it after I open it.

@symbalex Hi, so far I've been unable to reproduce this.

I tried RStudio 2026.08.1 as well as a recent daily build of 2026.09.0 and the cursor stays in the popped-out source editor as I execute code (unless I turn on that setting you mentioned).

I've only tried on Ubuntu 26.04 LTS with Wayland (plus macOS and Windows-11).

What do you get if you run this in the RStudio Console?

.rs.readUiPref("focus_console_after_exec")

Wondering if that setting is somehow stuck in the TRUE state, despite showing as off in the UI.

Hi Gary, running that gives me FALSE

> .rs.readUiPref("focus_console_after_exec")
[1] FALSE

I'll file an issue :slight_smile:

This has an issue on Github and is being actively worked on by devs.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.