mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-02 17:39:54 +00:00
added 'duplicate as admin' tab menu item
This commit is contained in:
parent
62c1f6463b
commit
5a9625424c
@ -2,6 +2,8 @@ import { Injectable, NgZone } from '@angular/core'
|
|||||||
import { ToastrService } from 'ngx-toastr'
|
import { ToastrService } from 'ngx-toastr'
|
||||||
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider } from 'terminus-core'
|
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider } from 'terminus-core'
|
||||||
import { TerminalTabComponent } from './components/terminalTab.component'
|
import { TerminalTabComponent } from './components/terminalTab.component'
|
||||||
|
import { UACService } from './services/uac.service'
|
||||||
|
import { TerminalService } from './services/terminal.service'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -10,6 +12,8 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
|||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
private toastr: ToastrService,
|
private toastr: ToastrService,
|
||||||
|
private uac: UACService,
|
||||||
|
private terminalService: TerminalService,
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
@ -18,7 +22,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
|||||||
if (!(tab instanceof TerminalTabComponent)) {
|
if (!(tab instanceof TerminalTabComponent)) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return [
|
const items: Electron.MenuItemConstructorOptions[] = [
|
||||||
{
|
{
|
||||||
label: 'Save as profile',
|
label: 'Save as profile',
|
||||||
click: () => this.zone.run(async () => {
|
click: () => this.zone.run(async () => {
|
||||||
@ -38,5 +42,19 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if (this.uac.isAvailable) {
|
||||||
|
items.push({
|
||||||
|
label: 'Duplicate as administrator',
|
||||||
|
click: () => this.zone.run(async () => {
|
||||||
|
this.terminalService.openTabWithOptions({
|
||||||
|
...tab.sessionOptions,
|
||||||
|
runAsAdministrator: true,
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user