Skip to content

Commit

Permalink
copy hotkey for macOS (fixes #61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jul 5, 2017
1 parent fc060ac commit deb4b96
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions terminus-terminal/src/components/terminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export class TerminalTabComponent extends BaseTabComponent {
this.session.releaseInitialDataBuffer()
})
this.hotkeysSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => {
if (!this.hasFocus) {
return
}
if (hotkey === 'copy') {
this.hterm.copySelectionToClipboard()
}
if (hotkey === 'zoom-in') {
this.zoomIn()
}
Expand Down
9 changes: 9 additions & 0 deletions terminus-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class TerminalConfigProvider extends ConfigProvider {
shell: '~default-shell~',
},
hotkeys: {
'copy': [
'⌘-C',
],
'zoom-in': [
'⌘-=',
'⌘-Shift-+',
Expand All @@ -69,6 +72,9 @@ export class TerminalConfigProvider extends ConfigProvider {
shell: '~clink~',
},
hotkeys: {
'copy': [
'Ctrl-Shift-C',
],
'zoom-in': [
'Ctrl-=',
'Ctrl-Shift-+',
Expand All @@ -93,6 +99,9 @@ export class TerminalConfigProvider extends ConfigProvider {
shell: '~default-shell~',
},
hotkeys: {
'copy': [
'Ctrl-Shift-C',
],
'zoom-in': [
'Ctrl-=',
'Ctrl-Shift-+',
Expand Down
4 changes: 4 additions & 0 deletions terminus-terminal/src/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { IHotkeyDescription, HotkeyProvider } from 'terminus-core'
@Injectable()
export class TerminalHotkeyProvider extends HotkeyProvider {
hotkeys: IHotkeyDescription[] = [
{
id: 'copy',
name: 'Copy to clipboard',
},
{
id: 'zoom-in',
name: 'Zoom in',
Expand Down

0 comments on commit deb4b96

Please sign in to comment.