mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Adding logic to support working directory config (#3769)
* #3000: Adding logic to support working directory config * #3000: Removing unused import * #3000: Removing extra space
This commit is contained in:
parent
76eff24484
commit
19644f3fa2
2 changed files with 13 additions and 2 deletions
|
|
@ -57,6 +57,9 @@ module.exports = {
|
|||
// custom CSS to embed in the terminal window
|
||||
termCSS: '',
|
||||
|
||||
// set custom startup directory (must be an absolute path)
|
||||
workingDirectory: '',
|
||||
|
||||
// if you're using a Linux setup which show native menus, set to false
|
||||
// default: `true` on Linux, `true` on Windows, ignored on macOS
|
||||
showHamburgerMenu: '',
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const fileUriToPath = require('file-uri-to-path');
|
|||
const isDev = require('electron-is-dev');
|
||||
const updater = require('../updater');
|
||||
const toElectronBackgroundColor = require('../utils/to-electron-background-color');
|
||||
const {icon, homeDirectory} = require('../config/paths');
|
||||
const {icon, cfgDir} = require('../config/paths');
|
||||
const createRPC = require('../rpc');
|
||||
const notify = require('../notify');
|
||||
const fetchNotifications = require('../notifications');
|
||||
|
|
@ -55,6 +55,14 @@ module.exports = class Window {
|
|||
window.setBackgroundColor(toElectronBackgroundColor(cfg_.backgroundColor || '#000'));
|
||||
};
|
||||
|
||||
// set working directory
|
||||
let workingDirectory = cfgDir;
|
||||
if (process.argv[1] && isAbsolute(process.argv[1])) {
|
||||
workingDirectory = process.argv[1];
|
||||
} else if (cfg.workingDirectory && isAbsolute(cfg.workingDirectory)) {
|
||||
workingDirectory = cfg.workingDirectory;
|
||||
}
|
||||
|
||||
// config changes
|
||||
const cfgUnsubscribe = app.config.subscribe(() => {
|
||||
const cfg_ = app.plugins.getDecoratedConfig();
|
||||
|
|
@ -106,7 +114,7 @@ module.exports = class Window {
|
|||
{
|
||||
rows: 40,
|
||||
cols: 100,
|
||||
cwd: process.argv[1] && isAbsolute(process.argv[1]) ? process.argv[1] : homeDirectory,
|
||||
cwd: workingDirectory,
|
||||
splitDirection: undefined,
|
||||
shell: cfg.shell,
|
||||
shellArgs: cfg.shellArgs && Array.from(cfg.shellArgs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue