> ## Documentation Index
> Fetch the complete documentation index at: https://klyx.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Settings

> Read and update Klyx app settings

Extensions can read and modify Klyx's settings through the `Settings` service. This includes appearance, editor, terminal, and file tree settings.

## Settings service

```kotlin theme={null}
private val settings: Settings by plugin()
```

### Reading settings

```kotlin theme={null}
// Get the current settings as a flow
val currentSettings: Flow<AppSettings> = settings.settings

// Read the current value once
val appSettings: AppSettings = settings.settings.first()
```

### Updating settings

```kotlin theme={null}
// Update any subset of settings
settings.updateSettings { current ->
    current.copy(
        appearance = current.appearance.copy(
            theme = AppTheme.Dark
        )
    )
}
```

### Update helper functions

```kotlin theme={null}
// Appearance
settings.updateAppearanceSettings { appearance ->
    appearance.copy(theme = AppTheme.Dark)
}

// Editor
settings.updateEditorSettings { editor ->
    editor.copy(fontSize = 14)
}

// Terminal
settings.updateTerminalSettings { terminal ->
    terminal.copy(fontSize = 12)
}

// File tree
settings.updateFileTreeSettings { fileTree ->
    fileTree.copy(showHiddenFiles = true)
}
```

### Shortcut extensions

```kotlin theme={null}
settings.setTheme(AppTheme.Dark)
settings.setDarkMode(true)
```

## AppSettings model

```kotlin theme={null}
@Serializable
data class AppSettings(
    val appearance: AppearanceSettings,
    val editor: EditorSettings,
    val terminal: TerminalSettings,
    val fileTree: FileTreeSettings
)
```

### AppearanceSettings

```kotlin theme={null}
data class AppearanceSettings(
    val theme: AppTheme,           // System, Dark, Light
    val amoledDarkMode: Boolean,   // True black dark mode
    val immersiveMode: Boolean,    // Hide system bars
    val reduceMotion: Boolean      // Reduce animations
)
```

### EditorSettings

```kotlin theme={null}
data class EditorSettings(
    val fontSize: Int,                        // Font size in sp
    val pinLineNumbers: Boolean,              // Always show line numbers
    val tabSize: Int,                         // Tab width in spaces
    val customFontUri: String?,               // Custom font URI
    val deleteEmptyLineFast: Boolean,
    val deleteMultiSpaces: Boolean,
    val symbolPairAutoCompletion: Boolean,
    val autoIndent: Boolean,
    val disallowSuggestions: Boolean,
    val highlightMatchingDelimiters: Boolean,
    val boldMatchingDelimiters: Boolean,
    val stickyScroll: Boolean,                // Scroll to keep context
    val stickyScrollMaxLines: Int,
    val inlayHints: Boolean                   // Show inlay hints
    // ... and more
)
```

### TerminalSettings

```kotlin theme={null}
data class TerminalSettings(
    val cursorStyle: CursorStyle,
    val bellEnabled: Boolean,
    val bellVolume: Float,
    val fontSize: Int,
    val cursorBlink: Boolean,
    val scrollbackLines: Int,
    val showMotd: Boolean
    // ... and more
)
```

### FileTreeSettings

```kotlin theme={null}
data class FileTreeSettings(
    val showHiddenFiles: Boolean
)
```
