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

feat: preferences.yml for window size #185

Merged
merged 2 commits into from
Dec 7, 2024

Conversation

qm210
Copy link
Contributor

@qm210 qm210 commented Nov 22, 2024

Howdy again :)

I went on implementing the config file, I see you created an issue #184 but I didn't read it yet -- will do so now :)

please take your time, I'm not in a hurry, just have some time and motivation at hand, but the upstream merges can go as slow and careful as feels right for you

@qm210 qm210 force-pushed the ux/tracker-config-file branch from 73f5f41 to 6259f73 Compare November 22, 2024 23:56
Copy link
Owner

@vsariola vsariola left a comment

Choose a reason for hiding this comment

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

Overall, looks good to me. I found one bug, but since I am not going to use the fullscreen mode by default, I don't think it applies to me :)

Apart from that, just some naming nits

WindowPreferences struct {
Width int
Height int
Maximized bool `yaml:",omitempty"`
Copy link
Owner

@vsariola vsariola Nov 23, 2024

Choose a reason for hiding this comment

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

nit: To me, "maximized" means a different concept from fullscreen. Maximized means the window takes maximal amount of space, but keeping the decoration. Fullscreen means the bottom bars and window decorations are gone. So please change this to either "fullscreen" or consider implementing both "fullscreen" and "maximized"

Copy link
Owner

Choose a reason for hiding this comment

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

Gioui seems to agree: maximized, minimized, windowed and fullscreen are different options: https://github.com/gioui/gio/blob/8daff13af6cdbe4cb689e324f6ba343062dad050/app/window.go#L853

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, yeah, this confuses me. All I ever meant was "Maximized" (and I also see no use for actual Fullscreen), but when I try the gioui options, the app.Fullscreen.Option() that I used and the app.Maximized.Option() give the same effect (i.e. Maximized).

as the app.Fullscreen.Option() gave me what I wanted, I didn't get the idea of looking further; but as no other people really asked for Fullscreen, I would then just use the different Option, even if they look the same for me.

Copy link
Owner

@vsariola vsariola Nov 23, 2024

Choose a reason for hiding this comment

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

I had trouble getting out of the fullscreen mode, by doing following:

  1. Make a small custom configuration file with
window:
  maximized: true
  1. Start tracker
  2. Close the window once. The tracker asks if we want to save. Click cancel.
  3. Try to exit fullscreen by hitting ctrl-enter

I don't know if this is bug in gioui or our main event loop. Please try fixing this if possible.

Copy link
Contributor Author

@qm210 qm210 Dec 7, 2024

Choose a reason for hiding this comment

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

Here, too, I don't quite get it.
Ctrl + Enter does not seem to have any effect for me

EDIT: Oh. Just found, pressing "Alt+Enter" does the Fullscreen thing. I didn't even know it.
But still, it's a bit different for me: Alt + Enter just seems to work sometimes, and sometimes it just does some movements and stays Fullscreen. Regardless of whether the App was Maximized at any point, or Closed-and-Opened again.

Did that work successfully at some point?

}
t.Theme.Shaper = text.NewShaper(text.WithCollection(fontCollection))
t.PopupAlert = NewPopupAlert(model.Alerts(), t.Theme.Shaper)
if t.preferences.YmlError != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

This is fine for now. In future, and even for the keybindings, I'm thinking of loading them every time a new tracker is created instead of init(). Because:

In the VST, init is called only once, when the DLL is loaded. But the DLL stays loaded even if you close the plugin. So, to make new config take effect, you have to close the entire DAW.

return true, err
}

func NewPreferences() Preferences {
Copy link
Owner

@vsariola vsariola Nov 23, 2024

Choose a reason for hiding this comment

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

nit: I prefer reserving word "New" only for heap allocations, so typically functions returning pointers to structs. This matches the meaning of "new" in C++. Using MakePreferences would match how new and make keywords work in go: new(type) returns a pointer to a type, whereas make(type) returns type. So please change to MakePreferences

Copy link
Owner

Choose a reason for hiding this comment

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

Sometimes dropping the Make altogether and using some convenient short word is great. For example, gioui has layout.Rigid basically just doing similar thing i.e. constructing a struct, but it would be pretty verbose to write "layout.MakeFlexChild" every time. But here, the MakePreferences won't be called too many times, so I think a bit more lengthy name is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I didn't notice before that the New...() only return pointers. but I have no feelings whatsoever about that name for now, so... yeah :)

@vsariola vsariola merged commit 7ff3c94 into vsariola:master Dec 7, 2024
16 of 18 checks passed
@vsariola
Copy link
Owner

vsariola commented Dec 7, 2024

LGTM, merged! Thank you for your contribution!

P.S. MacOs runners seem to have been broken again, so the failing github actions was not related to this PR.

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