Add title option to set the browser tab title#263
Open
r2evans wants to merge 1 commit into
Open
Conversation
With several R processes each running a httpgd device, every browser
tab is titled "httpgd" and there is no way to tell which tab belongs
to which process.
hgd() gains a `title` argument (default `getOption("httpgd.title",
"httpgd")`) and a new exported function hgd_title() renames a running
device. The title is part of the server state: it is included in every
state JSON (/state, /plots, /remove, /clear and the WebSocket
broadcast), so connected clients pick up a rename immediately without
reloading the page. Title-only changes do not touch upid, so they
cannot trigger plot re-fetches. Clients connected to an older server
that sends no title keep the "httpgd" default, and older clients
ignore the extra JSON field, so both directions stay compatible.
Closes nx10#232
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With several R processes each running a httpgd device, every browser tab is titled "httpgd" and there is no way to tell which tab belongs to which process.
hgd() gains a
titleargument (defaultgetOption("httpgd.title", "httpgd")) and a new exported function hgd_title() renames a running device. The title is part of the server state: it is included in every state JSON (/state, /plots, /remove, /clear and the WebSocket broadcast), so connected clients pick up a rename immediately without reloading the page. Title-only changes do not touch upid, so they cannot trigger plot re-fetches. Clients connected to an older server that sends no title keep the "httpgd" default, and older clients ignore the extra JSON field, so both directions stay compatible.Closes #232
This is useful to me because I often have multiple R sessions/processes, each with their own plot histories. I like to be able to confirm visually which tab is assigned to which R process immediately when looking at the browser tabs instead of inferring based on the plot contents.