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

Preserve position and size of godot's editor window between sessions. #5114

Closed
avril-gh opened this issue Jun 9, 2016 · 23 comments
Closed

Comments

@avril-gh
Copy link
Contributor

avril-gh commented Jun 9, 2016

Godot version: 2.x , 3.x
Operating system: windows 7

The reason of the proposal:
Every person have its own way of working, tools he use and how they are arranged all together on screen. Unfortunately godot editor is perhaps the only one, which do not remember its position and size betwin sessions, so it is necessary to move and resize it, to desired location and size, every time its started.

If someone is frequently jumping betwin projects - it turns into unnecessary additional burden, where one instead of concentrate on main problem - plays endlesly with ordering windows on screen every fiew minutes or even several seconds. Believe me - after 100 times it might begin to be a hassle and start destroying all the fun.
All just because, while godot do all the complex stuff, it forgets about the most basic one, like - to remember its own position and size.

Enhancement proposal:
Godot Editor should save its window position and size when window is closed (destroyed),
and restore its position and size when window is opened (created),
so it always appear at expected and usual for the user placement,
saving him from playing around with windows ordering instead of working on main project.
Its very small adjustment but same time a huge improvement, time and distraction saving feature.

As for me, it could be enought if Editor just save and restore its window position and size, and thats it.
There is no need for any additional settings for it.

But perhaps there might be someone who would like to have it saved per project.
(where setting could be saved into project's engine.cfg file instead of editor's config file)
But... imho, saving it per project might preserve unnecessary hasle since there might be many different placements betwin projects and again, when jumping betwin projects it might enforce one to move and scale editor's window and the end.
Therefore IF saving it per project could be implemented too, it could be reasonable to add [checkbox] in editor settings, like [save editors window placement per project] to give user option to chose if he want editor to just remember its placement globaly for all projects, or save it along with project so every project might have its own different window placement.

@djrm
Copy link
Contributor

djrm commented Jun 9, 2016

If you are talking about saving the dockers positions and sizes, thats already implemented, you can save multiple editor layouts and use them as you wish, just go to settings > editor layout

screenshot from 2016-06-08 20-13-45

@djrm
Copy link
Contributor

djrm commented Jun 9, 2016

Oh i see godot editor always starts as a maximized window

@vnen vnen changed the title [enhancement proposal] Preserve position and size of godot's editor window betwin sessions. Preserve position and size of godot's editor window betwin sessions. Jun 9, 2016
@avril-gh
Copy link
Contributor Author

avril-gh commented Jun 9, 2016

Oh i see godot editor always starts as a maximized window

Yes, that also. (good find, because indeed it also includes here)
unfortunately, "unmaximizing" it, makes Editor window to go to its own default position and size, so even if it would'nt start maximized it still always start with its own position and size.

So in short to sumarize:
We do not talk about "internal" Editor's layout.
Just about external coordination on how whole window lies on a screen.
The window position (left top corner) and size (right bottom corner) are always set to its default when opening Editor's window.
(Thanks to your find its also good to know that window state (maximized or not) should also be preserved) for it to have effect.

example of how it is:
.1. Set editor's window to cover bottom half of screen.
(lets imagine top half of screen is occupied by lets say... blender)
So we have blender on top and Godot on bottom.

.2. When you close Godot editor (eg just close, or reload other project)
It opens in its own position and size, and you gota manualy reshape it to occupy bottom part of screen as before.

Expected behavior:
.2. Close Godot editor (just close or Quit to project list) then reopen it.
Window position and size should be still the same as it was left last time.
In this example should cover bottom part of screen as it was set.

(Most of windows applications remembers its position and size so when opens next time it apears same like when it was closed, just godot not doing it, sigh)

Hope it clarified a little :)

@vnen
Copy link
Member

vnen commented Jun 9, 2016

BTW, there are CLI options to set the size and position of the window. It's not a solution but it means the solution must not be hard. Also, you need a good combination of those options to work properly:

  • -e: starts the editor instead of running the game.
  • -path path/to/game: set the project to open.
  • -w: starts in windowed mode (instead of maximized).
  • -r WIDTHxHEIGHT: set the window size.
  • -p XxY: set the window position.

If those options where somehow saved in the project (or the cache) folder and loaded by the project manager, it should fulfill this proposal.

@avril-gh
Copy link
Contributor Author

avril-gh commented Jun 9, 2016

woah, nice.

...Thanks to your tip i found theres a lot of other switches (good find, thanks)
while looking at it, it seems like its likely related more to game screen than to editor (Theres even such options in editor to set game window size, position ect, but exacly... not the editor window itself, sigh)

Tried -e -w -r1380x600 -p0x600
and nope, editor opens like usual, centered with its own size and pos...

anyway, i like the find, might be useful for scripting / automating betwin tools 🐱
very cool. Thanks again 😄

@djrm
Copy link
Contributor

djrm commented Jun 9, 2016

The commands work but it is -r 1380x600 -p 0x600 space between the parameter name and the parameter value pair

@avril-gh
Copy link
Contributor Author

avril-gh commented Jun 9, 2016

