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

top level (floating) window on macos #4566

Closed
rawnly opened this issue Nov 12, 2023 · 3 comments · Fixed by #4567
Closed

top level (floating) window on macos #4566

rawnly opened this issue Nov 12, 2023 · 3 comments · Fixed by #4567
Labels
enhancement New feature or request

Comments

@rawnly
Copy link
Contributor

rawnly commented Nov 12, 2023

Is your feature request related to a problem? Please describe.
I would love to have my wezterm window on top of other windows.

Describe the solution you'd like
This can be done in Swift via:

window.level = .floating

After a small search on github and cocoa crate repo i figure out a possible solution, and tried it in the hello_world example of cocoa-foundation-rs/cocoa

      // create Window
      let window = NSWindow::alloc(nil)
          .initWithContentRect_styleMask_backing_defer_(
              NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)),
              NSWindowStyleMask::NSTitledWindowMask,
              NSBackingStoreBuffered,
              NO,
          )
          .autorelease();


      window.setLevel_(1); // this is what we need

      window.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));
      window.center();

It would be super nice to have this option in the Window menu, something such as "Keep on top" or "Floating Window".

I wanted to open a PR for this but I'm not familiar with the codebase and I'm not sure where this should be added. If you can provide some indications I can try implementing this myself and open a PR :)

Describe alternatives you've considered
not implementing

Additional context

@rawnly rawnly added the enhancement New feature or request label Nov 12, 2023
@rawnly
Copy link
Contributor Author

rawnly commented Nov 12, 2023

Demo

CleanShot.2023-11-12.at.14.13.32.mp4

@rawnly
Copy link
Contributor Author

rawnly commented Nov 12, 2023

After a bit of investigation and some experiments looks like setLevel_ accepts an i64 that is not binded to the NSWindow.level or CGWindowLevelKey value. However 0 is for normal window, 1 is floating.

@rawnly rawnly changed the title Allow floating window level on macos top level (floating) window on macos Nov 19, 2023
@wez wez closed this as completed in #4567 Jan 21, 2024
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant