Skip to content

Add option to use floating windows for model previews on macOS#19

Merged
nicklockwood merged 1 commit into
nicklockwood:developfrom
ccampbell:main
Sep 23, 2025
Merged

Add option to use floating windows for model previews on macOS#19
nicklockwood merged 1 commit into
nicklockwood:developfrom
ccampbell:main

Conversation

@ccampbell
Copy link
Copy Markdown
Contributor

Hi there. I have been exploring different options for using code to generate 3D models, and so far I am really enjoying ShapeScript. As a macOS and iPad user it seems to fit naturally into my workflow. So far this is the only feature I felt was missing since I don’t like to use spaces or split screen or anything else.

This adds a Float Window option to the View menu to allow a model window to float over other applications on macOS. This allows you to keep the preview open to the side of the document in your text editor to see changes in real time.

I couldn’t decide if this should go in the View menu or the Window menu, but I chose View since that is where all the other view specific options are. Happy to change it if you feel strongly. Let me know if there is anything I am missing here.

I am also working on a grammar for Sublime Text that is coming along pretty nicely and supports jumping to symbols as well. Here is a video of the floating window behavior in action:

shapescript-floating.mp4

@ccampbell ccampbell changed the title Add option to use floating windows for model previews Add option to use floating windows for model previews on macOS Apr 28, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
@nicklockwood
Copy link
Copy Markdown
Owner

Great idea!

Although I wonder if it would work better as a persistent "preview" window that always shows the most recently edited file rather than a per-window setting? (Similar to how Deckset's preview works)

@nicklockwood
Copy link
Copy Markdown
Owner

so far I am really enjoying ShapeScript

I'm so glad to hear that ☺️ I'd love to hear about what you're using it for or to see any examples of what you've made! Let me know if you have any other feature requests or suggestions.

@ccampbell
Copy link
Copy Markdown
Contributor Author

Although I wonder if it would work better as a persistent "preview" window that always shows the most recently edited file rather than a per-window setting?

Hmm that is a good point. I did notice one issue which is that if you enable tabs within the same window, the floating setting doesn’t stick if you change tabs so at the very least I think that should be fixed although not sure the best way to handle that (maybe an argument to move it under the Window menu 😕). Your idea would kind of solve that problem too. That said, it still requires that you open each .shape file up front, I think?

Also, I think it could get a little messy with imports. For example if you change a file that is imported into multiple files or imported into files that are imported into other files, how do you know which one to display in the preview? I suppose it would have to be the last file saved that imports that file, but then the logic starts to get pretty complex since you have to track the full import tree to do it properly. The per window setting is at least simple to implement, easy to understand as a user, and doesn’t require tracking any really complicated state 😅.

I'd love to hear about what you're using it for or to see any examples of what you've made!

Just simple things for now. I’m new to 3D design and had been using tinkercad, but I am trying out different things as a next step. I’m currently attempting to port a design I made there over. I can share more later. Also will definitely let you know if I have other feature requests.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@nicklockwood nicklockwood changed the base branch from main to develop September 23, 2025 06:27
@nicklockwood nicklockwood merged commit db3e88a into nicklockwood:develop Sep 23, 2025
6 checks passed
nicklockwood pushed a commit that referenced this pull request Sep 23, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Sep 25, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Sep 26, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Sep 27, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 6, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 9, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 10, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 10, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 10, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 12, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 12, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
nicklockwood pushed a commit that referenced this pull request Oct 12, 2025
This adds a `Float Window` option to the `View` menu to allow a model
window to float over other applications on macOS. This allows you to
keep the preview open to the side of the document in your text editor to
see changes in real time.
@nicklockwood
Copy link
Copy Markdown
Owner

@ccampbell I've landed a version of this in the latest release. Hopefully you're happy with the implementation I went with, but let me know if not, or if you have any suggestions for improvements: https://github.com/nicklockwood/ShapeScript/releases/tag/1.9.0

@ccampbell
Copy link
Copy Markdown
Contributor Author

Hi @nicklockwood thanks so much. I think the way you implemented it functionally is great. That said, I noticed one strange thing. For some reason with the new implementation when clicking outside of the window it somehow becomes transparent so you can see through it for a quick flash. I took a screen capture to show.

First in my build:

shapescript-focus-older-build.mov

Now in the latest build:

shapescript-focus-new-build.mov

It doesn’t happen every time, and I haven’t tried to debug it or anything, but just something I noticed.

@ccampbell
Copy link
Copy Markdown
Contributor Author

Unsure if it is related, but I also noticed some artifacts when resizing the preview window in the latest build

shapescript-artifacts.mov

@nicklockwood
Copy link
Copy Markdown
Owner

For some reason with the new implementation when clicking outside of the window it somehow becomes transparent so you can see through it for a quick flash

To fix the issue with tabs, I switch the window back to non-floating when the application moves to the foreground. I suspect that the flash is due to this transition.

@ccampbell
Copy link
Copy Markdown
Contributor Author

Ah okay, I actually just noticed another issue related to this. If you have another floating window open at the same time, such as PiP video playing and you focus the shapescript floating window, it remains behind the PiP window until you switch to another app so that is probably the same issue 😕 .

@nicklockwood
Copy link
Copy Markdown
Owner

@ccampbell I've switched to a different approach and pushed a new update. Hopefully that will solve the glitches you were seeing.

Instead of disabling floating when the app moves to the foreground, I now only switch it when changing window focus.

This reintroduced the problem with switching tabs, but I found a workaround for that, and they now actually work much better than before!

@nicklockwood
Copy link
Copy Markdown
Owner

@ccampbell btw, would you like me to add you to the Testflight/beta program for ShapeScript? And if so should I use this email for you, or a different one?

@ccampbell
Copy link
Copy Markdown
Contributor Author

@ccampbell I've switched to a different approach and pushed a new update. Hopefully that will solve the glitches you were seeing.

I tried it out by building in Xcode, and so far it seems to work great!

@ccampbell btw, would you like me to add you to the Testflight/beta program for ShapeScript? And if so should I use this email for you, or a different one?

Sure, feel free to add me. The email I used when I emailed you in September should be the one to use.

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