Iterate through displays to find an X11 display to use.

open_x11(display_id = 10, max_attempts = 10)

Arguments

display_id

Starting display ID

max_attempts

Number of displays to try

Value

Invisibly returns the opened display ID.

Details

When reconnecting a tmux session, the R session may no longer be able to open an X11 window. In such cases, the display ID may have changed between the R session opening and the tmux session reconnecting. This function iterates over the displays until one can be used or max_attempts is reached.