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

Window closing does not work #226

Open
Neyl-123 opened this issue Nov 30, 2024 · 4 comments
Open

Window closing does not work #226

Neyl-123 opened this issue Nov 30, 2024 · 4 comments

Comments

@Neyl-123
Copy link

Neyl-123 commented Nov 30, 2024

Describe the bug
Closing the window with the "Quit" button as well as the "X" button on GNOME does not actually close the window.

Desktop:

  • OS: Fedora Linux 40 (Workstation Edition) and Windows 10
  • Version 0.6.2

Additional context
I can close the window only when I terminate the process.
Happens consistently both on Windows and Linux with GNOME (both Wayland and X11).

@Neyl-123
Copy link
Author

Neyl-123 commented Dec 2, 2024

From apps/desktop/src-tauri/src/main.rs:

  app
    .build(tauri::generate_context!())
    .expect("An error occured while running the app!")
    .run(|app, event| {
      if let tauri::RunEvent::WindowEvent {
        event: tauri::WindowEvent::CloseRequested { api, .. },
        label,
        ..
      } = event
      {
        if label == SETTINGS_WINDOW_NAME {
          let win = app.get_webview_window(label.as_str()).unwrap();
          win.hide().unwrap();
        }


        api.prevent_close();
      }
    });

When overlayed gets a Window CloseRequested why does it just flat out prevent the close?

@Neyl-123
Copy link
Author

Neyl-123 commented Dec 2, 2024

On GNOME the "App Indicators" or "Tray Icons" are not shown by default. If overlayed is in it's pinned state the user has no access to togging the pinned status or quitting the application. Quitting works with the "Quit Overlayed" button that is displayed if there is a error connecting to discord or with the "Quit" button from the Tray Icon and both are not always displayed. The proper way to handle this would probably be to add a toggle button to the GNOME Quick Settings Menu, which would need some effort. Regardless of Tray Icons vs Quick Settings the "Quit" button from the dash (the menu bar on the bottom with your pinned and open applications) and the "X" button you get from hovering over the window in the window overview should work and actually close the window. Maybe even add an "X" button to the right of the settings button just as the settings window already has one.

@PhantomShift
Copy link

From apps/desktop/src-tauri/src/main.rs:

        if label == SETTINGS_WINDOW_NAME {
          let win = app.get_webview_window(label.as_str()).unwrap();
          win.hide().unwrap();
        }

        api.prevent_close();

When overlayed gets a Window CloseRequested why does it just flat out prevent the close?

Looking at this bit in particular, I feel like the intended behavior is for it to only call prevent_close() when it's coming from the settings window, but for some reason it was left out of the if block.

Using the following code instead seems to make it work as expected but I have not set up a PR since I'm not sure if this is the intended behavior or if what is already present is desired.

        if label == SETTINGS_WINDOW_NAME {
          let win = app.get_webview_window(label.as_str()).unwrap();
          win.hide().unwrap();
        }
        // Only close if it's the main window that received the close request
        if label == MAIN_WINDOW_NAME {
          app.exit(0);
        } else {
          api.prevent_close();
        }

Neyl-123 added a commit to Neyl-123/overlayed that referenced this issue Dec 9, 2024
See Issue overlayeddev#226 in upstream repo
@PhantomShift
Copy link

I will note (on KDE at least) that this issue prevents the desktop from shutting down by itself because overlayed has to be closed manually/force closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants