Skip to content
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

[GNOME Linux] No window decoration (shadow) if a window title bar style is custom #225073

Open
proninyaroslav opened this issue Aug 7, 2024 · 21 comments
Assignees
Labels
confirmation-pending electron Issues and items related to Electron info-needed Issue requires more information from poster titlebar VS Code main title bar issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) wayland Issue related to wayland display server
Milestone

Comments

@proninyaroslav
Copy link

proninyaroslav commented Aug 7, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.92.0
  • OS Version: Fedora 40 (GNOME 46)

Steps to Reproduce:

  1. Set window.titleBarStyle options to custom in the settings
  2. Run VSCode in the Wayland mode, for example, type it in the terminal:
$ ELECTRON_OZONE_PLATFORM_HINT=auto code

Expected behaviour

There should be a window decoration (shadow) as it is in XWayland compatibility mode:
image

Actual behaviour

There is no window decoration/shadow:
image

But If I set window.titleBarStyle to native, the window decoration/shadow appears:
image

@proninyaroslav proninyaroslav changed the title [Fedora Linux] No window decoration (shadow) window.titleBarStyle is custom [Fedora Linux] No window decoration (shadow) if window.titleBarStyle is custom Aug 7, 2024
@proninyaroslav proninyaroslav changed the title [Fedora Linux] No window decoration (shadow) if window.titleBarStyle is custom [GNOME Linux] No window decoration (shadow) if window.titleBarStyle is custom Aug 7, 2024
@proninyaroslav proninyaroslav changed the title [GNOME Linux] No window decoration (shadow) if window.titleBarStyle is custom [GNOME Linux] No window decoration (shadow) if a window title bar style is custom Aug 7, 2024
@proninyaroslav
Copy link
Author

Tested on 1.92.1, still has problem.

@proninyaroslav
Copy link
Author

proninyaroslav commented Aug 9, 2024

I noticed another fact: in Wayland mode, a new window opens as Visual Studio Code - URL Handler, and not as it should be (Visual Studio Code). Maybe this is the reason.

image

@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) electron Issues and items related to Electron titlebar VS Code main title bar issues wayland Issue related to wayland display server labels Aug 23, 2024
@sbatten sbatten assigned benibenj and unassigned sbatten Sep 11, 2024
@cbrnr
Copy link

cbrnr commented Sep 23, 2024

I can confirm the missing window decorations (i.e. shadows) when running on GNOME/Wayland when using the custom title bar style (the default). It would be really nice if this worked, because

  1. the native title bar is not an option for me (the layout shortcut buttons are missing and it takes up more space), and
  2. running via XWayland is also not an option, because I use fractional scaling (150%), which is very blurry in XWayland (but super crisp on Wayland).

Regarding the comment on "Visual Studio Code - URL Handler", I still haven't figured out why there are two desktop files, but you can at least fix the issue with two task bar entries (and/or missing icons) by setting StartupWMClass=code-url-handler in ~/.local/share/applications/code.desktop (create a copy of /usr/share/applications/code.desktop in that location and edit the copy in your home folder), see #129953 (comment) and #129953 (comment).

@proninyaroslav
Copy link
Author

@cbrnr
Yes, I was a little confused about URL Handler. I eventually found that even with the system window frame, VSCode still launched as URL Handler.

@jhasse
Copy link
Contributor

jhasse commented Sep 26, 2024

I think it's one of these upstream bugs and nothing VSCode could (or should) do itself about it:

@proninyaroslav
Copy link
Author

@jhasse
Well, as a workaround, we can add a border to at least somehow distinguish the window frame from the rest.

@cbrnr
Copy link

cbrnr commented Sep 26, 2024

However, Google Chrome does have borders and a shadow even though it is the basis of Electron (and it also has a custom title bar). So it might be worth looking into how they achieve this.

@proninyaroslav
Copy link
Author

@cbrnr
I confirm, I'm using a custom frame in Chrome and it has a shadow.

@benibenj benibenj added this to the Backlog milestone Dec 10, 2024
@deepak1556
Copy link
Collaborator

The shadow with native titlebar are from the CSD implementation in Electron. For the custom titlebar Electron shares the implementation with Chrome and based on https://issues.chromium.org/issues/40158897 there is no work actively being tracked in upstream. Closing as not actionable on our end.

@deepak1556 deepak1556 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
@cbrnr
Copy link

cbrnr commented Dec 17, 2024

@deepak1556 but wait, as I've mentioned previously, Chromium does have shadows when using a custom title at. Why not VS Code then?

@deepak1556
Copy link
Collaborator

@cbrnr
Copy link

cbrnr commented Dec 17, 2024

I don't understand. This issue is 3 years old and marked as obsolete, probably because it already works?

@proninyaroslav
Copy link
Author

@cbrnr
Most likely, distro package maintainers manually add a patch with client shadows.

probably because it already works

We can't say for sure until you learn the upstream source code.

@cbrnr
Copy link

cbrnr commented Dec 17, 2024

I'm pretty sure its in upstream, since I'm using Google Chrome and they don't add any patches AFAICS: https://aur.archlinux.org/packages/google-chrome

@proninyaroslav
Copy link
Author

Yes, you are right, they use packages compiled directly by the Google team.

@cbrnr
Copy link

cbrnr commented Dec 17, 2024

@deepak1556 can you reopen this issue please until it is clear if there's anything that could/should be done?

@deepak1556
Copy link
Collaborator

The custom titlebar implementation in Electron https://github.com/electron/electron/blob/main/shell/browser/ui/views/opaque_frame_view.cc is pulled from https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/views/frame/opaque_browser_frame_view.h which is the custom titlebar implementation for Chrome. The closest CL I could find related to this was https://chromium-review.googlesource.com/c/chromium/src/+/2901661 and it doesn't enable in OpaqueBrowserView.

I will reopen to confirm the behavior with dPWA on linux

@deepak1556 deepak1556 reopened this Dec 18, 2024
@deepak1556 deepak1556 added info-needed Issue requires more information from poster confirmation-pending and removed bug Issue identified by VS Code Team member as probable bug labels Dec 18, 2024
@cbrnr
Copy link

cbrnr commented Dec 19, 2024

Thanks @deepak1556, let me know if there is anything I can do to help!

@vangohao
Copy link

Observing this problem in KDE plasma 6.2.4 with X11. VSCode version 1.96.2

@proninyaroslav
Copy link
Author

We can do it the way it is done in Intellij IDE: add a border that visually separates the window from the background

Image

@proninyaroslav
Copy link
Author

proninyaroslav commented Mar 6, 2025

The Rounded Window Corners Reborn extension for GNOME seems to workaround this issue:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmation-pending electron Issues and items related to Electron info-needed Issue requires more information from poster titlebar VS Code main title bar issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) wayland Issue related to wayland display server
Projects
None yet
Development

No branches or pull requests

7 participants