Skip to content
Merged
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: 12 additions & 0 deletions src/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4443,6 +4443,18 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
return false;
},

.copy_title_to_clipboard => {
const title = self.rt_surface.getTitle() orelse return false;
if (title.len == 0) return false;

self.rt_surface.setClipboardString(title, .standard, false) catch |err| {
log.err("error copying title to clipboard err={}", .{err});
return true;
};

return true;
},

.paste_from_clipboard => try self.startClipboardRequest(
.standard,
.{ .paste = {} },
Expand Down
5 changes: 5 additions & 0 deletions src/input/Binding.zig
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ pub const Action = union(enum) {
/// If there is a URL under the cursor, copy it to the default clipboard.
copy_url_to_clipboard,

/// Copy the terminal title to the clipboard. If the terminal title is not
/// set or is empty this has no effect.
copy_title_to_clipboard,

/// Increase the font size by the specified amount in points (pt).
///
/// For example, `increase_font_size:1.5` will increase the font size
Expand Down Expand Up @@ -1005,6 +1009,7 @@ pub const Action = union(enum) {
.reset,
.copy_to_clipboard,
.copy_url_to_clipboard,
.copy_title_to_clipboard,
.paste_from_clipboard,
.paste_from_selection,
.increase_font_size,
Expand Down
6 changes: 6 additions & 0 deletions src/input/command.zig
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Copy the URL under the cursor to the clipboard.",
}},

.copy_title_to_clipboard => comptime &.{.{
.action = .copy_title_to_clipboard,
.title = "Copy Terminal Title to Clipboard",
.description = "Copy the terminal title to the clipboard. If the terminal title is not set this has no effect.",
}},

.paste_from_clipboard => comptime &.{.{
.action = .paste_from_clipboard,
.title = "Paste from Clipboard",
Expand Down