You can get the username from the url by removing .tiddlyspot.com from the $:/info/url/host.
{{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}}
the tiddlyspot username is saved in $:/UploadName
here’s a button which will switch the username to match the current url:
\define action-set-tiddlyspot-user()
<$action-setfield $tiddler="$:/UploadName" text={{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}} />
\end
\define show-set-tiddlyspot-user-button-always()yes
<!-- if you change show-set-tiddlyspot-user-button-always to no, the switch button will olnly show if the username doesn't match the current url -->
<$list filter="[{$:/info/url/host}removesuffix[.tiddlyspot.com]trim[]] -[{$:/UploadName}trim[]] [<show-set-tiddlyspot-user-button-always>prefix[yes]]">
<$button class=<<tv-config-toolbar-class>> >
<<action-set-tiddlyspot-user>>
<span class="tc-dirty-indicator">
<span class="tc-btn-text">switch to <$text text={{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}} /></span>
</span>
</$button>
</$list>
if you add the tag $:/tags/PageControls
then it will show in the Tools tab.
You can then expand the tag pill and drag your button up next to the save button.
it might be possible to add the action-setfield to the save-wiki button so that it updates when you click the save button, but I couldn’t test that option.