microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.75k stars 29.1k forks source link

Provide a "focus-follow-mouse" setting #93772

Open guillaumeportails opened 4 years ago

guillaumeportails commented 4 years ago

I am used for years (X11 times) with focus following the mouse, instead of having to click to type (which is slow, and wears).

vscodebot[bot] commented 4 years ago
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle). Happy Coding!
Souravgoswami commented 4 years ago

This feature will be very handy particularly for Linux users like me who has the habit of enabling the focus follows mouse feature in the window manager...

As said clicking on the terminal is weird and slow. Editors like Geany has this feature to enable focus follows mouse setting. VSCode is not only about Windows, but it also supports Linux, Unix and Mac. It should have such feature, which will save a second each time I want to switch to the terminal or other parts within VSCode.

This is also mandatory in cases where you have selected a text, clicked on the terminal, and you can't modify the text without:

Most of the time, I ended up following point 2, which doesn't give me a good workflow...

Here's an example, you can't just move your mouse and press tab to indent the text: Screenshot from 2020-07-22 04-47-12

chapmanjacobd commented 4 years ago

This is not only a Linux issue but a Windows one as well

https://superuser.com/a/1209478/76968

benlk commented 4 years ago

It's also a Mac issue; Terminal.app has this as a configuration via the defaults interface: https://osxdaily.com/2011/04/18/terminal-focus-follow-mouse-mac/

seritools commented 3 years ago

Would love to see this!

Windows supports it (although it can only enabled via WinAPI or registry changes), Windows Terminal also supports it since 1.7. Now only VSCode needs it for switching focus between terminal(s), open editors, and the sidebar/toolbar elements.

RayKoopa commented 3 years ago

Would really like to see whatever pane being under the mouse pointer getting the focus. Got used to it a lot in Blender.

danky78 commented 3 years ago

I would love to have this. I use it for all my terminals and I always forget to click the integrated terminal in vscode, its very annoying. I know this must be a hard to implement feature. Thanks code team for the good work you are doing! :)

sysfsss commented 3 years ago

Clicking files in a multi-pane layout can lead to inadvertently moving selected text, or inadvertently canceling a text selection.

This feature would help correct these potential problems, and it would help VSCode fall better in line with Linux environments where focus-follows-cursor is heavily in use (as with https://github.com/i3/i3 and https://github.com/software-jessies-org/jessies/tree/master/terminator)

rossim2i2 commented 3 years ago

I have a super ultra wide monitor. with the terminal panel on the right side of the screen, this function would basically allow me to live in vscode.

mwaeckerlin commented 3 years ago

Yes, focus should strictly follow mouse between all sub windows! Not only between editor and terminal, but also between different editors and terminals and side bar.

asemic-horizon commented 2 years ago

+1 This is also an important usability feature for people on the move using trackpads who need to minimize their clicking due to RSI.

samkshah commented 2 years ago

This has been open for quite a while now. Anyone knows if it'll be worked on? Other duplicates have been closed, not this one 🤔

cu commented 2 years ago

I hope that it stays open as it is a feature I would really like to see.

danky78 commented 2 years ago

I would love it too. Im using external terminal because this.

El mié, 4 may 2022 a las 3:29, Charles Ulrich @.***>) escribió:

I hope that it stays open as it is a feature I would really like to see.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/93772#issuecomment-1116852752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFH52GKXIBLQKHX525ROKCTVIHHILANCNFSM4LWXQPQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

byehack commented 2 years ago

hold Ctrl and enable focus in sections by mouse moves. release Ctrl to back focus to the previous state.

citizenrich commented 2 years ago

hold Ctrl and enable focus in sections by mouse moves. release Ctrl to back focus to the previous state.

This doesn't work across the window, to go to the Terminal, for example.

byehack commented 2 years ago

This doesn't work across the window, to go to the Terminal, for example.

We can ignore release ctrl to back to previous state. btw I think hold a key and move mouse to active that state is the best solution.

hrafnkellbrimar commented 2 years ago

hold Ctrl and enable focus in sections by mouse moves. ~release Ctrl to back focus to the previous state.~

I think focus-follows-mouse functionality should be selectable as a persistent setting, having to press or hold down keys is not the same.

KeithHanlan commented 2 years ago

This is almost a safety issue. The number of times that I've started typing with my mouse in one window and focus in another is countless. One of these days, I'm going to hit the Del key while I think that I'm in an editor or terminal window and I'm going to nuke a file in the File Explorer where the Del key means "Delete permanently".

tjmcode commented 2 years ago

I have become so accustomed to 'focus-follows-mouse' in all other environments that it took me a few days to figure out why I was having issues with the Integrated Terminal!

clecap commented 1 year ago

