microsoft/vscode

Close, minimize and maximize buttons missing on macOS after using the restart to update option

TomCaserta opened this issue ยท 55 comments

Does this issue occur when all extensions are disabled?: No (but presumably due to restart of VSCode)

  • VS Code Version: 1.71.2 (updating from 1.70.X)
  • OS Version: macOs Monterey 12.5.1 (21G83)

As stated in the issue title, once VSCode updates and restores the windows it fails to show the close/maximize/minimize icons:

Screenshot 2022-09-23 at 13 25 39

This does not happen on all restored windows. The one showing the buttons was previously in fullscreen mode.
Screenshot 2022-09-23 at 13 26 53

I imagine it is difficult to replicate this issue so I will list out exactly the steps I took regardless of if I think they are relevant.

Steps to Reproduce:

  1. Have multiple VSCode windows open. One on the 'desktop' (ie. not fullscreen mode) and one maximised (fullscreen mode).
  2. See the notification for the latest update and dismiss it
  3. Open the command pallet and manually select the 'Restart Code to update' option
  4. Wait for VSCode to restart

Outcome:

  • The maximized (full screen mode) windows all have the ability to minimize/control the window as expected
  • The windows that were not in full screen mode no longer have the ability to control the window as the top toolbar is hidden.
  • Using shortcut keys CTRL + CMD + F to enter fullscreen mode works on the window with the toolbar but not the one that restarted minimized

I believe #160328 is somewhat related however restarting VSCode gets rid of the issue.

I have the same problem. As I (almost) always maximize all my windows, there is always one (and only one) window without the buttons. Coincidently, that windows was exactly the one where I clicked the restart to update button.

The largest window doesn't have buttons. Reload that window can bring buttons back.
image


Received an update again. It seems the first window being opened after restart will lose the button.

cip8 commented

I experience the same issue with vscode-insiders in Windows 11 (w/ WSL2):

vscode-err

PS: Restarting the app (or the OS) didn't fix the issue.

Dito after the vscode insiders updated itself, i don't see the close/maximize/minimize buttons any more on the toolbar.
image

Im having the same problem! Is this a bug?

image

This issue is for macOS.
For the issue on Windows, see #165337.

Same issue for me in Arch Linux:

image

Since this issue ticket is related to MacOS, I opened #165481 for Arch Linux. I noted that the issue is related to electron19 19.1.4 version. Downgrading it to 19.0.13 and restarting Code, the three buttons are shown.

I don't know if also on MacOS, Code uses Electron...

Yes it does

@TomCaserta can you check if the issue is present with latest stable 1.74

@TomCaserta can you check if the issue is present with latest stable 1.74

On my side it is working after a sudo pacman -Syyu full upgrade on Arch Linux:
image

also getting the same issue with my ubuntu 22.10 machine, and i was thinking that this was a Linux issue LOL ๐Ÿฅฒ

@rzhao271 are you able to repro this issue ?

@TomCaserta if you are able to repro the issue, can you start the application with --verbose --log="trace" and attach the logs.

I was unable to repro the issue using Insiders on macOS Monterey 12.6.2 with the custom titlebar.

Same issue on latest version macOS Ventura. Any fix available ?

I had the same issue on Ventura 13.0.1
Solved it by move the window to the new desktop environment and then do cmd + shift + p -> Developer: Reload Window

@Aviral-Gupta101 @jodi-ivan can you provide the logs per this comment #161586 (comment), thanks!

@deepak1556 I tried but it didn't worked for me. Adding on to this from last week onwards I occasionally see the close, minimise and maximize button to show up in full screen mode but its stuck over ( does not hide when mouse focus is not on that ) and this comes over the top menu bar so I have to again minimize and maximize the window in order to make menu bar again visible but still the same issue persist, Thanks!

I have the same problem. As I (almost) always maximize all my windows, there is always one (and only one) window without the buttons. Coincidently, that windows was exactly the one where I clicked the restart to update button.

The largest window doesn't have buttons. Reload that window can bring buttons back. image

Received an update again. It seems the first window being opened after restart will lose the button.

@tautomer, sorry for the unrelated comment, but I'm really curious about the theme you are using. Thanks!

