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

Improve integrated titlebar buttons on macos #4727

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yuraiz
Copy link
Contributor

@yuraiz yuraiz commented Dec 28, 2023

Screen.Recording.2023-12-29.at.15.47.24.mov

I found a way to move traffic lights, it seems to work as I want to, but needs some improvements

TODO:

  • Correctly refresh buttons every time it's needed
  • Handle not only the fancy variant
  • Check how it works with other preferences
  • Handle RTL
  • Correctly handle the margin for the window buttons in the tab bar code

@yuraiz yuraiz force-pushed the macos-titlebar-improvements branch 2 times, most recently from 540e442 to 95b7faa Compare December 29, 2023 12:46
@micsama
Copy link

micsama commented Jan 8, 2024

its good!

@micsama
Copy link

micsama commented Jan 9, 2024

will it be merge? its looks cool

@yuraiz
Copy link
Contributor Author

yuraiz commented Jan 9, 2024

will it be merge?

It isn't finished yet and not even ready for review

@yuraiz yuraiz force-pushed the macos-titlebar-improvements branch from 95b7faa to ba8aa32 Compare October 1, 2024 19:29
@yuraiz yuraiz force-pushed the macos-titlebar-improvements branch from 843e3f5 to 4ea0549 Compare October 1, 2024 21:03
@yuraiz
Copy link
Contributor Author

yuraiz commented Oct 1, 2024

Now I don't see any bugs, but probably not every case is handled or some of them handled incorrectly.
I think PR is mostly ready. I'll check how I want to use it with fancy_title_bar = false, maybe it's better to just hide the native buttons in that case.

RTL is handled:

Screenshot 2024-10-01 at 23 55 25

For testing I enabled rtl using the following code inside of the app:

// somewhere in window/src/os/macos/window.rs
 unsafe {
    let user_defaults = <id as cocoa::foundation::NSUserDefaults>::standardUserDefaults();

    cocoa::foundation::NSUserDefaults::setBool_forKey_(
        user_defaults,
        YES,
        *nsstring("AppleTextDirection"),
    );
    cocoa::foundation::NSUserDefaults::setBool_forKey_(
        user_defaults,
        YES,
        *nsstring("NSForceRightToLeftWritingDirection"),
    );
}

(applies after restart, call with NO to disable).

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.

2 participants