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

Invalid windowstate could make the app invisible #52

Open
3 tasks done
kittaakos opened this issue Feb 26, 2021 · 1 comment
Open
3 tasks done

Invalid windowstate could make the app invisible #52

kittaakos opened this issue Feb 26, 2021 · 1 comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

kittaakos commented Feb 26, 2021

Describe the problem

We use electron-store to store data such as the coordinates of the Arduino IDE window position on the user's screen. For example:

{
	"windowstate": {
		"isMaximized": false,
		"width": 968,
		"height": 781,
		"x": -20,
		"y": 1394
	}
}

The window is positioned at the stored coordinates when it is opened in subsequent IDE sessions. This is done blindly without any validation of whether the coordinates are within the actual dimensions of the display.

🐛 If the stored window coordinates are at a position outside the current display's dimensions, the IDE window will not be visible to the user.

To reproduce

  1. Select File > Quit from the Arduino IDE menus if it is running.
  2. Use any text editor to open the file at the following path:
    • If you are using Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\config.json
      
    • If you are using Linux:
      /home/<username>/.config/arduino-ide/config.json
      
    • If you are using macOS:
      /Users/<username>/Library/Application Support/arduino-ide/config.json
      
  3. Delete the workspaces key and all the data it contained.
    This is done for the sake of making the demonstration easier to perform, but the fault will also occur if the data in the workspaces contains invalid coordinate data.
  4. Change the value of isMaximized to false
  5. Change the value of windowstate.x to 9999
  6. Change the value of windowstate.y to 9999
  7. Save the file.
  8. Start Arduino IDE.

🐛 The IDE window is not visible.

Expected behavior

Arduino IDE window is always placed at a location within the active display dimensions on startup.

Arduino IDE version

Original report

Arduino Pro IDE 0.1.4

Last verified with

e17472e

Operating system

Windows 10

Additional context

It is not known how the invalid configuration is produced in real world usage. It might occur if the user changes their display configuration in a way that makes a previously valid window coordinate no longer valid. That might either be caused by a reduction of the display resolution:

  • Changing the resolution setting (e.g., change magnification as described here)
  • Changing to a lower resolution monitor (e.g., switching from using a large external monitor to the built-in monitor of a laptop)
  • Switching from using multiple monitors to using a single monitor

Originally reported at arduino/arduino-pro-ide#444 (comment)

Workaround

Delete the file at the following location (where <username> is the username of your operating system account):

  • If you are using Windows:
    C:\Users\<username>\AppData\Roaming\arduino-ide\config.json
    
  • If you are using Linux:
    /home/<username>/.config/arduino-ide/config.json
    
  • If you are using macOS:
    /Users/<username>/Library/Application Support/arduino-ide/config.json
    

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details### Describe the problem
@rsora rsora transferred this issue from arduino/arduino-pro-ide Mar 1, 2021
@kittaakos kittaakos changed the title Invalid windowstate could make the app insible Invalid windowstate could make the app invisible Mar 2, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 29, 2021
@kittaakos
Copy link
Contributor Author

kittaakos commented Aug 1, 2023

Here is a workaround if the issue happens. Open the electron-store JSON file in your favorite text editor:

  • On macOS, it's at ~/Library/Application\ Support/arduino-ide/config.json.
  • On Windows it's at C:\Users\<username>\AppData\Roaming\arduino-ide\config.json where <username> is your Windows username.

The x and y properties are pixel positions on the screen. You cannot see the window if the coordinates are too large or negative. Try to set them to 0 and start IDE2. You can delete this config file if you can not see the sketch in the window. It stores window dimensions and previously opened sketches. Nothing more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants