Godot platform desktop

From nix-community/nur-combined · View interactive version

Godot platform desktop is an AI agent skill from the GitHub repository nix-community/nur-combined. Expert blueprint for desktop platforms (Windows/Linux/macOS) covering keyboard/mouse controls, settings menus, window management (fullscreen, resolution), keybind remapping, and Steam integration. Use when targeting PC platforms or implementing desktop-specific features. Keywords desktop, Windows, L

How to use this skill

Skill file

Platform: Desktop

Settings flexibility, window management, and kb/mouse precision define desktop gaming.

NEVER Do (Expert Desktop Rules)

Window & Display

Input & Persistence

Performance & Integration


Available Scripts

MANDATORY: Read the appropriate script before implementing the corresponding pattern.

[desktop_window_manager.gd](scripts/desktop_window_manager.gd)

Expert DPI-aware multi-monitor window positioning using DisplayServer.

[desktop_settings_persistent.gd](scripts/desktop_settings_persistent.gd)

Production settings persistence using ConfigFile for persistent INI data.

[physical_input_rebinder.gd](scripts/physical_input_rebinder.gd)

Expert positional rebind system using physical_keycode for AZERTY/Dvorak.

[platform_sdk_wrapper.gd](scripts/platform_sdk_wrapper.gd)

Safe PC SDK singleton wrapper (Steamworks/Epic) with crash guards.

[native_dialog_helper.gd](scripts/native_dialog_helper.gd)

Expert native OS file dialogs and system alerts logic.

[secondary_window_spawner.gd](scripts/secondary_window_spawner.gd)

True multi-window management for secondary Viewports/Windows.

[graceful_shutdown_handler.gd](scripts/graceful_shutdown_handler.gd)

Safe close-request interceptor for data flushing and exit guards.

[low_processor_eco_mode.gd](scripts/low_processor_eco_mode.gd)

Eco mode optimization for desktop tools and launchers.

[desktop_performance_monitor.gd](scripts/desktop_performance_monitor.gd)

OS-level hardware detection for dynamic graphics presets.

[native_shell_executor.gd](scripts/native_shell_executor.gd)

Expert native shell command execution and output capture.


# settings.gd
extends Control

func _ready() -> void:
    load_settings()
    apply_settings()

func load_settings() -> void:
    var config := ConfigFile.new()
    config.load("user://settings.cfg")
    
    $Graphics/ResolutionDropdown.selected = config.get_value("graphics", "resolution", 0)
    $Graphics/FullscreenCheck.button_pressed = config.get_value("graphics", "fullscreen", false)
    $Audio/MasterSlider.value = config.get_value("audio", "master_volume", 1.0)

func save_settings() -> void:
    var config := ConfigFile.new()
    config.set_value("graphics", "resolution", $Graphics/ResolutionDropdown.selected)
    config.set_value("graphics", "fullscreen", $Graphics/FullscreenCheck.button_pressed)
    config.set_value("audio", "master_volume", $Audio/MasterSlider.value)
    config.save("user://settings.cfg")

func apply_settings() -> void:
    # Resolution
    var resolutions := [Vector2i(1920, 1080), Vector2i(2560, 1440), Vector2i(3840, 2160)]
    var resolution := resolutions[$Graphics/ResolutionDropdown.selected]
    get_window().size = resolution
    
    # Fullscreen
    if $Graphics/FullscreenCheck.button_pressed:
        DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
    else:
        DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
    
    # Audio
    AudioServer.set_bus_volume_db(0, linear_to_db($Audio/MasterSlider.value))

Keyboard Remapping

# Allow players to rebind keys
func rebind_action(action: String, new_key: Key) -> void:
    # Remove existing
    InputMap.action_erase_events(action)
    
    # Add new
    var event := InputEventKey.new()
    event.keycode = new_key
    InputMap.action_add_event(action, event)
    
    # Save
    save_input_map()

Window Management

# Toggle fullscreen
func toggle_fullscreen() -> void:
    if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
        DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
    else:
        DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)

Steam Integration (if using)

# Using GodotSteam plugin
var steam_id: int

func _ready() -> void:
    if Steam.isSteamRunning():
        steam_id = Steam.getSteamID()
        Steam.achievement_progress.connect(_on_achievement_progress)

func unlock_achievement(name: String) -> void:
    Steam.setAchievement(name)
    Steam.storeStats()

Best Practices

  1. Settings - Extensive graphics/audio options
  2. Keybinds - Allow remapping
  3. Alt+F4 - Support quit shortcuts
  4. Save Location - Use user:// directory

Reference

Related

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.