custom shader animation can be set to "always" to always remain active

Fixes #1225

The `custom-shader-animation` configuration can now be set to "always"
which keeps animation active even if the terminal is unfocused.
This commit is contained in:
Mitchell Hashimoto
2024-01-09 09:21:15 -08:00
parent 92697bad12
commit 96d33fef20
7 changed files with 88 additions and 27 deletions

View File

@@ -815,15 +815,21 @@ keybind: Keybinds = .{},
/// If true (default), the focused terminal surface will run an animation
/// loop when custom shaders are used. This uses slightly more CPU (generally
/// less than 10%) but allows the shader to animate. This only runs if there
/// are custom shaders.
/// are custom shaders and the terminal is focused.
///
/// If this is set to false, the terminal and custom shader will only render
/// when the terminal is updated. This is more efficient but the shader will
/// not animate.
///
/// This can also be set to "always", which will always run the animation
/// loop regardless of whether the terminal is focused or not. The animation
/// loop will still only run when custom shaders are used. Note that this
/// will use more CPU per terminal surface and can become quite expensive
/// depending on the shader and your terminal usage.
///
/// This value can be changed at runtime and will affect all currently
/// open terminals.
@"custom-shader-animation": bool = true,
@"custom-shader-animation": CustomShaderAnimation = .true,
/// If anything other than false, fullscreen mode on macOS will not use the
/// native fullscreen, but make the window fullscreen without animations and
@@ -2079,6 +2085,15 @@ fn equalField(comptime T: type, old: T, new: T) bool {
}
}
/// Valid values for custom-shader-animation
/// c_int because it needs to be extern compatible
/// If this is changed, you must also update ghostty.h
pub const CustomShaderAnimation = enum(c_int) {
false,
true,
always,
};
/// Valid values for macos-non-native-fullscreen
/// c_int because it needs to be extern compatible
/// If this is changed, you must also update ghostty.h