aha!, yes indeed, with space it works. (Sorry my habit from other apps) 😛

hmm, hmm...

when not provide -path like
godot210alpha.exe -e -w -r 1380x600 -p 0x600
then it opens project browser with layout like requested but then editor not inherits it, and open in usual way when chose project so its, something something ~ aaaaalmost...

when provide -path like
godot210alpha.exe -e -w -r 1380x600 -p 0x600 -path d:\System\dev\godot\project\hml
then it opens the project and sets requested layout.
Now this one is cool.

Even tho, when Quit to project browser and comeback, editor is back to usual "layout ignoring", still its a cool find especially while fiew hours a go i was thinking how to make a shortcut to certain projects without browsing projects library all around, and this one solved it perfectly. Great.

While i found how to make project shortcut, (very handy hehe) it seems this solution not really solve #5114 but anyway, meanwhile we managed to nicely clarify / define what exacly is this proposal about 🎯 and its

make editor window to save its current -r -p -w -mx -f on close (destroy)
and restore it when open (create)

if any of these switches are requested from command line then they have priority over what was saved in last session, so command line stuff still works as intended.

Thank you @vnen and @djrm for your time and help 🐱

@reduz reduz closed this as completed in d5e2b59 Jun 11, 2016
@reduz
Copy link
Member

reduz commented Jun 11, 2016

wrong commit number, sorry

@reduz reduz reopened this Jun 11, 2016
@avril-gh
Copy link
Contributor Author

avril-gh commented Jun 15, 2016

@vnen found another cool workaround like from GDScript

tool
extends EditorPlugin
func _ready():
    OS.set_window_position(Vector2(0, 75))
    OS.set_window_size(Vector2(1280, ((1024-970)-75) )
    OS.set_window_fullscreen(false)

arranges editor window exacly as i want on every editors reopen,
The only cons is that currently cant make global plugin so should add it to every project im working on... ugh.

@LanceJZ
Copy link

LanceJZ commented Aug 26, 2016

That looks like a good work around avril-gh, how how would I get that to auto execute when I open the editor for say a new project?
I just started learning this awesome engine yesterday, and this lack of functionality is driving me insane already.

@Calinou
Copy link
Member

Calinou commented Apr 11, 2018

Bugsquad note: This issue is still relevant as of commit d87307d.

@akien-mga akien-mga changed the title Preserve position and size of godot's editor window betwin sessions. Preserve position and size of godot's editor window between sessions. Nov 8, 2018
Calinou added a commit to Calinou/godot that referenced this issue Feb 19, 2020
@avril-gh
Copy link
Contributor Author

avril-gh commented May 2, 2020

Calinou@9680ad5
this exactly is what the issue been about. Thanks

@Calinou
Copy link
Member

Calinou commented May 2, 2020

@avril-gh I already opened a pull request with the commit in question (#32056), but it needs some changes and a rebase before it can be merged.

@cumminsd
Copy link

Would love to see this fixed. I use a 43" 4K monitor and opening maximized is too much. Then "normalizing" makes the window quite small. Even if you were to save the window size and location per project, at least setting it once wouldn't be so bad.

@Calinou
Copy link
Member

Calinou commented May 15, 2020

@cumminsd This feature is already being worked on, but the pull request needs to be rebased (or possibly redone from scratch at this point, due to the DisplayServer changes in the master branch).

@akien-mga
Copy link
Member

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

Vlagus pushed a commit to Vlagus/godot that referenced this issue Oct 31, 2020
@Ark2000
Copy link

Ark2000 commented Jul 25, 2023

is it implemented in Godot 4? It still always maximizes at editor window start up.

@Calinou
Copy link
Member

Calinou commented Jul 25, 2023

is it implemented in Godot 4? It still always maximizes at editor window start up.

Not yet, see godotengine/godot-proposals#7223 and godotengine/godot-proposals#4900.

Persisting the editor window and position and size is being worked on in #76085.

@IanBUK
Copy link

IanBUK commented Aug 27, 2023

This would be nice to see resolved. I'm working on a nice ultra wide monitor, 5120x1440 pixels, and the Godot window opens full screen.

@khornel
Copy link

khornel commented Sep 16, 2023

Here's a plugin workaround that works in Godot 4:

@tool
extends EditorPlugin


func _enter_tree():
	DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
	var ws = Vector2(1920, 1080)
	DisplayServer.window_set_size(ws)
	var ss = DisplayServer.screen_get_size()
	DisplayServer.window_set_position(ss*0.5-ws*0.5)

@IanBUK
Copy link

IanBUK commented Sep 16, 2023 via email

@zsolczai
Copy link

Is this little trick with the CLI no linger working for 4.2.1? I have this after the exe -w -r 1380x600 -p 0x600 and it makes no difference. What am I missing?

@akien-mga
Copy link
Member

akien-mga commented Feb 20, 2024

See the --help output, the syntax for position changed, it's comma separated:

  -w, --windowed                    R  Request windowed mode.
  --resolution <W>x<H>              R  Request window resolution.
  --position <X>,<Y>                R  Request window position.

And it needs to be explicitly --resolution and --position, the short versions were removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.