Skip to content

Commit

Permalink
Add window transparency!
Browse files Browse the repository at this point in the history
  • Loading branch information
ckissane committed Aug 12, 2019
1 parent d83eabb commit 6b048cc
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 64 deletions.
6 changes: 2 additions & 4 deletions build/gulpfile.vscode.js
Expand Up @@ -189,7 +189,8 @@ function getElectron(arch) {
platform: process.platform,
arch,
ffmpegChromium: true,
keepDefaultApp: true
keepDefaultApp: true,
enableTransparentVisuals: true
});

return gulp.src('package.json')
Expand Down Expand Up @@ -365,15 +366,12 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
.pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true })))
.pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version'], { dot: true }));

if (platform === 'linux') {
result = es.merge(result, gulp.src('resources/completions/bash/code', { base: '.' })
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename(function (f) { f.basename = product.applicationName; })));

result = es.merge(result, gulp.src('resources/completions/zsh/_code', { base: '.' })
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename(function (f) { f.basename = '_' + product.applicationName; })));
}

if (platform === 'win32') {
result = es.merge(result, gulp.src('resources/win32/bin/code.js', { base: 'resources/win32', allowEmpty: true }));
Expand Down
25 changes: 14 additions & 11 deletions extensions/theme-defaults/themes/dark_defaults.json
Expand Up @@ -2,21 +2,24 @@
"$schema": "vscode://schemas/color-theme",
"name": "Dark Default Colors",
"colors": {
"editor.background": "#1E1E1E",
"editor.background": "#1E1E1E00",
"editor.foreground": "#D4D4D4",
"editor.inactiveSelectionBackground": "#3A3D41",
"editorIndentGuide.background": "#404040",
"editorIndentGuide.activeBackground": "#707070",
"editor.inactiveSelectionBackground": "#3A3D4188",
"editorIndentGuide.background": "#40404000",
"editorIndentGuide.activeBackground": "#70707000",
"editor.selectionHighlightBackground": "#ADD6FF26",
"list.dropBackground": "#383B3D",
"activityBarBadge.background": "#007ACC",
"editor.lineHighlightBorder": "#ffffff30",
"list.dropBackground": "#383B3D88",
"activityBarBadge.background": "#007ACC88",
"sideBarTitle.foreground": "#BBBBBB",
"input.placeholderForeground": "#A6A6A6",
"settings.textInputBackground": "#292929",
"settings.numberInputBackground": "#292929",
"menu.background": "#252526",
"settings.textInputBackground": "#29292988",
"settings.numberInputBackground": "#29292988",
"menu.background": "#25252688",
"menu.foreground": "#CCCCCC",
"statusBarItem.remoteForeground": "#FFF",
"statusBarItem.remoteBackground": "#16825D"
"statusBarItem.remoteBackground": "#16825D88",
"terminal.background": "#00000000",
"terminal.ansiBlack": "00000030"
}
}
}
44 changes: 22 additions & 22 deletions extensions/theme-monokai/themes/monokai-color-theme.json
Expand Up @@ -8,34 +8,34 @@
"type": "dark",
"colors": {
"dropdown.background": "#414339",
"list.activeSelectionBackground": "#75715E",
"list.focusBackground": "#414339",
"list.activeSelectionBackground": "#75715E30",
"list.focusBackground": "#41433930",
"dropdown.listBackground": "#1e1f1c",
"settings.textInputBackground": "#32342d",
"settings.numberInputBackground": "#32342d",
"list.inactiveSelectionBackground": "#414339",
"settings.textInputBackground": "#32342d30",
"settings.numberInputBackground": "#32342d30",
"list.inactiveSelectionBackground": "#41433930",
"list.hoverBackground": "#3e3d32",
"list.dropBackground": "#414339",
"list.highlightForeground": "#f8f8f2",
"button.background": "#75715E",
"editor.background": "#272822",
"button.background": "#75715E30",
"editor.background": "#27282210",
"editor.foreground": "#f8f8f2",
"selection.background": "#ccccc7",
"editor.selectionHighlightBackground": "#575b6180",
"editor.selectionBackground": "#878b9180",
"editor.wordHighlightBackground": "#4a4a7680",
"editor.wordHighlightStrongBackground": "#6a6a9680",
"editor.lineHighlightBackground": "#3e3d32",
"editor.lineHighlightBackground": "#8d8b7530",
"editorLineNumber.activeForeground": "#c2c2bf",
"editorCursor.foreground": "#f8f8f0",
"editorWhitespace.foreground": "#464741",
"editorIndentGuide.background": "#464741",
"editorIndentGuide.activeBackground": "#767771",
"editorGroupHeader.tabsBackground": "#1e1f1c",
"editorIndentGuide.background": "#46474100",
"editorIndentGuide.activeBackground": "#76777130",
"editorGroupHeader.tabsBackground": "#1e1f1c30",
"editorGroup.dropBackground": "#41433980",
"tab.inactiveBackground": "#34352f",
"tab.border": "#1e1f1c",
"tab.modifiedBorder": "#007acc",
"tab.inactiveBackground": "#34352f30",
"tab.border": "#1e1f1c30",
"tab.modifiedBorder": "#007acc30",
"tab.inactiveForeground": "#ccccc7", // needs to be bright so it's readable when another editor group is focused
"widget.shadow": "#000000",
"progressBar.background": "#75715E",
Expand All @@ -46,23 +46,23 @@
"panelTitle.activeBorder": "#75715E",
"panelTitle.inactiveForeground": "#75715E",
"panel.border": "#414339",
"titleBar.activeBackground": "#1e1f1c",
"titleBar.activeBackground": "#1e1f1c30",
"statusBar.background": "#414339",
"statusBar.noFolderBackground": "#414339",
"statusBar.debuggingBackground": "#75715E",
"statusBarItem.remoteBackground": "#AC6218",
"activityBar.background": "#272822",
"activityBar.background": "#27282230",
"activityBar.foreground": "#f8f8f2",
"activityBar.dropBackground": "#414339",
"sideBar.background": "#1e1f1c",
"sideBarSectionHeader.background": "#272822",
"activityBar.dropBackground": "#41433930",
"sideBar.background": "#1e1f1c30",
"sideBarSectionHeader.background": "#27282230",
"menu.background": "#1e1f1c",
"menu.foreground": "#cccccc",
"pickerGroup.foreground": "#75715E",
"input.background": "#414339",
"inputOption.activeBorder": "#75715E",
"focusBorder": "#75715E",
"editorWidget.background": "#1e1f1c",
"editorWidget.background": "#1e1f1c30",
"debugToolBar.background": "#1e1f1c",
"diffEditor.insertedTextBackground": "#66852880", // middle of #272822 and #a6e22e
"diffEditor.removedTextBackground": "#90274A80", // middle of #272822 and #f92672
Expand All @@ -84,7 +84,7 @@
"peekViewResult.selectionBackground": "#414339",
"peekViewResult.matchHighlightBackground": "#75715E",
"peekViewEditor.matchHighlightBackground": "#75715E",
"terminal.ansiBlack": "#333333",
"terminal.ansiBlack": "#33333330",
"terminal.ansiRed": "#C4265E", // the bright color with ~75% transparent on the background
"terminal.ansiGreen": "#86B42B",
"terminal.ansiYellow": "#B3B42B",
Expand Down Expand Up @@ -122,7 +122,7 @@
"name": "Comment",
"scope": "comment",
"settings": {
"foreground": "#75715E"
"foreground": "#c5be9d"
}
},
{
Expand Down
44 changes: 31 additions & 13 deletions src/vs/code/electron-main/window.ts
Expand Up @@ -51,7 +51,7 @@ interface ITouchBarSegment extends Electron.SegmentedControlSegment {
export class CodeWindow extends Disposable implements ICodeWindow {

private static readonly MIN_WIDTH = 200;
private static readonly MIN_HEIGHT = 120;
private static readonly MIN_HEIGHT = 160;

private static readonly MAX_URL_LENGTH = 2 * 1024 * 1024; // https://cs.chromium.org/chromium/src/url/url_constants.cc?l=32

Expand Down Expand Up @@ -91,20 +91,20 @@ export class CodeWindow extends Disposable implements ICodeWindow {
this._readyState = ReadyState.NONE;
this.whenReadyCallbacks = [];

// create browser window
this.createBrowserWindow(config);
// create browser window
this.createBrowserWindow(config);

// respect configured menu bar visibility
this.onConfigurationUpdated();
// respect configured menu bar visibility
this.onConfigurationUpdated();

// macOS: touch bar support
this.createTouchBar();
// macOS: touch bar support
this.createTouchBar();

// Request handling
this.handleMarketplaceRequests();
// Request handling
this.handleMarketplaceRequests();

// Eventing
this.registerListeners();
// Eventing
this.registerListeners();
}

private createBrowserWindow(config: IWindowCreationOptions): void {
Expand All @@ -117,15 +117,16 @@ export class CodeWindow extends Disposable implements ICodeWindow {
const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen);

const options: Electron.BrowserWindowConstructorOptions = {
width: this.windowState.width,
height: this.windowState.height,
width: 160,
height: 160,
x: this.windowState.x,
y: this.windowState.y,
backgroundColor: this.themeMainService.getBackgroundColor(),
minWidth: CodeWindow.MIN_WIDTH,
minHeight: CodeWindow.MIN_HEIGHT,
show: !isFullscreenOrMaximized,
title: product.nameLong,
transparent: true,
webPreferences: {
// By default if Code is in the background, intervals and timeouts get throttled, so we
// want to enforce that Code stays in the foreground. This triggers a disable_hidden_
Expand Down Expand Up @@ -195,6 +196,12 @@ export class CodeWindow extends Disposable implements ICodeWindow {
});
}
}
this._win.setBounds({
width: this.windowState.width || defaultWindowState().width!,
height: this.windowState.height || defaultWindowState().height!,
x: this.windowState.x || 0,
y: this.windowState.y || 0
});

if (isFullscreenOrMaximized) {
this._win.maximize();
Expand Down Expand Up @@ -360,6 +367,17 @@ export class CodeWindow extends Disposable implements ICodeWindow {

this.pendingLoadConfig = undefined;
}

// To prevent flashing, we set the window visible after the page has finished to load but before Code is loaded
if (this._win && !this._win.isVisible()) {
if (this.windowState.mode === WindowMode.Maximized) {
this._win.maximize();
}

if (!this._win.isVisible()) { // maximize also makes visible
this._win.show();
}
}
});

// Window Focus
Expand Down
5 changes: 3 additions & 2 deletions src/vs/code/electron-main/windows.ts
Expand Up @@ -380,6 +380,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}

open(openConfig: IOpenConfiguration): ICodeWindow[] {
setTimeout(() => {
this.logService.trace('windowsManager#open');
openConfig = this.validateOpenConfig(openConfig);

Expand Down Expand Up @@ -511,8 +512,8 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
if (openConfig.context === OpenContext.CLI && waitMarkerFileURI && usedWindows.length === 1 && usedWindows[0]) {
this.waitForWindowCloseOrLoad(usedWindows[0].id).then(() => fs.unlink(waitMarkerFileURI.fsPath, _error => undefined));
}

return usedWindows;
}, 100);
return [];
}

private validateOpenConfig(config: IOpenConfiguration): IOpenConfiguration {
Expand Down
5 changes: 3 additions & 2 deletions src/vs/editor/browser/viewParts/minimap/minimap.ts
Expand Up @@ -396,7 +396,7 @@ class MinimapBuffers {
private _lastUsedBuffer: number;

constructor(ctx: CanvasRenderingContext2D, WIDTH: number, HEIGHT: number, background: RGBA8) {
this._backgroundFillData = MinimapBuffers._createBackgroundFillData(WIDTH, HEIGHT, background);
this._backgroundFillData = MinimapBuffers._createBackgroundFillData(WIDTH, HEIGHT, new RGBA8(0,0,0,0));
this._buffers = [
ctx.createImageData(WIDTH, HEIGHT),
ctx.createImageData(WIDTH, HEIGHT)
Expand All @@ -419,6 +419,7 @@ class MinimapBuffers {
const backgroundR = background.r;
const backgroundG = background.g;
const backgroundB = background.b;
const backgroundA = background.a;

const result = new Uint8ClampedArray(WIDTH * HEIGHT * 4);
let offset = 0;
Expand All @@ -427,7 +428,7 @@ class MinimapBuffers {
result[offset] = backgroundR;
result[offset + 1] = backgroundG;
result[offset + 2] = backgroundB;
result[offset + 3] = 255;
result[offset + 3] = backgroundA;
offset += 4;
}
}
Expand Down

0 comments on commit 6b048cc

Please sign in to comment.