mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-22 12:29:53 +00:00
duplicate tab title and color when duplicating a tab - fixes #3588
This commit is contained in:
parent
6236ee95c3
commit
62a21b03ea
@ -100,7 +100,7 @@ export class AppService {
|
|||||||
hostApp.windowFocused$.subscribe(() => this._activeTab?.emitFocused())
|
hostApp.windowFocused$.subscribe(() => this._activeTab?.emitFocused())
|
||||||
|
|
||||||
this.tabClosed$.subscribe(async tab => {
|
this.tabClosed$.subscribe(async tab => {
|
||||||
const token = await tab.getRecoveryToken()
|
const token = await tabRecovery.getFullRecoveryToken(tab)
|
||||||
if (token) {
|
if (token) {
|
||||||
this.closedTabsStack.push(token)
|
this.closedTabsStack.push(token)
|
||||||
}
|
}
|
||||||
|
@ -24,20 +24,22 @@ export class TabRecoveryService {
|
|||||||
}
|
}
|
||||||
window.localStorage.tabsRecovery = JSON.stringify(
|
window.localStorage.tabsRecovery = JSON.stringify(
|
||||||
(await Promise.all(
|
(await Promise.all(
|
||||||
tabs
|
tabs.map(async tab => this.getFullRecoveryToken(tab))
|
||||||
.map(async tab => tab.getRecoveryToken().then(r => {
|
|
||||||
if (r) {
|
|
||||||
r.tabTitle = tab.title
|
|
||||||
if (tab.color) {
|
|
||||||
r.tabColor = tab.color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r
|
|
||||||
}))
|
|
||||||
)).filter(token => !!token)
|
)).filter(token => !!token)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getFullRecoveryToken (tab: BaseTabComponent): Promise<RecoveryToken|null> {
|
||||||
|
const token = await tab.getRecoveryToken()
|
||||||
|
if (token) {
|
||||||
|
token.tabTitle = tab.title
|
||||||
|
if (tab.color) {
|
||||||
|
token.tabColor = tab.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token
|
||||||
|
}
|
||||||
|
|
||||||
async recoverTab (token: RecoveryToken): Promise<RecoveredTab|null> {
|
async recoverTab (token: RecoveryToken): Promise<RecoveredTab|null> {
|
||||||
for (const provider of this.config.enabledServices(this.tabRecoveryProviders ?? [])) {
|
for (const provider of this.config.enabledServices(this.tabRecoveryProviders ?? [])) {
|
||||||
try {
|
try {
|
||||||
|
@ -30,7 +30,7 @@ export class TabsService {
|
|||||||
* Duplicates an existing tab instance (using the tab recovery system)
|
* Duplicates an existing tab instance (using the tab recovery system)
|
||||||
*/
|
*/
|
||||||
async duplicate (tab: BaseTabComponent): Promise<BaseTabComponent|null> {
|
async duplicate (tab: BaseTabComponent): Promise<BaseTabComponent|null> {
|
||||||
const token = await tab.getRecoveryToken()
|
const token = await this.tabRecovery.getFullRecoveryToken(tab)
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user