I have the same problem. As I (almost) always maximize all my windows, there is always one (and only one) window without the buttons. Coincidently, that windows was exactly the one where I clicked the restart to update button.
The largest window doesn't have buttons. Reload that window can bring buttons back. image
Received an update again. It seems the first window being opened after restart will lose the button.

@tautomer, sorry for the unrelated comment, but I'm really curious about the theme you are using. Thanks!

https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme

One Dark Pro Darker in the pack

image

I have the same issue.

@eisa-rezaei what version of VS Code are you using? That appears like a different issue.

@eisa-rezaei what version of VS Code are you using? That appears like a different issue.

It's the latest version.

It's been 5 months since I first reported this issue (#160328)

@deepak1556 Can we get an update on whether this is being looked into and when a patch might arrive?

Latest version, macos, just now:
image

I have this error reliably if using Cmd-Shift-W to close the workspace if it is the only workspace currently open. The only way to recover the bar is to force quite VSCode and restart.

I'm still unable to reproduce the issue on the latest VS Code Insiders on macOS Monterey. I also tried the steps from #161586 (comment).
@calumx, here are my steps so you can see if I'm missing a setup:

  1. Open VS Code Insiders. The custom titlebar shows the traffic lights.
  2. Open a workspace. Optionally, click the green traffic light to maximize the window.
  3. Press Cmd+Shift+W to close the workspace.
  4. Press the VS Code Insiders icon in the dock to open VS Code Insiders again.
  5. The custom titlebar shows the traffic lights.

@blakegearin can you provide the logs following the steps at #161586 (comment)

@blakegearin can you provide the logs following the steps at #161586 (comment)

Here you go: https://gist.github.com/blakegearin/d84ca42aac2b936d5caf2730150d9f5a

Replicated on both 1.73.0 and 1.75.1. Copied all logs as soon as the behavior was visible.

This is an older device running macOS 11.5.2 (Big Sur).

Since these logs contain personal information about my device & account, please let me know when you've copied or downloaded them so I can delete this gist for privacy.

Thanks for the logs, interesting part would be

[main 2023-02-23T02:12:33.262Z] window#validateWindowState: validating window state on 1 display(s) {
  mode: 3,
  display: 2077750265,
  width: 1024,
  height: 768,
  x: 328,
  y: 141
}
[main 2023-02-23T02:12:33.262Z] window#validateWindowState: 1 monitor working area { x: 0, y: 25, width: 1680, height: 939 }
[main 2023-02-23T02:12:33.262Z] window#ctor: using window state {
  mode: 3,
  display: 2077750265,
  width: 1024,
  height: 768,
  x: 328,
  y: 141
}

mode: 3 indicates we are trying to restore a fullscreen window but the width and height values indicate we are falling back to default window dimensions

width: 1024,
height: 768,
, seems like this state combination is possible if we had run this block
const defaults = defaultWindowState(WindowMode.Fullscreen); // make sure we have good values when the user restores the window
. @bpasero what would be good next step here ? If state.display is not in the current set of displays and user is trying to restore in fullscreen mode, should we instead restore in normal mode ?

@blakegearin did you previously have another display connected when entering fullscreen and the issue started since you had disconnected the display ?

@blakegearin did you previously have another display connected when entering fullscreen and the issue started since you had disconnected the display ?

I mean, I have an external display but haven't used it with this laptop in many months. Pretty sure I haven't plugged it in since the issue started. Certainly wasn't using it when replicating.

Yeah this is a state that has been persisted since your previously display got disconnected, I think we can validate this if we delete the existing persisted configuration. Try the following,

  1. Launch from terminal with the flag --user-data-dir /tmp/vscode-fullscreen-test
  2. Copy your settings from previous instance
  3. Enter fullscreen and quit the application
  4. Reopen the application with same flag as 1)
  5. Verify application enters fullscreen correctly
  6. Verify opening a new window has window controls
  7. Try different variations of step 3) to 6) using the same --user-data-dir /tmp/vscode-fullscreen-test and see if you are able to repro the issue.

If the display cannot be found from the previous session and the mode was Fullscreen, why would we not restore fullscreen on the primary display?

Btw I cannot really reproduce an issue here running out of sources. When I explicitly put a invalid number for display and restart, fullscreen still restores.

