user19143765
user19143765

Reputation:

The web browser opens attached to VSCode (Ubuntu and Live Server)

I am trying to configure Visual Studio Code (in Ubuntu 22.04) and Live Server extension (Ritwick Dey). When I run Live Server, it opens a new window of my web browser (Firefox) that it attaches with VSCode as a new window. I want the Live server to open a Firefox BUT non attached with VSCode. And, if Firefox is already open, it opens the page in a new tab. Is it possible ? Is there any workaround ? Thank you.

Upvotes: 1

Views: 1102

Answers (1)

user19143765
user19143765

Reputation:

Voila, I found a solution.

I started by uninstalling Firefox, and I installed the Developer Edition (optional).

To create the icon, I created a file .local/share/applications/firefox_dev.desktop, in which I added:

[Desktop Entry] 
Name=Firefox Developer Edition 
GenericName=Firefox Developer Edition 
Exec=/opt/firefox/firefox %u --class firefox 
terminal=false 
Icon=/opt/firefox/browser/chrome/icons/default/default128.png 
Type=Application 
Categories=Application;Network;X-Developer; 
Comment=Firefox Developer Edition 
StartupWMClass=firefox 

Then I added the launch to the dock.

Then I set Firefox as my default browser.

Then I launched VSCode and Liver Server... This added a new .local/share/applications/userapp-Firefox Developer Edition-***.desktop file. I stopped the server and closed VSCode.

In this file I replaced the code by:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=/opt/firefox/firefox-bin %u --class firefox
Name=Firefox Developer Edition
Comment=Firefox Developer Edition

Now :

  • I have the correct icon showing in the Ubuntu sidebar,
  • when I launch Firefox it doesn't open/create a new icon in the dock,
  • when I launch Live Server in VSCode it launches in the browser...
  • ...and, if the browser is open, it creates a new tab, not a new window.

++

Upvotes: 1

Related Questions