mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 06:24:56 +00:00
shorter notification for copying
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import type { MenuItemConstructorOptions } from 'electron'
|
||||
import { Observable, Subject, Subscription } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import colors from 'ansi-colors'
|
||||
import { NgZone, OnInit, OnDestroy, Injector, ViewChild, HostBinding, Input, ElementRef, InjectFlags } from '@angular/core'
|
||||
import { trigger, transition, style, animate, AnimationTriggerMetadata } from '@angular/animations'
|
||||
import { AppService, ConfigService, BaseTabComponent, ElectronService, HostAppService, HotkeysService, Platform, LogService, Logger, TabContextMenuItemProvider, SplitTabComponent } from 'terminus-core'
|
||||
import { AppService, ConfigService, BaseTabComponent, ElectronService, HostAppService, HotkeysService, NotificationsService, Platform, LogService, Logger, TabContextMenuItemProvider, SplitTabComponent } from 'terminus-core'
|
||||
|
||||
import { BaseSession, SessionsService } from '../services/sessions.service'
|
||||
import { TerminalFrontendService } from '../services/terminalFrontend.service'
|
||||
@@ -15,11 +14,6 @@ import { ResizeEvent } from './interfaces'
|
||||
import { TerminalDecorator } from './decorator'
|
||||
|
||||
|
||||
/** @hidden */
|
||||
export interface ToastrServiceProxy {
|
||||
info: (_: string) => void
|
||||
error: (_: string) => void
|
||||
}
|
||||
/**
|
||||
* A class to base your custom terminal tabs on
|
||||
*/
|
||||
@@ -82,7 +76,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
protected sessions: SessionsService
|
||||
protected electron: ElectronService
|
||||
protected terminalContainersService: TerminalFrontendService
|
||||
protected toastr: ToastrServiceProxy
|
||||
protected notifications: NotificationsService
|
||||
protected log: LogService
|
||||
protected decorators: TerminalDecorator[] = []
|
||||
protected contextMenuProviders: TabContextMenuItemProvider[]
|
||||
@@ -137,7 +131,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
this.sessions = injector.get(SessionsService)
|
||||
this.electron = injector.get(ElectronService)
|
||||
this.terminalContainersService = injector.get(TerminalFrontendService)
|
||||
this.toastr = injector.get(ToastrService)
|
||||
this.notifications = injector.get(NotificationsService)
|
||||
this.log = injector.get(LogService)
|
||||
this.decorators = injector.get<any>(TerminalDecorator, null, InjectFlags.Optional) as TerminalDecorator[]
|
||||
this.contextMenuProviders = injector.get<any>(TabContextMenuItemProvider, null, InjectFlags.Optional) as TabContextMenuItemProvider[]
|
||||
@@ -154,7 +148,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
if (this.frontend?.getSelection()) {
|
||||
this.frontend.copySelection()
|
||||
this.frontend.clearSelection()
|
||||
this.toastr.info('Copied')
|
||||
this.notifications.notice('Copied')
|
||||
} else {
|
||||
this.sendInput('\x03')
|
||||
}
|
||||
@@ -162,7 +156,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
case 'copy':
|
||||
this.frontend?.copySelection()
|
||||
this.frontend?.clearSelection()
|
||||
this.toastr.info('Copied')
|
||||
this.notifications.notice('Copied')
|
||||
break
|
||||
case 'paste':
|
||||
this.paste()
|
||||
@@ -454,9 +448,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
}
|
||||
if (cwd) {
|
||||
this.electron.clipboard.writeText(cwd)
|
||||
this.toastr.info('Copied')
|
||||
this.notifications.notice('Copied')
|
||||
} else {
|
||||
this.toastr.error('Shell does not support current path detection')
|
||||
this.notifications.error('Shell does not support current path detection')
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { Frontend, SearchOptions } from '../frontends/frontend'
|
||||
import { ConfigService } from 'terminus-core'
|
||||
import { ConfigService, NotificationsService } from 'terminus-core'
|
||||
|
||||
@Component({
|
||||
selector: 'search-panel',
|
||||
@@ -20,7 +19,7 @@ export class SearchPanelComponent {
|
||||
@Output() close = new EventEmitter()
|
||||
|
||||
constructor (
|
||||
private toastr: ToastrService,
|
||||
private notifications: NotificationsService,
|
||||
public config: ConfigService,
|
||||
) { }
|
||||
|
||||
@@ -35,7 +34,7 @@ export class SearchPanelComponent {
|
||||
}
|
||||
if (!this.frontend.findNext(this.query, { ...this.options, incremental: incremental || undefined })) {
|
||||
this.notFound = true
|
||||
this.toastr.error('Not found')
|
||||
this.notifications.notice('Not found')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +44,7 @@ export class SearchPanelComponent {
|
||||
}
|
||||
if (!this.frontend.findPrevious(this.query, { ...this.options, incremental: incremental || undefined })) {
|
||||
this.notFound = true
|
||||
this.toastr.error('Not found')
|
||||
this.notifications.notice('Not found')
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { MenuItemConstructorOptions } from 'electron'
|
||||
import { Injectable, NgZone, Optional, Inject } from '@angular/core'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, SplitTabComponent } from 'terminus-core'
|
||||
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, SplitTabComponent, NotificationsService } from 'terminus-core'
|
||||
import { TerminalTabComponent } from './components/terminalTab.component'
|
||||
import { UACService } from './services/uac.service'
|
||||
import { TerminalService } from './services/terminal.service'
|
||||
@@ -14,7 +13,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
||||
constructor (
|
||||
private config: ConfigService,
|
||||
private zone: NgZone,
|
||||
private toastr: ToastrService,
|
||||
private notifications: NotificationsService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
@@ -39,7 +38,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
||||
profile,
|
||||
]
|
||||
this.config.save()
|
||||
this.toastr.info('Saved')
|
||||
this.notifications.info('Saved')
|
||||
}),
|
||||
},
|
||||
]
|
||||
@@ -141,7 +140,7 @@ export class CopyPasteContextMenu extends TabContextMenuItemProvider {
|
||||
|
||||
constructor (
|
||||
private zone: NgZone,
|
||||
private toastr: ToastrService,
|
||||
private notifications: NotificationsService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
@@ -158,7 +157,7 @@ export class CopyPasteContextMenu extends TabContextMenuItemProvider {
|
||||
this.zone.run(() => {
|
||||
setTimeout(() => {
|
||||
tab.frontend?.copySelection()
|
||||
this.toastr.info('Copied')
|
||||
this.notifications.notice('Copied')
|
||||
})
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user