mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-24 19:13:31 +03:00
Merge branch 'master' into persistence
This commit is contained in:
commit
8a3906687a
@ -16,6 +16,7 @@ export class RenameTabModalComponent {
|
||||
ngOnInit () {
|
||||
setTimeout(() => {
|
||||
this.input.nativeElement.focus()
|
||||
this.input.nativeElement.select()
|
||||
}, 250)
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { SortableComponent } from 'ng2-dnd'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { BaseTabComponent } from './baseTab.component'
|
||||
import { RenameTabModalComponent } from './renameTabModal.component'
|
||||
import { HotkeysService } from '../services/hotkeys.service'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { AppService } from '../services/app.service'
|
||||
import { HostAppService, Platform } from '../services/hostApp.service'
|
||||
@ -38,8 +39,17 @@ export class TabHeaderComponent {
|
||||
private zone: NgZone,
|
||||
private hostApp: HostAppService,
|
||||
private ngbModal: NgbModal,
|
||||
private hotkeys: HotkeysService,
|
||||
private parentDraggable: SortableComponent,
|
||||
) { }
|
||||
) {
|
||||
this.hotkeys.matchedHotkey.subscribe((hotkey) => {
|
||||
if (this.app.activeTab === this.tab) {
|
||||
if (hotkey === 'rename-tab') {
|
||||
this.showRenameTabModal()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit () {
|
||||
if (this.hostApp.platform === Platform.macOS) {
|
||||
@ -50,7 +60,7 @@ export class TabHeaderComponent {
|
||||
})
|
||||
}
|
||||
|
||||
@HostListener('dblclick') onDoubleClick (): void {
|
||||
showRenameTabModal (): void {
|
||||
let modal = this.ngbModal.open(RenameTabModalComponent)
|
||||
modal.componentInstance.value = this.tab.customTitle || this.tab.title
|
||||
modal.result.then(result => {
|
||||
@ -59,6 +69,10 @@ export class TabHeaderComponent {
|
||||
}).catch(() => null)
|
||||
}
|
||||
|
||||
@HostListener('dblclick') onDoubleClick (): void {
|
||||
this.showRenameTabModal()
|
||||
}
|
||||
|
||||
@HostListener('auxclick', ['$event']) async onAuxClick ($event: MouseEvent) {
|
||||
if ($event.which === 2) {
|
||||
this.app.closeTab(this.tab, true)
|
||||
@ -97,6 +111,10 @@ export class TabHeaderComponent {
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
label: 'Rename',
|
||||
click: () => this.zone.run( () => this.showRenameTabModal() )
|
||||
},
|
||||
{
|
||||
label: 'Color',
|
||||
sublabel: COLORS.find(x => x.value === this.tab.color).name,
|
||||
|
@ -11,6 +11,8 @@ hotkeys:
|
||||
toggle-last-tab:
|
||||
- ['Ctrl-A', 'A']
|
||||
- ['Ctrl-A', 'Ctrl-A']
|
||||
rename-tab:
|
||||
- 'Ctrl-Shift-R'
|
||||
next-tab:
|
||||
- 'Ctrl-Shift-ArrowRight'
|
||||
- ['Ctrl-A', 'N']
|
||||
|
@ -8,6 +8,8 @@ hotkeys:
|
||||
close-tab:
|
||||
- '⌘-W'
|
||||
toggle-last-tab: []
|
||||
rename-tab:
|
||||
- '⌘-R'
|
||||
next-tab:
|
||||
- 'Ctrl-Tab'
|
||||
previous-tab:
|
||||
|
@ -11,6 +11,8 @@ hotkeys:
|
||||
toggle-last-tab:
|
||||
- ['Ctrl-A', 'A']
|
||||
- ['Ctrl-A', 'Ctrl-A']
|
||||
rename-tab:
|
||||
- 'Ctrl-Shift-R'
|
||||
next-tab:
|
||||
- 'Ctrl-Shift-ArrowRight'
|
||||
- ['Ctrl-A', 'N']
|
||||
|
@ -215,6 +215,10 @@ export class AppHotkeyProvider extends HotkeyProvider {
|
||||
id: 'toggle-fullscreen',
|
||||
name: 'Toggle fullscreen mode',
|
||||
},
|
||||
{
|
||||
id: 'rename-tab',
|
||||
name: 'Rename Tab',
|
||||
},
|
||||
{
|
||||
id: 'close-tab',
|
||||
name: 'Close tab',
|
||||
|
@ -278,9 +278,9 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
let wheelDeltaY = 0
|
||||
|
||||
if ('wheelDeltaY' in event) {
|
||||
wheelDeltaY = (event as MouseWheelEvent).wheelDeltaY
|
||||
wheelDeltaY = (event as MouseWheelEvent)['wheelDeltaY']
|
||||
} else {
|
||||
wheelDeltaY = (event as MouseWheelEvent).deltaY
|
||||
wheelDeltaY = (event as MouseWheelEvent)['deltaY']
|
||||
}
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user