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

Move window controls to the left #138

Open
Happy-Ferret opened this issue Aug 29, 2018 · 4 comments
Open

Move window controls to the left #138

Happy-Ferret opened this issue Aug 29, 2018 · 4 comments

Comments

@Happy-Ferret
Copy link

This is something I've been struggling with for a while now.
I'd like to move the window controls (minimize, maximize, close) to the left and display the title text to the right of them.

What changes in code are necessary to achieve that? I don't quite understand the way frame/full.go is supposed to work.

@BurntSushi
Copy link
Owner

Sorry, but I don't know. I wrote that code over six years ago and I no longer understand it. There isn't that much code, so I think you'll just need to sit down and play with it to see how it works.

@Happy-Ferret
Copy link
Author

No worries.

Did some "hacking" and found the relevant part.

Most of the magic happens in moveresizePieces(), updateIcon and updateTitle.

The pieces' MROpt(fX...) actually controls the placement relative to the other elements.

So to place the minimize button to the left (I like the idea of having minimize on the outside and close to the right of it. I'm an ergonomic oddball...) I changed

f.buttonMinimize.MROpt(fX,
		f.buttonMaximize.x()-f.buttonMinimize.w(), 0, 0, 0)

to

f.buttonMinimize.MROpt(fX,
                f.titleBar.x()+f.buttonMinimize.w(), 0, 0, 0)

The result: minimize is now to the left of the titleBar (which, contrary to what it may sound like, is not a wrapper for titleText and/or icon but a mere "splitter" and drag element, dividing the left and right sides of the frame).

Note to myself: Think about switching the geometry from int to float, for more precise placement/spacing.

@Happy-Ferret
Copy link
Author

Still largely a WIP (the buttons should probably be closer to the left corner still, and the title centered), but this is what my little "fork" of wingo looks right now.

I already have an idea on how I may implement double clicks, too (since I'm getting rid of the maximize button and the maximize action should be triggered by double clicking anywhere on the frame, I'll need).

Just thought I'd post my progress. Always nice to share. 😸

wm

@BurntSushi
Copy link
Owner

Awesome, that looks great! Nice work! :)

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

No branches or pull requests

2 participants