Skip to content

Commit

Permalink
Force DejaVu Sans Mono font in terminal on Fedora
Browse files Browse the repository at this point in the history
Fixes #35644
  • Loading branch information
Tyriar committed Oct 10, 2017
1 parent 53b2740 commit 2b526bc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/vs/workbench/parts/terminal/electron-browser/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as cp from 'child_process';
import * as os from 'os';
import * as platform from 'vs/base/common/platform';
import * as processes from 'vs/base/node/processes';
import { readFile, fileExists } from 'vs/base/node/pfs';

export const TERMINAL_DEFAULT_SHELL_LINUX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_OSX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
Expand All @@ -21,3 +22,19 @@ export const TERMINAL_DEFAULT_SHELL_WINDOWS = isAtLeastWindows10 ? powerShellPat
export interface ITerminalProcessFactory {
create(env: { [key: string]: string }): cp.ChildProcess;
}

if (platform.isLinux) {
fileExists('/etc/os-release').then(exists => {
if (!exists) {
return;
}
readFile('/etc/os-release').then(b => {
const contents = b.toString();
if (contents.indexOf('NAME=Fedora')) {
isFedora = true;
}
});
});
}

export let isFedora = false;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { ITerminalConfiguration, ITerminalConfigHelper, ITerminalFont, IShellLaunchConfig, IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY } from 'vs/workbench/parts/terminal/common/terminal';
import { TPromise } from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import { isFedora } from 'vs/workbench/parts/terminal/electron-browser/terminal';

interface IEditorConfiguration {
editor: IEditorOptions;
Expand Down Expand Up @@ -89,7 +90,15 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
const editorConfig = (<IEditorConfiguration>config).editor;
const terminalConfig = this.config;

const fontFamily = terminalConfig.fontFamily || editorConfig.fontFamily;
let fontFamily = terminalConfig.fontFamily || editorConfig.fontFamily;

// Work around bad font on Fedora
if (!terminalConfig.fontFamily) {
if (isFedora) {
fontFamily = '\'DejaVu Sans Mono\'';
}
}

let fontSize = this._toInteger(terminalConfig.fontSize, 0);
if (fontSize <= 0) {
fontSize = EDITOR_FONT_DEFAULTS.fontSize;
Expand Down

0 comments on commit 2b526bc

Please sign in to comment.