Skip to content

Commit

Permalink
show modal only if window is focused
Browse files Browse the repository at this point in the history
fixes #122450
  • Loading branch information
sbatten committed May 4, 2021
1 parent 1469a98 commit c2a8d68
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { Schemas } from 'vs/base/common/network';
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from 'vs/workbench/common/theme';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { splitName } from 'vs/base/common/labels';
import { IHostService } from 'vs/workbench/services/host/browser/host';

const STARTUP_PROMPT_SHOWN_KEY = 'workspace.trust.startupPrompt.shown';

Expand All @@ -58,12 +59,23 @@ export class WorkspaceTrustRequestHandler extends Disposable implements IWorkben
@IConfigurationService private readonly configurationService: IConfigurationService,
@IStorageService private readonly storageService: IStorageService,
@IWorkspaceTrustRequestService private readonly workspaceTrustRequestService: IWorkspaceTrustRequestService,
@IHostService private readonly hostService: IHostService,
) {
super();

if (isWorkspaceTrustEnabled(configurationService)) {
this.registerListeners();
this.showModalOnStart();

if (this.hostService.hasFocus) {
this.showModalOnStart();
} else {
const focusDisposable = this.hostService.onDidChangeFocus(focused => {
if (focused) {
focusDisposable.dispose();
this.showModalOnStart();
}
});
}
}
}

Expand Down

0 comments on commit c2a8d68

Please sign in to comment.