Skip to content

Desktop: Fix double-clicking top bar not toggling maximize in linux#3869

Closed
he1senbrg wants to merge 1 commit intoGraphiteEditor:masterfrom
he1senbrg:fix-linux-maximize
Closed

Desktop: Fix double-clicking top bar not toggling maximize in linux#3869
he1senbrg wants to merge 1 commit intoGraphiteEditor:masterfrom
he1senbrg:fix-linux-maximize

Conversation

@he1senbrg
Copy link
Contributor

Before

maximize_before.mp4

After

maximize_after.mp4

Closes #3594

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue preventing users on Linux from maximizing or restoring application windows by double-clicking the title bar. It introduces a custom event handling logic to accurately detect double-click gestures, ensuring consistent window management behavior across different desktop environments and closing issue #3594.

Highlights

  • Linux Double-Click Maximize Fix: Implemented a custom double-click detection mechanism on the window title bar to correctly toggle window maximization on Linux, addressing an issue where the native dblclick event was not reliably firing.
Changelog
  • frontend/src/components/window/TitleBar.svelte
    • Replaced the native on:dblclick event with a custom on:mousedown handler to detect double-clicks for window maximization.
    • Introduced a lastMouseDown state variable to track click timing for the custom double-click logic.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue where double-clicking the top bar did not toggle maximization on Linux by implementing a manual double-click handler. The approach is sound. I've left a couple of comments with suggestions for improvement: one to fix a minor bug where a maximized window could be dragged, and another to improve code readability by removing a magic number.

if (isFullscreen) return;

const now = Date.now();
if (now - lastMouseDown < 500) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider extracting the magic number 500 into a constant at the component level, for example const DOUBLE_CLICK_THRESHOLD_MS = 500;. This improves readability and maintainability.

Copy link
Contributor

@0HyperCube 0HyperCube Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Sir or Madame Gemini Code Assist Bot,

Double click timing can be adjusted by the operating system for accessibility for people with reduced motor function.

The browser will automatically deal with this and report a double click event when appropriate; it can be bound using on:dblclick.

I would expect any fairly competent LLM to take this into account. I hope that will improve your code assistant capabilities as they are currently quite lacking.

Yours faithfully,
Hypercube

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0HyperCube What should I do, I believe the desktop app uses a fixed interval for detecting multi click across the app. This doesn't appear to follow OS settings either. Should I just use this approach only on linux and let other platforms use on:dblclick?

desktop/src/cef/consts.rs

pub(crate) const MULTICLICK_TIMEOUT: Duration = Duration::from_millis(500);

editor.handle.appWindowMaximize();
} else {
lastMouseDown = now;
editor.handle.appWindowDrag();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the window is maximized, a single click on the title bar shouldn't initiate a drag. This can be prevented by adding a check for $appWindow.maximized before calling appWindowDrag().

if (!$appWindow.maximized) editor.handle.appWindowDrag();

@timon-schelling
Copy link
Member

This needs to be implemented in desktop code. dblclick event should be fired by cef. we need to figure out why it's not doing that on some linux systems. could you check what happens with different double click intervals configured on you system? can't reproduce the issue on any of my Linux systems.

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

Successfully merging this pull request may close these issues.

Double-clicking top bar doesn't toggle maximize (Linux)

3 participants