godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Add "Godot_Debug" to WM_CLASS list when running game from editor (F5/F6) for better interoperability with window managers #10455

Open neruthes opened 2 months ago

neruthes commented 2 months ago

Describe the project you are working on

This feature is game-agnostic.

Describe the problem or limitation you are having in your project

When hitting F5 or F6, the new window appears in the current workspace. I need a smaller game window to ensure better FPS. I need a separate workspace to host the game window.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I need a fixed WM_CLASS so i3wm can arrange the new window to a specific workspace upon window creation.

This is part of my i3wm config file. Some workspaces have gaps and others do not. The editor needs gap-less WS5; the debug play windows need gap-ful WS6.

for_window [class=".*"] border pixel 0
gaps horizontal 160
gaps vertical 80
gaps inner 0
workspace 2 gaps outer 0
workspace 3 gaps outer 0
workspace 5 gaps outer 0

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

For example, the list of projects has the following WM_CLASS list.

$ xprop WM_CLASS
WM_CLASS(STRING) = "Godot_ProjectList", "Godot"

It would be easy to add "Godot_Debug" WM_CLASS to editor-initiated debug play windows.

So a single line in i3wm config will make sure that all Windows with WM_CLASS Godot_Debug will be automatically spawned in Workspace 6.

assign [class="Godot_Debug"] 6

If this enhancement will not be used often, can it be worked around with a few lines of script?

I would have to manually move the window to another workspace. Or I have to manually write game title of each project into my i3wm config file.

Now:

assign [class="Godot"] 5
assign [class="Godot_Engine"] 5

Possibly later:

assign [class="My Godot Game 1"] 6
assign [class="My Godot Game 2"] 6
assign [class="My Godot Game 3"] 6
assign [class="My Godot Game 4"] 6
assign [class="My Godot Game 5"] 6
assign [class="My Godot Game 6"] 6
assign [class="My Godot Game 7"] 6

Is there a reason why this should be core and not an add-on in the asset library?

Not sure. I am not familiar with the capabilities of addons.

Calinou commented 2 months ago

I need a smaller game window to ensure better FPS.

You can use the Scaling 3D project settings to reduce the rendering resolution in 3D projects without affecting the window size or 2D rendering. This works in all rendering methods since 4.3.

neruthes commented 2 months ago

I need a smaller game window to ensure better FPS.

You can use the Scaling 3D project settings to reduce the rendering resolution in 3D projects without affecting the window size or 2D rendering. This works in all rendering methods since 4.3.

Thanks. Nice to know. In recent projects I am specifically experiencing low FPS in 2D. My video card is simply incapable of rendering 2D at 2160p with a decent FPS.

BTW resizable non-maximized window doesn't work well with i3wm resizing. Not sure why. I will be reporting bug to somewhere if I figure out. (Edit: Resizing requires entering float mode; but I still cannot turn game window into the desired size.) (Edit 2: Fixed.)