Reputation: 1227
I have found multiple discussions complaining about OpenFile dialog window of VSCode open in background, so you need to use your mouse pointer to bring it up, which is kind of annoying, but did not found a solution. Is this a bug or unpleasant feature? Any solution?
I am using
Version: 1.71.2
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:12:14.256Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.15.0-48-generic
Sandboxed: No
On Ubuntu 20.04.
Upvotes: 15
Views: 5632
Reputation: 52334
This was a known issue and should be fixed in the May 2024 (v1.90) release of VS Code (see Pull Request chore: bump [email protected] #213050).
Upvotes: 1
Reputation: 2126
The workaround I use is this one. vscode opens the dialog for local file edits but uses a simple menu for remote file edits (which avoids the whole problem). So I just set vscode to use simple menu all the time.
I just set the setting Files -> Simple Dialog = true
Upvotes: 17
Reputation: 165
If you're on GNOME
, try installing and enable the below extension.
Upvotes: 2
Reputation: 51
I combined three workaround (including the workaround from and vladimir ulianitsky) into one answer that fixed this for VSCode Chrome browsers and Typora app that were having this issue for me. All three were necessary for me to fix the issues in my programs.
The one missing from this page for VScode is installing the gnome extension "Grand Theft Focus" to focus dialog windows for Visual Studio Code.
Here is a link to the complete three workaround answer.
Upvotes: 5
Reputation: 136
I figured out how to create a workaround using this instruction
I created a file ~/.config/devilspie2/code.lua
with the following content:
if (get_application_name() == 'code' and get_window_role() == 'GtkFileChooserDialog') then focus_window() center(); end
Upvotes: 6
Reputation: 11
Another workaround to run the latest version 1.72.2 on ubuntu 20.04 with on openFile dialog in foreground (to date the bug is still not fixed) is to add the environment variable GTK_USE_PORTAL=1 when running vscode, in your bash:
> GTK_USE_PORTAL=1 code
Also, you can create a new desktop launcher, that you can add it to your task bar, in ~/.local/share/application/vscode.desktop
:
[Desktop Entry]
Name=VSCode
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=env GTK_USE_PORTAL=1 /usr/share/code/code --unity-launch %F
Icon=com.visualstudio.code
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
Exec=env GTK_USE_PORTAL=1 /usr/share/code/code --new-window %F
Icon=com.visualstudio.code
Upvotes: 1
Reputation: 2768
It is an upstream issue and I am facing the same. The best-known solution to me is to downgrade the vscode from v1.71.2
to v1.67.2
No fix has been made to date as mentioned here.
Upvotes: 2