For me the current solution unfortunately can only be not to use terminal windows in vscode but to use an external terminal. I am just done with destroying editor contents after moving the mouse into the terminal subwindow and forgetting to click.

Actually...I would have preferred to continue to use Atom...but this editor was killed by M$. :-(

mwerle commented 1 year ago

I just moved to a new company which largely uses VS Code as their development platform on Linux. So far, overall it's not bad, but the fact that focus doesn't follow mouse is a constant source of aggravation for me. I'm always typing terminal commands into my source-code or, worse (when working on a shell script) typing shell commands directly into the terminal.. it's only a matter of time before I rm -RF * in an important directory.

Please default Focus to OS settings and provide an override within VS Code for broken OS's or for people who want one behaviour on their Desktop and another within VS Code. Ie, options should be "Default Focus", "Focus follows Mouse", or "Click to Focus".

But seriously, this is a no-brainer to want to support, especially given the lack of hot-keys to switch between different panels (OT, but Ctrl-Alt- and some visible indicator as to what the active panel is would be nice..) .

josephtingiris commented 1 year ago

I would like to see this feature, too.

unixwzrd commented 1 year ago

it's only a matter of time before I rm -RF * in an important directory. ^

    • This... @mwerle said it.

I use the Vi/Vim editor extensions and vi mode on the command line in my shell. It's very efficient, same keys for editing text and my command history. The edit commands are muscle memory.

Outside of VSCode all my windows on macOS have "raise on focus" and "focus follows mouse". The raise isn't so important, but focus following the mouse from pane to pane would be great.

Because I use Vi mode on the command and in the edit panes, I can't count how many times I've moved the mouse from the editor into the terminal and begin typing and do potential damage to a file I was editing. What's worse is I may have 4 vertical panes open and go to enter commands on the command line and only after I've typed a bit notice nothing has echoed. Only to find I've just performed unknown edits to one of my edit panes and am not sure which one was active at the time. VSCode actually isn't too bad, I actually like it, but yeah, I guess I gotta change my workflow.

Please fix this before my finger suffers RSI, or I throw the keyboard and trackpad at my monitor. This can't be that difficult.

emogenet commented 1 year ago

Please add this. The behavior change between all the other windows on my desktop and the windows within VSCode basically make VSCode unusable for me.

Also, clicking on windows to be able to interact with them is sloooooooooooooooow, please give us that productivity boost.

GentleHumour commented 1 year ago

I just typed Ctrl-Q to quit out of Micro (don't judge me!) running in the integrated terminal (yes, I'm aware I have another text editor right there, but muscle memory) and accidentally quit VSCode because I forgot to click on the terminal to focus it. Needless to say, my productivity was impacted.

I would love it if the VSCode peeps could implement this feature.

oricou commented 12 months ago

I tried VS code few years ago, I gave up because I am too much used to have this option. I retried now, VS has plenty wonderful options, but I cannot work without focus follow mouse. So if you can add it, it would be very nice.

BBaoVanC commented 11 months ago

Add it.

Jesus, I could implement it over a weekend. Don't make me do it and embarrass you.

Why don't you do it then? That's the point of open source software. Nobody here is working for your hire.

Jeff-Bloom-US commented 11 months ago

Is there no persistent configuration setting for VS Code to enable the window focus to be "follows mouse"? Just learning VS Code and can't find anything. Found this thread that's over 3 years old. Apparently it's never been added/fixed. Not sure what the comment a ways back in time that says "moved to backlog" means. Is this getting fixed sometime?

GentleHumour commented 11 months ago

Is there no persistent configuration setting for VS Code to enable the window focus to be "follows mouse"?

Not yet.

Not sure what the comment a ways back in time that says "moved to backlog" means. Is this getting fixed sometime?

At least 20 people upvoted this issue in the Backlog Candidates to prevent it from being closed. It subsequently made it into the Backlog.

Aside: it's surprising to me that there is no search box for milestones. The backlog has about 4,000 issues open and 9,000 issues closed and it seems like the way you search this is by scrolling to the bottom for minutes at a time while they lazily load and then Ctrl-F. I'm still searching, TBH.

One of the other commenters suggested the current issue might be a weekend job. Indeed, how hard could it be? I was curious.

$ cd vscode/src
$ cloc .
    4343 text files.
    4310 unique files.                                          
     184 files ignored.

3 errors:
Line count, exceeded timeout:  ./vs/workbench/api/test/node/extHostSearch.test.ts
Line count, exceeded timeout:  ./vs/workbench/contrib/extensions/test/electron-sandbox/extensionRecommendationsService.test.ts
Line count, exceeded timeout:  ./vs/workbench/contrib/interactive/browser/interactive.contribution.ts

github.com/AlDanial/cloc v 1.90  T=9.18 s (453.9 files/s, 132103.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
TypeScript                    3721         166480         108335         864608
JavaScript                      50           1638           2544          31171
CSS                            222           4165           1503          18846
JSON                           114              1              0           6249
HTML                            16            423             34           2968
SVG                             28             24              9           1873
Bourne Shell                     4             54             65            295
zsh                              4             33             38            161
PowerShell                       1             19             45            131
Markdown                         3             34              0            125
Fish Shell                       1             21             49            121
LESS                             1              1              1              0
-------------------------------------------------------------------------------
SUM:                          4165         172893         112623         926548
-------------------------------------------------------------------------------
$ find . -name '*.ts' -exec grep -i focus {} /dev/null \; | grep -v test | wc -l
9514

She's a big 'un. And one of a couple of Microsoft projects where sloppy focus mode is a neglected feature.

Looking at those other issues reminds me: we need to specify that raising a focused window is a separate matter from focusing the window on hover. People who exclusively use Windows may be unaware of this. There are situations where you really don't want to raise that newly-focused VSCode window over the top of the application you're debugging, or whatever. Avoiding a flurry of window Z/layer management by clicking on stuff is one of the things we would like to avoid.

BBaoVanC commented 11 months ago

There are situations where you really don't want to raise that newly-focused VSCode window over the top of the application you're debugging, or whatever. Avoiding a flurry of window Z/layer management by clicking on stuff is one of the things we would like to avoid.

I wasn't even aware that VSCode has any floating windows/dialogs that could cause this issue, unless you're talking about the VSCode window itself at the OS level? I understand this feature request as referring to individual panes inside the VSCode window (anything else would be the OS/desktop environment's job).

Hate9 commented 10 months ago

There are situations where you really don't want to raise that newly-focused VSCode window over the top of the application you're debugging, or whatever. Avoiding a flurry of window Z/layer management by clicking on stuff is one of the things we would like to avoid.

I wasn't even aware that VSCode has any floating windows/dialogs that could cause this issue, unless you're talking about the VSCode window itself at the OS level? I understand this feature request as referring to individual panes inside the VSCode window (anything else would be the OS/desktop environment's job).

When you hover over a window at an OS level, and your desktop focuses-on-hover, the window is not raised, only focused, This means that you can enter text into it without raising the window. Without focus-on-hover for vscode, a user can't use this benefit for the terminal unless they had already clicked into the terminal before focusing a different window.

unixwzrd commented 10 months ago

There are situations where you really don't want to raise that newly-focused VSCode window over the top of the application you're debugging, or whatever. Avoiding a flurry of window Z/layer management by clicking on stuff is one of the things we would like to avoid.

That's why they are options, you don't want it, don't turn it on. I have ny workflow, you have yours, other people have theirs, whatever works for you. Options, people want options, I used to have virtual desktops in a 3x3 arrangement and would roll off the right, left, top, down and be on the adjacent desktop simply by pushing through the edge and wrapping. It worked for me, did everyone else like it, not really, but I was never more than 1 desktop away from any of the 9 I had set up.

I wasn't even aware that VSCode has any floating windows/dialogs that could cause this issue, unless you're talking about the VSCode window itself at the OS level? I understand this feature request as referring to individual panes inside the VSCode window (anything else would be the OS/desktop environment's job).

I did not know this either, will have to try it out, live and learn.

When you hover over a window at an OS level, and your desktop focuses-on-hover, the window is not raised, only focused, This means that you can enter text into it without raising the window. Without focus-on-hover for vscode, a user can't use this benefit for the terminal unless they had already clicked into the terminal before focusing a different window.

Focus-on-hover, focus-follows-mouse, raise-on-focus, raise-on-hover, then delay times for all to happen. If you don't like the options I have, I'm not going to force you to use them, my time delays and mouse-acceleration are probably not to your liking either, but you have a different workflow, everyone has their own workflow and the tool shouldn't slow me down.

Wanna know another thing the tool shouldn't do? Shoot me in the foot on a regular basis. I use "vi mode" in edit panes, when I'm outside VSCode, everything works the way I like it. I move the mouse over a window and it gets focus. I can't count the number of times I've moved my mouse from elsewhere on my desktop and last time I was in VSCode an edit panel was active with focus and I move back into VSCode, sliding the mouse over a terminal and start typing only to start wondering where my characters are going because latency isn't THAT bad, to noticing that one of my edit panels is active and has focus. Then trying to figure out what keys I hit or what mode the editor was in when I started typing... this happens on a regular basis. To compound that, there are two undo/redo buffers in the editor, one for "vi mode" and the other for undo/redo the OS provides, yeah that sucks too because they don't sync stacks.

I really wish they would fix this issue, maybe before I retire?

Hate9 commented 10 months ago

@unixwzrd Why does your reply (specifically your reply to me) read so defensive? I wasn't even responding to you, I was explaining to someone else why one might want the option.

Definitely on the same page with you though, I can't believe this isn't an option yet.

unixwzrd commented 10 months ago

@Hate9 wasn't directed at you directly, the "you" is the collective you. Just a bit frustrated with the fact that this "problem" has been here for more than 4 years. It really is about individual workflow though isn't it?

Be well...

rmcnew commented 6 months ago

I use "focus follows mouse" on both Windows and Linux. It is nice because I don't have to click, just move the mouse and start typing. It is very nice and easy-to-use.

Sadly, VS Code does not have a setting to support it. Ideally, it should focus whatever editor pane (from vertical or horizontal splits) or embedded terminal the mouse is over.

The workaround is to just create multiple VS Code windows for each file I am editing and use a separate terminal. It feels clunky and undermines the whole point of having VS Code support multiple editor panes and an embedded terminal.

zhuoqun-chen commented 3 months ago

Would really like to see whatever pane being under the mouse pointer getting the focus. Got used to it a lot in Blender.

May I ask how to set it up like this in blender?

unixwzrd commented 3 weeks ago

I use "focus follows mouse" on both Windows and Linux. It is nice because I don't have to click, just move the mouse and start typing. It is very nice and easy-to-use.

Sadly, VS Code does not have a setting to support it. Ideally, it should focus whatever editor pane (from vertical or horizontal splits) or embedded terminal the mouse is over.

The workaround is to just create multiple VS Code windows for each file I am editing and use a separate terminal. It feels clunky and undermines the whole point of having VS Code support multiple editor panes and an embedded terminal.

These are all fantastic points. Rhetorical question how does "mouse hover" work, and how is it so many extensions use it even if the window doesn't "officially" have focus?

I use it on macOS and have used focus-follows-mouse and raise-on-focus for many years, in Unix using X, Linux and X, Windows using some registry hack I believe, and macOS. This is embedded deeply in my cerebellum and is reflex from over 35 years of doing this. Not having this has caused me to hose things up quite a few times. This is the only application I have to move to the pane and click the mouse/trackpad/pointing device, and the application I spend the most time in it. It could really be a great app if some of the rough edges could be worked out, but it's the best that's available, so it's not like I'll find something else which can do as many things as VS Code does for me.

I know the panes are getting mouse over messages because I have seen them in BetterTouch Tool. Not only that there are so many extensions that use "mouse hover". I cannot fathom having the number of mouse-hover extensions and that giving the pane the mouse is in focus absolutely boggles my mind. This cannot be that difficult to implement, and if I didn't have other things to do, I'd do it myself, but that would mean learning the code base, JS and other things I have no time for.

Now that there is integrated AI like Codeium, Copilot and others, I cycle from edit pane, to AI chat, to terminal, to AI chat, to edit pane. Then there's selecting a file or something in the side bar, especially opening a new file. I select the file and it opens in the last active edit pane. Great, now I've clicked in the file explorer and then rather than being able to move directly and edit the file, I have to move to the pane where the file is open again and click there. Add the AI pane which I have attached to the right side of my VS Code window and I am clicking all over the place.

I tried using iTerm2 as a workaround for the integrated terminal problems I have at times, but I cannot get iTerm2 fully integrated, even though I've read plenty of places that it's simple to do. For some reason it refuses to work. Having iTerm2 would be great as that would allow me to never have to enter the integrated terminal and then my edit sessions would get focus when I move back into VS Code from iTerm2 and vice-versa. Problem is that iTerm2 does not work with the debugger.

The macOS ChatGPT app is in similar situation as how I use iTerm2, it sits off to the right side and if I want to use it, I move past Copilot or Codeium and it auto-raises and gets focus, which is outstanding, but I have to copy and paste to it, but at least no clicking. Move back to VS Code and it auto raises, but then I have to make sure I'm in the active pane or click in the pane to make it active, and no integration means copy and paste.

Apart from YouTube, having to go through my email, and playing with Stable Diffusion, this is the biggest source of frustration and waste of my time having to deal with this, it has cause me to make inadvertent edits to code which I have to figure out what I did and undo it once I notice my keystrokes are not going where I intended. All this creates the biggest source of frustration in my day, every day, multiple times a day.

If someone too a bit of time and actually implemented this, I have no doubt we would create a national holiday for you. Besides, it's my birthday this month, and I would love to get a really nice birthday present of focus follows mouse, so for FFS, FFM, someone please.

Sorry for the length, but this is my semi-annual post to this issue. My first was about two years ago, sorry for the length, but I feel better and I think I express a lot of the same frustration others feel with this.

Be well...