-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include the name of the currently focused view in the window title #97790
Comments
Thanks for filling this. I think it is a fair feature request. |
I as a user of dictation software and contributor to TalonVoice , particularly a set of cross platform VSCODE voice commands, know that showing the focused view in the title bar would be a simple welcome addition to context management. Thank you for considering this feature-request, I hope we can see it soon |
I am opening this up for PRs.
|
I'd like to take this one, @isidorn. I've had a skim through the code already, and have a pretty good idea on the work that has to be done, but just wanted to ask for a pointer on where I would get an instance of the focused panel. I did some digging and saw that there's a panel service, that isn't currently used in the TilebarPart class at all, but wasn't sure if it's possible to get the panel from one of the existing services used? EDIT: dug some more, and seems like it probably isn't the panel service that I'm looking for, so instead just hoping for a pointer on the best way to figure out what's focused. |
@daniel-j-davis great, thanks for offering to look into this. vscode/src/vs/workbench/common/views.ts Line 499 in 1b65c63
You can see how other people are using it. |
Yeah, I tried using FocusedViewContext but unless I'm doing something wrong, it doesn't always seem to return what the focused view is. It definitely returns |
@daniel-j-davis we might be missing a method to get the active part. |
Not sure if it is a good idea to use You can use IViewsService and IViewDescriptorService to get visible view container and thereby visible views. |
It seems like (at least with the current implementation), it's not going to be possible to determine the focused view, I guess. I don't think that getting visible views would be able to solve this issue, because (at least as I understand it), if the terminal and explorer are both visible, those will constitute "visible views" but only one of them will be in focus. I'll definitely keep thinking to see if there's some other reasonable approach to implementation that I'm missing, but judging by our discussion so far, it seems like this would require somewhat of a refactor in other services before we'd be able to satisfy the ask in this issue. Let me know if I misunderstood or I'm missing something here. @isidorn @sandy081 |
@daniel-j-davis I think you got the state of things quite well. There simple is missing API to get the focused view.
|
@isidorn I just trialled implementation using the
|
@daniel-j-davis correct. It would have to be used in the cominbation with the view service. i.e what is focus from the layoutService + what is visible from teh view service. |
@isidorn to keep you updated, I just tried a solution where I would check what part has focus:
And if the editor is focused, then we know it's an editor that's active, if the sidebar is focused, then I check to see what viewlet is active, and if a panel has focus, then I check to see what panel is active — but long story short, it's pretty clunky with what it spits out, and I'm having some difficulty with determining whether or not the terminal/debug panel is active. I'm eager to see if there's some other way that I could determine whether or not the terminal is being used because we're on the right track but echoing your concerns that this might be too clunky. |
Please feel free to add an API in |
I'll take a look at adding that API in |
@daniel-j-davis if adding this APi turns out to be simple feel free to just create one PR with everything and I can review it all. |
Seems like it's going to be a little bit more complicated than I hoped to add this API method, and not sure it's something that I'll be able to do with my (limited) knowledge of the code base. I'd still like to fulfil the original issue once the API method has been added, but it may be better if somebody else who is more familiar with the code base could take the API method work item. @isidorn |
@daniel-j-davis makes sense. Thanks for giving it a try! |
@isidorn I'm happy to tackle this, but I think this requires a lot of help from you guys. If you put a logpoint in the only place that
that prints {this.id} , and then try to focus different parts of vscode, you will see that many things don't even trigger a change to this value, and also that the outline and timeline views are only called "outline" and "timeline" instead of having fully qualified names, and also focusing an editor doesn't change this value at all.
Also, This looks like it requires a change in how views are handled, the whole thing looks like a mess. Please help :P (@sbatten, @sandy081) |
We use focus tracker for this and it shall trigger it when the view is focused or blurred
They do not have fully qualified names as they got registered with these ids.
Yes, that's what I mentioned before 😄 and this need to be added.
It also knows about views. I understand that it is not easy code to go through. @isidorn Do you still think you want this to be |
@sandy081 thanks for providing more details. |
As a possible alternative is to use "when" expressions from the keyboard shortcuts. This would allow us to have much more fine-grained contexts then simply using focused view in the window title.
The downside is they can become quite long.
Either way this enhances accessibility for voice coding. Thank you! |
This is awesome Megan! |
Hi, would it be possible to add a setting to modify the title of the VSCode window to include the currently focused panel (editor, terminal, explorer etc)?
I use dictation software for all coding and the easiest way to activate and deactivate sets of commands is by matching on the window title, so for example
.py
in the window title activates Python commands. It would be useful to be able to activate a certain set of commands for editing code and a different set of commands when using the integrated terminal.isidorn in the accessibility Gitter channel suggested this be implemented by allowing something like
${focusedView}
in thewindow.title
setting, and I think this would work well.Thanks
The text was updated successfully, but these errors were encountered: