Hacky declarative godot settings

This commit is contained in:
Emmet 2025-10-11 21:52:10 -05:00
parent 1476305c98
commit c824064354
6 changed files with 136 additions and 177 deletions

View file

@ -0,0 +1,93 @@
# HACK
# Declarative settings in Godot don't really work without patching Godot
# source code. Workaround is to store a script to setup all of the settings.
# Annoying thing is that it can only be run from within the editor!
# ALERT
# Open this script within it's contained project and press Ctrl-Shift-x to apply.
@tool
extends EditorScript
var settings: EditorSettings = EditorInterface.get_editor_settings()
func apply_setting(setting_name: String, new_value):
var old_value = settings.get_setting(setting_name)
settings.set_setting(setting_name, new_value)
print(setting_name + ": " + str(old_value) + " -> " + str(new_value))
func _run():
print("Applying custom Godot editor settings:")
apply_setting("interface/editor/dock_tab_style", 2)
apply_setting("interface/theme/preset", "Custom")
apply_setting("inerface/theme/base_color", Color("{{base00}}ff"))
apply_setting("interface/theme/accent_color", Color("{{base09}}ff"))
apply_setting("text_editor/theme/color_theme", "Custom")
apply_setting("text_editor/theme/highlighting/symbol_color",Color("{{base0E}}ff"))
apply_setting("text_editor/theme/highlighting/keyword_color",Color("{{base0E}}ff"))
apply_setting("text_editor/theme/highlighting/control_flow_keyword_color",Color("{{base09}}ff"))
apply_setting("text_editor/theme/highlighting/control_flow_keyword_color",Color("{{base0A}}ff"))
apply_setting("text_editor/theme/highlighting/base_type_color",Color("{{base09}}ff"))
apply_setting("text_editor/theme/highlighting/engine_type_color",Color("{{base09}}ff"))
apply_setting("text_editor/theme/highlighting/user_type_color",Color("{{base09}}ff"))
apply_setting("text_editor/theme/highlighting/comment_color",Color("c9c8c980"))
apply_setting("text_editor/theme/highlighting/doc_comment_color",Color("{{base0B}}cc"))
apply_setting("text_editor/theme/highlighting/string_color",Color("{{base0B}}ff"))
apply_setting("text_editor/theme/highlighting/background_color",Color("{{base00}}ff"))
apply_setting("text_editor/theme/highlighting/completion_background_color",Color("{{base01}}ff"))
apply_setting("text_editor/theme/highlighting/completion_selected_color",Color("ffffff12"))
apply_setting("text_editor/theme/highlighting/completion_existing_color",Color("ffffff24"))
apply_setting("text_editor/theme/highlighting/completion_scroll_color",Color("ffffff4a"))
apply_setting("text_editor/theme/highlighting/completion_scroll_hovered_color",Color("ffffff66"))
apply_setting("text_editor/theme/highlighting/completion_font_color",Color("{{base07}}ff"))
apply_setting("text_editor/theme/highlighting/text_color",Color("{{base07}}ff"))
apply_setting("text_editor/theme/highlighting/line_number_color",Color("c9c8c980"))
apply_setting("text_editor/theme/highlighting/safe_line_number_color",Color("{{base0D}}bf"))
apply_setting("text_editor/theme/highlighting/caret_color",Color("{{base07}}ff"))
apply_setting("text_editor/theme/highlighting/caret_background_color",Color("{{base00}}ff"))
apply_setting("text_editor/theme/highlighting/text_selected_color",Color("ffffff12"))
apply_setting("text_editor/theme/highlighting/selection_color",Color("{{base09}}33"))
apply_setting("text_editor/theme/highlighting/brace_mismatch_color",Color("{{base08}}ff"))
apply_setting("text_editor/theme/highlighting/current_line_color",Color("ffffff12"))
apply_setting("text_editor/theme/highlighting/line_length_guideline_color",Color("{{base02}}ff"))
apply_setting("text_editor/theme/highlighting/word_highlighted_color",Color("ffffff12"))
apply_setting("text_editor/theme/highlighting/number_color",Color("{{base0D}}ff"))
apply_setting("text_editor/theme/highlighting/function_color",Color("{{base0E}}ff"))
apply_setting("text_editor/theme/highlighting/member_variable_color",Color("{{base0A}}ff"))
apply_setting("text_editor/theme/highlighting/mark_color",Color("{{base08}}4d"))
apply_setting("text_editor/theme/highlighting/warning_color",Color("{{base0A}}4d"))
apply_setting("text_editor/theme/highlighting/bookmark_color",Color("{{base0E}}ff"))
apply_setting("text_editor/theme/highlighting/breakpoint_color",Color("{{base08}}ff"))
apply_setting("text_editor/theme/highlighting/executing_line_color",Color("{{base0C}}ff"))
apply_setting("text_editor/theme/highlighting/code_folding_color",Color("ffffff45"))
apply_setting("text_editor/theme/highlighting/folded_code_region_color",Color("{{base08}}33"))
apply_setting("text_editor/theme/highlighting/search_result_color",Color("{{base0C}}33"))
apply_setting("text_editor/theme/highlighting/search_result_border_color",Color("{{base0F}}33"))
apply_setting("text_editor/theme/highlighting/gdscript/function_definition_color",Color("{{base0F}}ff"))
apply_setting("text_editor/theme/highlighting/gdscript/global_function_color",Color("{{base0E}}ff"))
apply_setting("text_editor/theme/highlighting/gdscript/node_path_color",Color("{{base0B}}ff"))
apply_setting("text_editor/theme/highlighting/gdscript/node_reference_color",Color("{{base0A}}ff"))
apply_setting("text_editor/theme/highlighting/gdscript/annotation_color",Color("{{base0C}}ff"))
apply_setting("text_editor/theme/highlighting/gdscript/string_name_color",Color("{{base0D}}ff"))
apply_setting("text_editor/theme/highlighting/comment_markers/critical_color",Color("{{base08}}ff"))
apply_setting("text_editor/theme/highlighting/comment_markers/warning_color",Color("{{base0A}}ff"))
apply_setting("text_editor/theme/highlighting/comment_markers/notice_color",Color("{{base0D}}ff"))
apply_setting("interface/theme/contrast", 0.35)
apply_setting("interface/scene_tabs/restore_scenes_on_load", false)
apply_setting("interface/multi_window/enable", false)
apply_setting("interface/multi_window/restore_windows_on_load", false)
apply_setting("network/connection/check_for_updates", 0)
apply_setting("network/language_server/show_native_symbols_in_editor", true)
apply_setting("network/language_server/use_thread", true)
apply_setting("filesystem/external_programs/raster_image_editor", "pinta")
apply_setting("filesystem/external_programs/vector_image_editor", "inkscape")
apply_setting("filesystem/external_programs/audio_editor", "tenacity")
apply_setting("filesystem/external_programs/3d_model_editor", "blender")
apply_setting("filesystem/external_programs/terminal_emulator", "alacritty")
apply_setting("filesystem/external_programs/terminal_emulator_flags", "")
apply_setting("filesystem/directories/autoscan_project_path", "/home/emmet/Projects")
apply_setting("filesystem/directories/default_project_path", "/home/emmet/Projects")
apply_setting("filesystem/import/blender/blender_path", "/home/emmet/.nix-profile/bin/blender")
apply_setting("text_editor/behavior/indent/size", 2)
apply_setting("editors/3d/navigation/emulate_numpad", false)
apply_setting("project_manager/directory_naming_convention", 2)

View file

@ -0,0 +1 @@
uid://cucm2ubvgnpl0

View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
cfg = config.userSettings.godot;
in
{
config = lib.mkIf cfg.enable {
home.file.".config/declarative-godot-settings/apply_settings.gd".source = config.lib.stylix.colors {
template = builtins.readFile ./apply_settings.gd;
extension = ".gd";
};
home.file.".config/declarative-godot-settings/apply_settings.gd.uid".source = ./apply_settings.gd.uid;
home.file.".config/declarative-godot-settings/project.godot".source = ./project.godot;
home.file.".config/declarative-godot-settings/dummy_scene.tscn".source = ./dummy_scene.tscn;
home.packages = [
(pkgs.writeScriptBin "declarative-godot-settings" ''
#!/bin/sh
${pkgs.godot}/bin/godot --editor --path ${config.home.homeDirectory}/.config/declarative-godot-settings;
'')
];
};
}

View file

@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://do6bjr26bosb2"]
[node name="DummyScene" type="Node"]

View file

@ -0,0 +1,16 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Declarative Godot Settings"
run/main_scene="uid://do6bjr26bosb2"
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"