Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/apprt/gtk/class/surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2582,10 +2582,14 @@ pub const Surface = extern struct {
//
// It's better to do this here rather than within the core callback
// since we have direct access to the underlying gdk.Event here.
if (!consumed and button == .left and !surface.hasSelection()) {
if (!self.showOnScreenKeyboard(event)) {
log.warn("failed to activate the on-screen keyboard", .{});
}
const config = priv.config orelse return;
switch (config.get().@"gtk-on-screen-keyboard") {
.auto => if (!consumed and button == .left and !surface.hasSelection()) {
if (!self.showOnScreenKeyboard(event)) {
log.warn("failed to activate the on-screen keyboard", .{});
}
},
.never => {},
}
}

Expand Down
32 changes: 32 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,32 @@ else
/// Available since: 1.1.0
@"gtk-custom-css": RepeatablePath = .{},

/// Whether to enable the on-screen keyboard (OSK).
///
/// The on-screen keyboard is an accessibility feature for users using tablets
/// and/or touch devices, who do not have access to a physical keyboard.
///
/// The OSK must first be enabled in your desktop environment's accessibility
/// settings in order to show up in Ghostty — for GNOME, you need to open the
/// Settings app, and turn on the "Screen Keyboard" feature under the
/// "Accessibility" category. Other OSK implementations may be enabled through
/// other means.
///
/// Valid values:
///
/// * `auto` (default)
///
/// Automatically trigger the OSK when focusing on a terminal surface.
///
/// * `never`
///
/// Never trigger the OSK. Users who'd like to use the OSK to input
/// characters need to manually trigger it themselves, either via the
/// `show_on_screen_keyboard` action or through system settings.
///
/// Available since: 1.3.0
@"gtk-on-screen-keyboard": GtkOnScreenKeyboard = .auto,

/// If `true` (default), applications running in the terminal can show desktop
/// notifications using certain escape sequences such as OSC 9 or OSC 777.
@"desktop-notifications": bool = true,
Expand Down Expand Up @@ -7354,6 +7380,12 @@ pub const GtkTitlebarStyle = enum(c_int) {
};
};

/// See gtk-on-screen-keyboard
pub const GtkOnScreenKeyboard = enum {
auto,
never,
};

/// See app-notifications
pub const AppNotifications = packed struct {
@"clipboard-copy": bool = true,
Expand Down