Skip to content

Commit

Permalink
Disallow OSC 52 for unfocused window
Browse files Browse the repository at this point in the history
This leads to issues on macOS, since if we store clipboard at the same
time it could error out. Also, on e.g. Wayland the clipboard store for
unfocused window won't work anyway.
  • Loading branch information
kchibisov authored Apr 3, 2022
1 parent 49d64fb commit 851dbc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- The `--help` output was reworked with a new colorful syntax
- OSC 52 is now disabled on unfocused windows

### Fixed

Expand Down
10 changes: 7 additions & 3 deletions alacritty/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,11 +1078,15 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
}
},
TerminalEvent::ClipboardStore(clipboard_type, content) => {
self.ctx.clipboard.store(clipboard_type, content);
if self.ctx.terminal.is_focused {
self.ctx.clipboard.store(clipboard_type, content);
}
},
TerminalEvent::ClipboardLoad(clipboard_type, format) => {
let text = format(self.ctx.clipboard.load(clipboard_type).as_str());
self.ctx.write_to_pty(text.into_bytes());
if self.ctx.terminal.is_focused {
let text = format(self.ctx.clipboard.load(clipboard_type).as_str());
self.ctx.write_to_pty(text.into_bytes());
}
},
TerminalEvent::ColorRequest(index, format) => {
let color = self.ctx.terminal().colors()[index]
Expand Down

0 comments on commit 851dbc3

Please sign in to comment.