What are the exact steps to reproduce this issue?

For me the steps are simple:
I have a 3 monitor setup, both at work and at home.
I always use VSCode (and insiders), with multiple windows, open in more than one monitor, but never at the 3 of them.
When a new update requires it to restart, the window always comes back without the traffic lights.
I believe it must have something with the settings being saved at my home, and trying to restore them at my work env.

No, the window state is not synchronised across machines, it will be unique per machine. But possibly display identifiers do change so we may be running into the case where a display cannot be found. But from my testing, that did not seem to result in an issue, though I only tried with a single display connected.

electron/electron#35360 is somewhat related: I think the gist of this issue is that we THINK the window is in fullscreen mode (and thus remove the window buttons) but the window is actually NOT in fullscreen mode. Our heuristic for figuring that out might not cover all the cases.

I use the same Mac in both office and home, so there's no sync'ing.

Ah yeah, then its possible that display identifiers are different.

electron/electron#35360 is somewhat related: I think the gist of this issue is that we THINK the window is in fullscreen mode (and thus remove the window buttons) but the window is actually NOT in fullscreen mode. Our heuristic for figuring that out might not cover all the cases.

That is what I said back in September: #160328 (comment)

mode: 3 indicates we are trying to restore a fullscreen window but the width and height values indicate we are falling back to default window dimensions

Btw, this is not accurate: we still set a width and height even when fullscreen mode is on specifically to have a size to go back to when leaving fullscreen mode. Here we probably pick a default size because we cannot validate the display that is passed in.

Wouldn't it be a better to fall back to the current screen dimensions instead of persisted values in this case?

Can someone please point me to the actual location of the persisted values? Maybe editing them to proper values avoids this issue for now.

same issue, restart vscode not solving the problem

@bpasero which file in the user data dir holds the persisted configurations ? I think users currently suffering can delete it as temporary workaroud.

It is User/globalStorage/storage.json and the key is windowsState

same issue, restart vscode not solving the problem

What I usually do that fixes is going to: Window > Tile Window to Left of Screen and then the traffic lights reappears. Then it's just a matter of maximising it again.

Same problem encountered

I encountered the same problem. Dual monitor. But...at the same time, I cannot quit vscode.
"Quit Visual Studio Code" option from menu does nothing.
I tiled windows to the left, which got some weird behavior (a fully black, full screen window, and no way to access vscode at all), but reloading the folder closed that black screen and opened it normally. Note, the window disappeared from the "Window" dropdown menu when I tiled it, so all weird, all around.

image

I have the same issue.
image

Previous issue has been resolved, but there is another issue, the placement of app tools in the right in older versions it was in the left like the other app tools.

The issue doesn't seem to be resolved for me, @eisa-rezaei. Still happens several times a week. @eduelias "Tile Window..." fix has been working for me so far.

The issue doesn't seem to be resolved for me, @eisa-rezaei. Still happens several times a week. @eduelias "Tile Window..." fix has been working for me so far.

I was using the insider version of vscode it was working as expected, and recently I changed my vscode to stable version, and it was resolved there too, try the insider version see if it's working correctly for you or not or check if the current version is up-to-date.

I encountered this issue again several times on a fresh VS Code install on a brand new machine. Since it's never been plugged into an external display, it seems this is not a necessary element for the issue to occur.

Version: 1.79.2
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:58:33.551Z (1 wk ago)
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.4.0
eedea commented

Previous issue has been resolved, but there is another issue, the placement of app tools in the right in older versions it was in the left like the other app tools.

I guess your first choice in preferred language in System Preferences>Language & Region is a RTL language!? So changing it to a LTR one is a workaround until they fix the issue.

I encountered this issue again today. However, it is happening far less frequently since my last comment (5th June) - in fact this was the first time it happened in several weeks.

For anyone else encountering this issue (because I still hit it on every update), this comment from @deepak1556 fixes the issue for me:

Can you try deleting the key windowsState in ~/Library/Application\ Support/Code/User/globalStorage/storage.json and restart the application, see if that helps as a workaround.

What I usually do that fixes is going to: Window > Tile Window to Left of Screen and then the traffic lights reappears. Then it's just a matter of maximising it again.

This is the easiest "solution" I've found.