Skip to content

[Desktop] Window state is reset to default on every launch #15165

Closed

Description

@presire

Description

Describe the bug

The .window-state.json file is always reset to default values when OpenCode Desktop launches. Custom window size and position settings are not persisted.

Steps to reproduce

  1. Launch OpenCode Desktop
  2. Resize and reposition the window
  3. Close OpenCode Desktop completely
  4. Check ~/.config/ai.opencode.desktop.dev/.window-state.json - custom values are saved
  5. Launch OpenCode Desktop again
  6. Window opens with default size (800x600, maximized: true)
  7. Check .window-state.json - values are reset to defaults:
{
  "main": {
    "width": 800,
    "height": 600,
    "x": 80,
    "y": 0,
    "prev_x": 80,
    "prev_y": 0,
    "maximized": true,
    "visible": true,
    "decorated": true,
    "fullscreen": false
  }
}

Display: 4K (3840x2160) with 125% scaling
Config path: ~/.config/ai.opencode.desktop.dev/.window-state.json

Expected behavior

Window size and position should persist across sessions. The .window-state.json values should be read and applied on launch.

Actual behavior

Window state is reset to hardcoded defaults on every launch, ignoring .window-state.json.

Additional context

This may be related to Tauri's window-state plugin not correctly reading the saved state file, or the state being overwritten before the window is created.

Plugins

No response

OpenCode version

1.2.14

Steps to reproduce

  1. Close OpenCode Desktop completely (ensure no process is running)
  2. Launch OpenCode Desktop
  3. Resize the window to a custom size (e.g., drag to make it 1400x900)
  4. Move the window to a different position
  5. Unmaximize the window if it was maximized
  6. Close OpenCode Desktop
  7. Open ~/.config/ai.opencode.desktop.dev/.window-state.json and verify custom values are saved:
    {
      "main": {
        "width": 1400,
        "height": 900,
        "x": 836,
        "y": 414,
        "maximized": false,
        ...
      }
    }
  8. Launch OpenCode Desktop again
  9. Observe: Window opens maximized at default size (800x600)
  10. Check ~/.config/ai.opencode.desktop.dev/.window-state.json again
  11. Observe: File content is reset to defaults:
{
 "main": {
   "width": 800,
   "height": 600,
   "x": 80,
   "y": 0,
   "prev_x": 80,
   "prev_y": 0,
   "maximized": true,
   "visible": true,
   "decorated": true,
   "fullscreen": false
 }
}

Screenshot and/or share link

No response

Operating System

openSUSE Leap 15.6 / 16, SUSE Linux Enterprise 15 SP6, SP7

Terminal

No response

Activity

  1. jfseaman commented on Feb 27, 2026

    @jfseaman

    Solution for maintainer.

    for 1.2.15 at line 60 of windows.rs there is an explicit .maximized(true)

    Remove this and the application will start in the the same state it was last closed.

    Justification, that is what every other application does so it is standard.

  2. jfseaman commented on Feb 27, 2026

    @jfseaman

    For Windows the proposed fix also has the benefit of fixing the creation of the mainwindow maximized then resized. Instead it is created the appropriate size. Less "flashing". Less "mess".

  3. jfseaman commented on Apr 3, 2026

    @jfseaman

    This bug exists for all version to current.

    It is annoying as heck that the Linux build behaves different from every other application on the planet.

    The app should start in the same state it was when last closed. That is the behavior of all other environments. It is the standard.

    It is a one line change at line 60 of windows.rs.

  4. jfseaman commented on Apr 4, 2026

    @jfseaman

    It's a one line change to packages/desktop/src-tauri/src/windows.rs at line 60.

    Just comment it out.

    I have built and tested it on every platform except Apple silicon which does not have the issue.

    It only affects Linux builds.

  5. removed
    bugSomething isn't working
    webRelates to opencode on web / desktop
    on May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions