@@ -695,6 +695,24 @@ typedef void (*GhosttyTerminalWritePtyFn)(GhosttyTerminal terminal,
695695typedef GhosttyString (* GhosttyTerminalXtversionFn )(GhosttyTerminal terminal ,
696696 void * userdata );
697697
698+ /**
699+ * A terminal mode and boolean value used for mode configuration and queries.
700+ *
701+ * For GHOSTTY_TERMINAL_DATA_MODE, initialize `mode` before calling
702+ * ghostty_terminal_get(). On success, `value` contains the current mode value.
703+ *
704+ * This struct has a frozen layout and will not gain fields in future versions.
705+ *
706+ * @ingroup terminal
707+ */
708+ typedef struct {
709+ /** Mode to configure or query. */
710+ GhosttyMode mode ;
711+
712+ /** Value to set, or the current value returned by a query. */
713+ bool value ;
714+ } GhosttyTerminalModeConfig ;
715+
698716/**
699717 * Terminal option identifiers.
700718 *
@@ -1060,6 +1078,31 @@ typedef enum GHOSTTY_ENUM_TYPED {
10601078 * Input type: bool*
10611079 */
10621080 GHOSTTY_TERMINAL_OPT_TITLE_REPORT = 32 ,
1081+
1082+ /**
1083+ * Set the reset default for a terminal mode.
1084+ *
1085+ * This unconditionally updates both the current value and the value restored
1086+ * by a full terminal reset (RIS).
1087+ *
1088+ * Some recognized modes represent transitions or mirror additional terminal
1089+ * state and cannot safely be configured as reset defaults. Those modes return
1090+ * GHOSTTY_INVALID_VALUE. A NULL value pointer also returns
1091+ * GHOSTTY_INVALID_VALUE.
1092+ *
1093+ * Input type: GhosttyTerminalModeConfig*
1094+ */
1095+ GHOSTTY_TERMINAL_OPT_MODE_DEFAULT = 33 ,
1096+
1097+ /**
1098+ * Set the current value of a terminal mode.
1099+ *
1100+ * This does not change the value restored by a full terminal reset (RIS).
1101+ * A NULL value pointer or unknown mode returns GHOSTTY_INVALID_VALUE.
1102+ *
1103+ * Input type: GhosttyTerminalModeConfig*
1104+ */
1105+ GHOSTTY_TERMINAL_OPT_MODE = 34 ,
10631106 GHOSTTY_TERMINAL_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE ,
10641107} GhosttyTerminalOption ;
10651108
@@ -1420,6 +1463,17 @@ typedef enum GHOSTTY_ENUM_TYPED {
14201463 * Output type: size_t *
14211464 */
14221465 GHOSTTY_TERMINAL_DATA_CONTINUATION_MAX_BYTES = 36 ,
1466+
1467+ /**
1468+ * Get the current value of a terminal mode.
1469+ *
1470+ * The caller must initialize the `mode` field. On success, the `value` field
1471+ * is updated with the current value. A NULL pointer or unknown mode returns
1472+ * GHOSTTY_INVALID_VALUE.
1473+ *
1474+ * Input/output type: GhosttyTerminalModeConfig *
1475+ */
1476+ GHOSTTY_TERMINAL_DATA_MODE = 37 ,
14231477 GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE ,
14241478} GhosttyTerminalData ;
14251479
@@ -1709,41 +1763,6 @@ GHOSTTY_API GhosttyResult ghostty_terminal_compress(
17091763 GhosttyTerminalCompressionMode mode ,
17101764 GhosttyTerminalCompressionResult * out_result );
17111765
1712- /**
1713- * Get the current value of a terminal mode.
1714- *
1715- * Returns the value of the mode identified by the given mode.
1716- *
1717- * @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)
1718- * @param mode The mode identifying the mode to query
1719- * @param[out] out_value On success, set to true if the mode is set, false
1720- * if it is reset
1721- * @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal
1722- * is NULL or the mode does not correspond to a known mode
1723- *
1724- * @ingroup terminal
1725- */
1726- GHOSTTY_API GhosttyResult ghostty_terminal_mode_get (GhosttyTerminal terminal ,
1727- GhosttyMode mode ,
1728- bool * out_value );
1729-
1730- /**
1731- * Set the value of a terminal mode.
1732- *
1733- * Sets the mode identified by the given mode to the specified value.
1734- *
1735- * @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)
1736- * @param mode The mode identifying the mode to set
1737- * @param value true to set the mode, false to reset it
1738- * @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal
1739- * is NULL or the mode does not correspond to a known mode
1740- *
1741- * @ingroup terminal
1742- */
1743- GHOSTTY_API GhosttyResult ghostty_terminal_mode_set (GhosttyTerminal terminal ,
1744- GhosttyMode mode ,
1745- bool value );
1746-
17471766/**
17481767 * Get data from a terminal instance.
17491768 *
0 commit comments