Repository: godotengine/godot
File: editor/docks/editor_dock_manager.cpp (C++)

Code before:
		const String tab_key = config_key + "_selected_tab_idx";

		int selected_tab_idx = dock_slots[i].container->get_current_tab();
		if (selected_tab_idx >= 0) {
			p_layout->set_value(p_section, tab_key, selected_tab_idx);
		} else if (p_layout->has_section_key(p_section, tab_key)) {
			p_layout->erase_section_key(p_section, tab_key);
		}
	}

	// Save docks in windows.
	Dictionary floating_docks_dump;
	for (WindowWrapper *wrapper : dock_windows) {
		EditorDock *dock = Object::cast_to<EditorDock>(wrapper->get_wrapped_control());

		Dictionary window_dump;
		window_dump["window_rect"] = wrapper->get_window_rect();

		int screen = wrapper->get_window_screen();
		window_dump["window_screen"] = wrapper->get_window_screen();
		window_dump["window_screen_rect"] = DisplayServer::get_singleton()->screen_get_usable_rect(screen);

		String name = dock->get_effective_layout_key();
		floating_docks_dump[name] = window_dump;

		// Append to regular dock section so we know where to restore it to.
		int dock_slot_id = dock->dock_slot_index;
		String config_key = "dock_" + itos(dock_slot_id + 1);

		String names = p_layout->get_value(p_section, config_key, "");
		if (names.is_empty()) {
			names = name;
		} else {
			names += "," + name;
		}
		p_layout->set_value(p_section, config_key, names);
	}
	p_layout->set_value(p_section, "dock_floating", floating_docks_dump);

	// Save closed docks.
	Array closed_docks_dump;
	for (const EditorDock *dock : all_docks) {
		const String section_name = p_section + "/" + dock->get_effective_layout_key();
		dock->save_layout_to_config(p_layout, section_name);

		if (dock->is_open) {
			continue;
		}

		const String name = dock->get_effective_layout_key();
		if (!dock->is_open && !dock->transient) {

Review comment (suggestion):
Instead of preventing the window from being saved, we could instead prevent loading it. It can help fix #113259 If you make a dock floating, it should stay floating.

Code after:
		const String tab_key = config_key + "_selected_tab_idx";

		int selected_tab_idx = dock_slots[i].container->get_current_tab();
		if (selected_tab_idx >= 0) {
			p_layout->set_value(p_section, tab_key, selected_tab_idx);
		} else if (p_layout->has_section_key(p_section, tab_key)) {
			p_layout->erase_section_key(p_section, tab_key);
		}
	}

	// Save docks in windows.
	Dictionary floating_docks_dump;
	for (WindowWrapper *wrapper : dock_windows) {
		EditorDock *dock = Object::cast_to<EditorDock>(wrapper->get_wrapped_control());

		Dictionary window_dump;
		window_dump["window_rect"] = wrapper->get_window_rect();

		int screen = wrapper->get_window_screen();
		window_dump["window_screen"] = wrapper->get_window_screen();
		window_dump["window_screen_rect"] = DisplayServer::get_singleton()->screen_get_usable_rect(screen);

		String name = dock->get_effective_layout_key();
		if (!dock->transient) {
			floating_docks_dump[name] = window_dump;
		}

		// Append to regular dock section so we know where to restore it to.
		int dock_slot_id = dock->dock_slot_index;
		String config_key = "dock_" + itos(dock_slot_id + 1);

		String names = p_layout->get_value(p_section, config_key, "");
		if (names.is_empty()) {
			names = name;
		} else {
			names += "," + name;
		}
		p_layout->set_value(p_section, config_key, names);
	}
	p_layout->set_value(p_section, "dock_floating", floating_docks_dump);

	// Save closed docks.
	Array closed_docks_dump;
	for (const EditorDock *dock : all_docks) {
		const String section_name = p_section + "/" + dock->get_effective_layout_key();
		dock->save_layout_to_config(p_layout, section_name);

		if (dock->is_open) {
			continue;
		}