diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index de92390b..304435c9 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -609,10 +609,20 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit protected async handleRightMouseUp (event: MouseEvent): Promise { event.preventDefault() event.stopPropagation() - if (this.config.store.terminal.rightClick === 'paste') { + if (this.config.store.terminal.rightClick === 'paste' + || this.config.store.terminal.rightClick === 'clipboard') { const duration = Date.now() - this.rightMouseDownTime if (duration < 250) { - this.paste() + if (this.config.store.terminal.rightClick === 'paste') { + this.paste() + } else if (this.config.store.terminal.rightClick === 'clipboard') { + if (this.frontend?.getSelection()) { + this.frontend.copySelection() + this.frontend.clearSelection() + } else { + this.paste() + } + } } else { this.platform.popupContextMenu(await this.buildContextMenu(), event) } diff --git a/tabby-terminal/src/components/terminalSettingsTab.component.pug b/tabby-terminal/src/components/terminalSettingsTab.component.pug index d9316b7e..85f1311c 100644 --- a/tabby-terminal/src/components/terminalSettingsTab.component.pug +++ b/tabby-terminal/src/components/terminalSettingsTab.component.pug @@ -71,32 +71,15 @@ div.mt-4 .header .title(translate) Right click .description(*ngIf='config.store.terminal.rightClick == "paste"', translate) Long-click for context menu - .btn-group( + + select.form-control( [(ngModel)]='config.store.terminal.rightClick', - (ngModelChange)='config.save()', - ngbRadioGroup + (ngModelChange)='config.save()' ) - label.btn.btn-secondary(ngbButtonLabel) - input( - type='radio', - ngbButton, - value='off' - ) - span(translate) Off - label.btn.btn-secondary(ngbButtonLabel) - input( - type='radio', - ngbButton, - value='menu' - ) - span(translate) Context menu - label.btn.btn-secondary(ngbButtonLabel) - input( - type='radio', - ngbButton, - value='paste' - ) - span(translate) Paste + option(ngValue='off', translate) Off + option(ngValue='menu', translate) Context menu + option(ngValue='paste', translate) Paste + option(ngValue='clipboard', translate) Paste if no selection, else copy .form-line .header diff --git a/tabby-terminal/src/config.ts b/tabby-terminal/src/config.ts index 0d6e0c8a..bbcfaffa 100644 --- a/tabby-terminal/src/config.ts +++ b/tabby-terminal/src/config.ts @@ -122,7 +122,7 @@ export class TerminalConfigProvider extends ConfigProvider { [Platform.Windows]: { terminal: { font: 'Consolas', - rightClick: 'paste', + rightClick: 'clipboard', pasteOnMiddleClick: false, copyOnSelect: true, },