Compare commits

...

63 Commits

Author SHA1 Message Date
Eugene Pankov
eed01e76ad fixed cwd for new tabs on windows (fixes #378) 2018-09-23 09:25:49 -07:00
Eugene Pankov
7f8d012a8a shell context menu integration (fixes #362) 2018-09-23 09:23:20 -07:00
Eugene Pankov
9ad1371c2b theme fix 2018-09-23 09:11:42 -07:00
Eugene Pankov
0d37f4736a build fix 2018-09-23 17:09:11 +02:00
Eugene Pankov
e71d404c2b added CLI option to paste text into terminal 2018-09-23 16:33:57 +02:00
Eugene Pankov
0545471f3c added Automator workflows 2018-09-23 15:38:57 +02:00
Eugene Pankov
a04c60046e new light theme 2018-09-23 14:10:19 +02:00
Eugene Pankov
5c2003cc2f added a portable build 2018-09-22 13:14:51 +02:00
Eugene Pankov
dc864781e4 fixed focus detection (fixes #185) 2018-09-22 12:27:34 +02:00
Eugene Pankov
e315654d0a build fix 2018-09-22 12:19:14 +02:00
Eugene Pankov
5863ea0de1 fixed exiting fullscreen with vibrancy (fixes #407) 2018-09-22 12:03:43 +02:00
Eugene Pankov
cce49c69d6 bumps 2018-09-22 12:00:58 +02:00
Eugene Pankov
3e41d0df4e yarn 2018-09-22 11:48:57 +02:00
Eugene Pankov
507b69acb4 sensible shell defaults for Windows (fixes #431) 2018-09-22 11:48:51 +02:00
Eugene Pankov
6b08341760 support multiple WSL distributions 2018-09-22 11:37:37 +02:00
Eugene Pankov
62bf681598 fixed visual bell (fixes #419) 2018-09-20 13:04:50 +02:00
Eugene Pankov
e403a423b7 window management fixes (fixes #426) 2018-09-20 13:02:07 +02:00
Eugene Pankov
6b49cdc974 properly pass cwd from a second instance 2018-09-20 13:01:42 +02:00
Eugene Pankov
5fe71b8169 hide menu on Linux and Windows 2018-09-20 13:01:25 +02:00
Eugene Pankov
6bc2d18f3c faster tab creation 2018-09-20 12:46:50 +02:00
Eugene Pankov
6fa5ab5eb2 scroll terminal to bottom on user input 2018-09-20 12:12:57 +02:00
Eugene Pankov
2411713501 include proper tags in github issues 2018-09-20 12:12:45 +02:00
Eugene Pankov
947e0f8b66 theme tweaks 2018-09-20 12:12:38 +02:00
Eugene Pankov
f8bc94fe78 theme tweak 2018-09-20 11:55:23 +02:00
Eugene Pankov
5a32a45b19 theme tweaks 2018-09-20 11:46:47 +02:00
Eugene Pankov
62222e67fb lint 2018-09-20 11:46:24 +02:00
Eugene Pankov
6aab782326 removed window close menu on macos 2018-09-20 11:46:17 +02:00
Eugene Pankov
cec349d021 faster tab switching 2018-09-20 11:42:51 +02:00
Eugene
c8b40647a9 Update README.md 2018-09-20 10:56:31 +02:00
Eugene
67ed830e97 Merge pull request #421 from vsailev/master
Update clink to v0.4.9
2018-09-16 06:16:11 -07:00
vsailev
975d4d62ef Update clink to v0.4.9 2018-09-16 11:05:40 +01:00
Eugene
275791517b Merge pull request #418 from BBJip/master
Save window state on close.
2018-09-12 22:43:55 -07:00
BBJip
9db452f489 save window state on close. 2018-09-13 01:25:08 +02:00
Eugene
5094262e68 Merge pull request #416 from Domain/master
Biding scripts
2018-09-12 05:07:56 -07:00
Domain
17cf0f59c9 Biding scripts 2018-09-12 20:05:45 +08:00
Eugene
aa805b912b Merge pull request #415 from Domain/master
Add keep alive in advanced setting
2018-09-12 05:01:38 -07:00
Domain
4b3cbc5639 Add keep alive in advanced setting 2018-09-12 10:40:58 +08:00
Eugene Pankov
6a59db1a36 build fix 2018-09-11 14:44:11 -07:00
Eugene Pankov
2d43e29bcd bumped hterm 2018-09-11 14:44:04 -07:00
Eugene Pankov
bf5e460bca autodetect powershell core path (fixes #382) 2018-09-11 13:52:33 -07:00
Eugene Pankov
d574f634c9 bumped plugin versions 2018-09-11 13:37:14 -07:00
Eugene Pankov
4ceb8ff897 theme fix 2018-09-10 17:40:57 +02:00
Eugene Pankov
0f8c27e536 fixed #403 2018-09-10 17:40:52 +02:00
Eugene Pankov
d6fb71dca2 fixed autofocus in input fields (fixes #374) 2018-09-10 17:23:36 +02:00
Eugene Pankov
38e450f70a Merge branch 'master' of github.com:Eugeny/terminus 2018-09-06 15:39:57 +02:00
Eugene Pankov
18c0a585a2 bumped electron (potentially fixes #408) 2018-09-06 15:39:35 +02:00
Domain
8a1c33b82a wrong URL (#412) 2018-09-05 11:57:20 +02:00
Domain
f81bda1686 Only MacOS support app.dock (#410) 2018-09-05 10:24:15 +02:00
Eugene Pankov
c285b89b6c fixed #297 2018-09-04 23:14:10 +02:00
Eugene Pankov
6dc46bb970 lint 2018-09-04 22:49:22 +02:00
Eugene Pankov
7d25816751 more cleanup 2018-09-04 22:49:12 +02:00
Eugene Pankov
d6f163b048 cleaned up #409 and renamed to Groups 2018-09-04 22:39:00 +02:00
Domain
f357dab8f0 style 2018-09-04 16:39:52 +08:00
Domain
0eaf857b02 Organize the connections in folders.
Filter connections in quick connect.
Need more custom CSS to handle long connection list.
See also #403
2018-09-04 16:36:01 +08:00
Domain
f367ea6c74 Merge branch 'master' of https://github.com/Eugeny/terminus 2018-09-04 16:28:20 +08:00
Eugene Pankov
dc4b984ed0 . 2018-08-31 16:57:10 +02:00
Eugene Pankov
4b7b692ace experimental support for multiple windows (fixes #212, fixes #170) 2018-08-31 15:41:28 +02:00
Eugene Pankov
0749096d9f smarter progress detection (fixes #406) 2018-08-31 12:41:58 +02:00
Domain
5b76947d70 Add login scripts support (#402)
* Support login scripts. Fix #344

* nowrap

* Follow the general Terminus style
2018-08-29 11:15:00 +02:00
Domain
98a7801803 Follow the general Terminus style 2018-08-29 17:02:02 +08:00
Domain
ce2c72393b nowrap 2018-08-29 12:09:55 +08:00
Domain
2ea2c02845 Support login scripts. Fix #344 2018-08-29 12:09:54 +08:00
Eugene
4b1ba7863f Update package.json 2018-08-27 09:40:43 +02:00
106 changed files with 3048 additions and 878 deletions

View File

@@ -26,8 +26,9 @@ Plugins can be installed directly from the Settings view inside Terminus.
* [clickable-links](https://github.com/Eugeny/terminus-clickable-links) - makes paths and URLs in the terminal clickable
* [theme-hype](https://github.com/Eugeny/terminus-theme-hype) - a Hyper inspired theme
* [shell-selector](https://github.com/Eugeny/terminus-shell-selector) - a quick shell selector pane
* [title-control](https://github.com/kbjr/terminus-scrollbar) - allows modifying the title of the terminal tabs by providing a prefix, suffix, and/or strings to be removed
* [title-control](https://github.com/kbjr/terminus-title-control) - allows modifying the title of the terminal tabs by providing a prefix, suffix, and/or strings to be removed
* [scrollbar](https://github.com/kbjr/terminus-scrollbar) - adds a scrollbar to terminal tabs
* [quick-cmds](https://github.com/Domain/terminus-quick-cmds) - quicklky send commands to one or all terminal tabs
---

172
app/lib/app.ts Normal file
View File

@@ -0,0 +1,172 @@
import { app, ipcMain, Menu, Tray, shell } from 'electron'
import { Window } from './window'
export class Application {
private tray: Tray
private windows: Window[] = []
constructor () {
ipcMain.on('app:config-change', () => {
this.broadcast('host:config-change')
})
}
async newWindow (): Promise<Window> {
let window = new Window()
this.windows.push(window)
window.visible$.subscribe(visible => {
if (visible) {
this.disableTray()
} else {
this.enableTray()
}
})
if (process.platform === 'darwin') {
this.setupMenu()
}
await window.ready
return window
}
broadcast (event, ...args) {
for (let window of this.windows) {
window.send(event, ...args)
}
}
async send (event, ...args) {
if (!this.hasWindows()) {
await this.newWindow()
}
this.windows[0].send(event, ...args)
}
enableTray () {
if (this.tray) {
return
}
if (process.platform === 'darwin') {
this.tray = new Tray(`${app.getAppPath()}/assets/tray-darwinTemplate.png`)
this.tray.setPressedImage(`${app.getAppPath()}/assets/tray-darwinHighlightTemplate.png`)
} else {
this.tray = new Tray(`${app.getAppPath()}/assets/tray.png`)
}
this.tray.on('click', () => this.focus())
const contextMenu = Menu.buildFromTemplate([{
label: 'Show',
click: () => this.focus(),
}])
if (process.platform !== 'darwin') {
this.tray.setContextMenu(contextMenu)
}
this.tray.setToolTip(`Terminus ${app.getVersion()}`)
}
disableTray () {
if (this.tray) {
this.tray.destroy()
this.tray = null
}
}
hasWindows () {
return !!this.windows.length
}
focus () {
for (let window of this.windows) {
window.show()
window.focus()
}
}
private setupMenu () {
let template: Electron.MenuItemConstructorOptions[] = [
{
label: 'Application',
submenu: [
{ role: 'about', label: 'About Terminus' },
{ type: 'separator' },
{
label: 'Preferences',
accelerator: 'Cmd+,',
async click () {
if (!this.hasWindows()) {
await this.newWindow()
}
this.windows[0].send('host:preferences-menu')
},
},
{ type: 'separator' },
{ role: 'services', submenu: [] },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{
label: 'Quit',
accelerator: 'Cmd+Q',
click () {
app.quit()
},
},
],
},
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
{ role: 'selectall' },
],
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forcereload' },
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' },
],
},
{
role: 'window',
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
{ type: 'separator' },
{ role: 'front' },
],
},
{
role: 'help',
submenu: [
{
label: 'Website',
click () {
shell.openExternal('https://eugeny.github.io/terminus')
},
},
],
}
]
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
}
}

View File

@@ -1,23 +0,0 @@
import { app } from 'electron'
export function parseArgs (argv, cwd) {
if (argv[0].includes('node')) {
argv = argv.slice(1)
}
return require('yargs')
.usage('terminus [command] [arguments]')
.command('open [directory]', 'open a shell in a directory', {
directory: { type: 'string', 'default': cwd },
})
.command('run [command...]', 'run a command in the terminal', {
command: { type: 'string' },
})
.version('v', 'Show version and exit', app.getVersion())
.alias('d', 'debug')
.describe('d', 'Show DevTools on start')
.alias('h', 'help')
.help('h')
.strict()
.parse(argv.slice(1))
}

39
app/lib/cli.ts Normal file
View File

@@ -0,0 +1,39 @@
import { app } from 'electron'
export function parseArgs (argv, cwd) {
if (argv[0].includes('node')) {
argv = argv.slice(1)
}
return require('yargs')
.usage('terminus [command] [arguments]')
.command('open [directory]', 'open a shell in a directory', {
directory: { type: 'string', 'default': cwd },
})
.command('run [command...]', 'run a command in the terminal', {
command: { type: 'string' },
})
.command('paste [text]', 'paste stdin into the active tab', yargs => {
return yargs.option('escape', {
alias: 'e',
type: 'boolean',
describe: 'Perform shell escaping'
}).positional('text', {
type: 'string'
})
})
.version('version', '', app.getVersion())
.option('debug', {
alias: 'd',
describe: 'Show DevTools on start',
type: 'boolean'
})
.option('version', {
alias: 'v',
describe: 'Show version and exit',
type: 'boolean'
})
.help('help')
.strict()
.parse(argv.slice(1))
}

View File

@@ -1,304 +0,0 @@
import { app, ipcMain, BrowserWindow, Menu, Tray, shell } from 'electron'
import * as path from 'path'
import electronDebug from 'electron-debug'
import * as fs from 'fs'
import * as yaml from 'js-yaml'
import './lru'
import { parseArgs } from './cli'
import ElectronConfig from 'electron-config'
if (process.platform === 'win32' && require('electron-squirrel-startup')) process.exit(0)
let electronVibrancy
if (process.platform !== 'linux') {
electronVibrancy = require('electron-vibrancy')
}
let windowConfig = new ElectronConfig({ name: 'window' })
if (!process.env.TERMINUS_PLUGINS) {
process.env.TERMINUS_PLUGINS = ''
}
const setWindowVibrancy = (enabled) => {
if (enabled && !app.window.vibrancyViewID) {
app.window.vibrancyViewID = electronVibrancy.SetVibrancy(app.window, 0)
} else if (!enabled && app.window.vibrancyViewID) {
electronVibrancy.RemoveView(app.window, app.window.vibrancyViewID)
app.window.vibrancyViewID = null
}
}
const setupTray = () => {
if (process.platform === 'darwin') {
app.tray = new Tray(`${app.getAppPath()}/assets/tray-darwinTemplate.png`)
app.tray.setPressedImage(`${app.getAppPath()}/assets/tray-darwinHighlightTemplate.png`)
} else {
app.tray = new Tray(`${app.getAppPath()}/assets/tray.png`)
}
app.tray.on('click', () => {
app.window.show()
app.window.focus()
})
const contextMenu = Menu.buildFromTemplate([{
label: 'Show',
click () {
app.window.show()
app.window.focus()
},
}])
if (process.platform !== 'darwin') {
app.tray.setContextMenu(contextMenu)
}
app.tray.setToolTip(`Terminus ${app.getVersion()}`)
}
const setupWindowManagement = () => {
app.window.on('show', () => {
app.window.webContents.send('host:window-shown')
if (app.tray) {
app.tray.destroy()
app.tray = null
}
})
app.window.on('hide', () => {
if (!app.tray) {
setupTray()
}
})
app.window.on('enter-full-screen', () => app.window.webContents.send('host:window-enter-full-screen'))
app.window.on('leave-full-screen', () => app.window.webContents.send('host:window-leave-full-screen'))
app.window.on('close', () => {
windowConfig.set('windowBoundaries', app.window.getBounds())
})
app.window.on('closed', () => {
app.window = null
})
ipcMain.on('window-focus', () => {
app.window.focus()
})
ipcMain.on('window-maximize', () => {
app.window.maximize()
})
ipcMain.on('window-unmaximize', () => {
app.window.unmaximize()
})
ipcMain.on('window-toggle-maximize', () => {
if (app.window.isMaximized()) {
app.window.unmaximize()
} else {
app.window.maximize()
}
})
ipcMain.on('window-minimize', () => {
app.window.minimize()
})
ipcMain.on('window-set-bounds', (event, bounds) => {
app.window.setBounds(bounds)
})
ipcMain.on('window-set-always-on-top', (event, flag) => {
app.window.setAlwaysOnTop(flag)
})
ipcMain.on('window-set-vibrancy', (event, enabled) => {
setWindowVibrancy(enabled)
})
}
const setupMenu = () => {
let template = [{
label: 'Application',
submenu: [
{ role: 'about', label: 'About Terminus' },
{ type: 'separator' },
{
label: 'Preferences',
accelerator: 'Cmd+,',
click () {
app.window.webContents.send('host:preferences-menu')
},
},
{ type: 'separator' },
{ role: 'services', submenu: [] },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{
label: 'Quit',
accelerator: 'Cmd+Q',
click () {
app.quit()
},
},
],
},
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
{ role: 'selectall' },
],
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forcereload' },
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' },
],
},
{
role: 'window',
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
{ type: 'separator' },
{ role: 'front' },
],
},
{
role: 'help',
submenu: [
{
label: 'Website',
click () {
shell.openExternal('https://eugeny.github.io/terminus')
},
},
],
}]
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
}
const start = () => {
let t0 = Date.now()
let configPath = path.join(app.getPath('userData'), 'config.yaml')
let configData
if (fs.existsSync(configPath)) {
configData = yaml.safeLoad(fs.readFileSync(configPath, 'utf8'))
} else {
configData = {}
}
let options = {
width: 800,
height: 600,
title: 'Terminus',
minWidth: 400,
minHeight: 300,
webPreferences: { webSecurity: false },
frame: false,
show: false,
}
Object.assign(options, windowConfig.get('windowBoundaries'))
if ((configData.appearance || {}).frame === 'native') {
options.frame = true
} else {
if (process.platform === 'darwin') {
options.titleBarStyle = 'hiddenInset'
}
}
if (process.platform === 'win32' && (configData.appearance || {}).vibrancy) {
options.transparent = true
}
if (process.platform === 'linux') {
options.backgroundColor = '#131d27'
}
app.commandLine.appendSwitch('disable-http-cache')
app.window = new BrowserWindow(options)
app.window.once('ready-to-show', () => {
if (process.platform === 'darwin') {
app.window.setVibrancy('dark')
} else if (process.platform === 'win32' && (configData.appearance || {}).vibrancy) {
setWindowVibrancy(true)
}
app.window.show()
app.window.focus()
})
app.window.loadURL(`file://${app.getAppPath()}/dist/index.html`, { extraHeaders: 'pragma: no-cache\n' })
if (process.platform !== 'darwin') {
app.window.setMenu(null)
}
setupWindowManagement()
if (process.platform === 'darwin') {
setupMenu()
} else {
app.window.setMenu(null)
}
console.info(`Host startup: ${Date.now() - t0}ms`)
t0 = Date.now()
ipcMain.on('app:ready', () => {
console.info(`App startup: ${Date.now() - t0}ms`)
})
}
app.on('activate', () => {
if (!app.window) {
start()
} else {
app.window.show()
app.window.focus()
}
})
process.on('uncaughtException', function (err) {
console.log(err)
app.window.webContents.send('uncaughtException', err)
})
app.on('second-instance', (event, argv, cwd) => {
app.window.webContents.send('host:second-instance', parseArgs(argv, cwd))
})
const argv = parseArgs(process.argv, process.cwd())
if (!app.requestSingleInstanceLock()) {
app.quit()
process.exit(0)
}
if (argv.d) {
electronDebug({ enabled: true, showDevTools: 'undocked' })
}
app.on('ready', start)

65
app/lib/index.ts Normal file
View File

@@ -0,0 +1,65 @@
import './lru'
import { app, ipcMain, Menu } from 'electron'
import electronDebug = require('electron-debug')
import { parseArgs } from './cli'
import { Application } from './app'
if (process.platform === 'win32' && require('electron-squirrel-startup')) process.exit(0)
if (!process.env.TERMINUS_PLUGINS) {
process.env.TERMINUS_PLUGINS = ''
}
const application = new Application()
app.commandLine.appendSwitch('disable-http-cache')
ipcMain.on('app:new-window', () => {
console.log('new-window')
application.newWindow()
})
app.on('activate', () => {
if (!application.hasWindows()) {
application.newWindow()
} else {
application.focus()
}
})
app.on('window-all-closed', () => {
app.quit()
})
process.on('uncaughtException' as any, err => {
console.log(err)
application.broadcast('uncaughtException', err)
})
app.on('second-instance', (_event, argv, cwd) => {
application.send('host:second-instance', parseArgs(argv, cwd), cwd)
})
const argv = parseArgs(process.argv, process.cwd())
if (!app.requestSingleInstanceLock()) {
app.quit()
process.exit(0)
}
if (argv.d) {
electronDebug({ enabled: true, showDevTools: 'undocked' })
}
app.on('ready', () => {
if (process.platform === 'darwin') {
app.dock.setMenu(Menu.buildFromTemplate([
{
label: 'New window',
click () {
this.app.newWindow()
}
}
]))
}
application.newWindow()
})

View File

@@ -6,10 +6,10 @@ let origLstat = fs.realpathSync.bind(fs)
// NB: The biggest offender of thrashing realpathSync is the node module system
// itself, which we can't get into via any sane means.
require('fs').realpathSync = function (p) {
let r = lru.get(p)
if (r) return r
let r = lru.get(p)
if (r) return r
r = origLstat(p)
lru.set(p, r)
return r
r = origLstat(p)
lru.set(p, r)
return r
}

201
app/lib/window.ts Normal file
View File

@@ -0,0 +1,201 @@
import { Subject, Observable } from 'rxjs'
import { BrowserWindow, app, ipcMain, Rectangle, Menu } from 'electron'
import ElectronConfig = require('electron-config')
import * as yaml from 'js-yaml'
import * as fs from 'fs'
import * as path from 'path'
let electronVibrancy: any
if (process.platform !== 'linux') {
electronVibrancy = require('electron-vibrancy')
}
export class Window {
ready: Promise<void>
private visible = new Subject<boolean>()
private window: BrowserWindow
private vibrancyViewID: number
private windowConfig: ElectronConfig
private windowBounds: Rectangle
get visible$ (): Observable<boolean> { return this.visible }
constructor () {
let configPath = path.join(app.getPath('userData'), 'config.yaml')
let configData
if (fs.existsSync(configPath)) {
configData = yaml.safeLoad(fs.readFileSync(configPath, 'utf8'))
} else {
configData = {}
}
this.windowConfig = new ElectronConfig({ name: 'window' })
this.windowBounds = this.windowConfig.get('windowBoundaries')
let maximized = this.windowConfig.get('maximized')
let options: Electron.BrowserWindowConstructorOptions = {
width: 800,
height: 600,
title: 'Terminus',
minWidth: 400,
minHeight: 300,
webPreferences: { webSecurity: false },
frame: false,
show: false,
}
Object.assign(options, this.windowBounds)
if ((configData.appearance || {}).frame === 'native') {
options.frame = true
} else {
if (process.platform === 'darwin') {
options.titleBarStyle = 'hiddenInset'
}
}
if (process.platform === 'win32' && (configData.appearance || {}).vibrancy) {
options.transparent = true
}
if (process.platform === 'linux') {
options.backgroundColor = '#131d27'
}
this.window = new BrowserWindow(options)
this.window.once('ready-to-show', () => {
if (process.platform === 'darwin') {
this.window.setVibrancy('dark')
} else if (process.platform === 'win32' && (configData.appearance || {}).vibrancy) {
this.setVibrancy(true)
}
if (maximized) {
this.window.maximize()
} else {
this.window.show()
}
this.window.focus()
})
this.window.loadURL(`file://${app.getAppPath()}/dist/index.html?${this.window.id}`, { extraHeaders: 'pragma: no-cache\n' })
if (process.platform !== 'darwin') {
this.window.setMenu(null)
}
this.setupWindowManagement()
this.ready = new Promise(resolve => {
const listener = event => {
if (event.sender === this.window.webContents) {
ipcMain.removeListener('app:ready', listener)
resolve()
}
}
ipcMain.on('app:ready', listener)
})
}
setVibrancy (enabled: boolean) {
if (enabled && !this.vibrancyViewID) {
this.vibrancyViewID = electronVibrancy.SetVibrancy(this.window, 0)
} else if (!enabled && this.vibrancyViewID) {
electronVibrancy.RemoveView(this.window, this.vibrancyViewID)
this.vibrancyViewID = null
}
}
show () {
this.window.show()
}
focus () {
this.window.focus()
}
send (event, ...args) {
this.window.webContents.send(event, ...args)
}
private setupWindowManagement () {
this.window.on('show', () => {
this.visible.next(true)
this.window.webContents.send('host:window-shown')
})
this.window.on('hide', () => {
this.visible.next(false)
})
this.window.on('enter-full-screen', () => this.window.webContents.send('host:window-enter-full-screen'))
this.window.on('leave-full-screen', () => this.window.webContents.send('host:window-leave-full-screen'))
this.window.on('close', () => {
this.windowConfig.set('windowBoundaries', this.windowBounds)
this.windowConfig.set('maximized', this.window.isMaximized())
})
this.window.on('closed', () => {
this.destroy()
})
this.window.on('resize', () => {
if (!this.window.isMaximized()) {
this.windowBounds = this.window.getBounds()
}
})
this.window.on('move', () => {
if (!this.window.isMaximized()) {
this.windowBounds = this.window.getBounds()
}
})
ipcMain.on('window-focus', () => {
this.window.focus()
})
ipcMain.on('window-maximize', () => {
this.window.maximize()
})
ipcMain.on('window-unmaximize', () => {
this.window.unmaximize()
})
ipcMain.on('window-toggle-maximize', () => {
if (this.window.isMaximized()) {
this.window.unmaximize()
} else {
this.window.maximize()
}
})
ipcMain.on('window-minimize', () => {
this.window.minimize()
})
ipcMain.on('window-set-bounds', (_event, bounds) => {
this.window.setBounds(bounds)
})
ipcMain.on('window-set-always-on-top', (_event, flag) => {
this.window.setAlwaysOnTop(flag)
})
ipcMain.on('window-set-vibrancy', (_event, enabled) => {
this.setVibrancy(enabled)
})
ipcMain.on('window-set-title', (_event, title) => {
this.window.setTitle(title)
})
ipcMain.on('window-popup-context-menu', (_event, menuDefinition) => {
Menu.buildFromTemplate(menuDefinition).popup({ window: this.window })
})
}
private destroy () {
this.window = null
this.visible.complete()
}
}

View File

@@ -1,4 +1,4 @@
import '../lib/lru.js'
import '../lib/lru'
import 'source-sans-pro'
import 'font-awesome/css/font-awesome.css'
import 'ngx-toastr/toastr.css'
@@ -29,8 +29,8 @@ Raven.config(
}
)
process.on('uncaughtException', (err) => {
Raven.captureException(err)
process.on('uncaughtException' as any, (err) => {
Raven.captureException(err as any)
console.error(err)
})

View File

@@ -4,8 +4,12 @@ body {
background: #1D272D;
}
.modal-dialog, .modal-backdrop {
-webkit-app-region: no-drag;
.modal-dialog, .modal-backdrop, .no-drag {
-webkit-app-region: no-drag;
}
.selectable {
user-select: text;
}
[ngbradiogroup] input[type="radio"] {

31
app/tsconfig.main.json Normal file
View File

@@ -0,0 +1,31 @@
{
"compilerOptions": {
"baseUrl": "./lib",
"module": "commonjs",
"target": "es2017",
"declaration": false,
"noImplicitAny": false,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"lib": [
"dom",
"es2015",
"es2015.iterable",
"es2017",
"es7"
]
},
"compileOnSave": false,
"exclude": [
"dist",
"node_modules",
"*/node_modules"
]
}

View File

@@ -6,8 +6,8 @@ module.exports = {
target: 'node',
entry: {
'index.ignore': 'file-loader?name=index.html!val-loader!pug-html-loader!' + path.resolve(__dirname, './index.pug'),
'preload': path.resolve(__dirname, 'src/entry.preload.ts'),
'bundle': path.resolve(__dirname, 'src/entry.ts'),
preload: path.resolve(__dirname, 'src/entry.preload.ts'),
bundle: path.resolve(__dirname, 'src/entry.ts'),
},
mode: process.env.DEV ? 'development' : 'production',
context: __dirname,
@@ -15,7 +15,7 @@ module.exports = {
output: {
path: path.join(__dirname, 'dist'),
pathinfo: true,
filename: '[name].js'
filename: '[name].js',
},
resolve: {
modules: ['src/', 'node_modules', '../node_modules', 'assets/'].map(x => path.join(__dirname, x)),
@@ -29,8 +29,8 @@ module.exports = {
loader: 'awesome-typescript-loader',
options: {
configFileName: path.resolve(__dirname, 'tsconfig.json'),
}
}
},
},
},
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
@@ -39,20 +39,20 @@ module.exports = {
use: {
loader: 'file-loader',
options: {
name: 'images/[name].[ext]'
}
}
name: 'images/[name].[ext]',
},
},
},
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]'
}
}
}
]
name: 'fonts/[name].[ext]',
},
},
},
],
},
externals: {
'@angular/core': 'commonjs @angular/core',
@@ -62,15 +62,15 @@ module.exports = {
'@angular/forms': 'commonjs @angular/forms',
'@angular/common': 'commonjs @angular/common',
'@ng-bootstrap/ng-bootstrap': 'commonjs @ng-bootstrap/ng-bootstrap',
'child_process': 'commonjs child_process',
'electron': 'commonjs electron',
child_process: 'commonjs child_process',
electron: 'commonjs electron',
'electron-is-dev': 'commonjs electron-is-dev',
'fs': 'commonjs fs',
fs: 'commonjs fs',
'ngx-toastr': 'commonjs ngx-toastr',
'module': 'commonjs module',
'mz': 'commonjs mz',
'path': 'commonjs path',
'rxjs': 'commonjs rxjs',
module: 'commonjs module',
mz: 'commonjs mz',
path: 'commonjs path',
rxjs: 'commonjs rxjs',
'zone.js': 'commonjs zone.js/dist/zone.js',
},
plugins: [

View File

@@ -5,7 +5,7 @@ module.exports = {
name: 'terminus-main',
target: 'node',
entry: {
main: path.resolve(__dirname, 'lib/index.js'),
main: path.resolve(__dirname, 'lib/index.ts'),
},
mode: process.env.DEV ? 'development' : 'production',
context: __dirname,
@@ -22,12 +22,11 @@ module.exports = {
module: {
rules: [
{
test: /lib[\\/].*\.js$/,
exclude: /node_modules/,
test: /\.ts$/,
use: {
loader: 'babel-loader',
loader: 'awesome-typescript-loader',
options: {
presets: ['babel-preset-es2015'],
configFileName: path.resolve(__dirname, 'tsconfig.main.json'),
},
},
},

View File

@@ -24,3 +24,4 @@ build_script:
artifacts:
- path: 'dist\win\*.exe'
- path: 'dist\*.exe'

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSIconName</key>
<string>NSActionTemplate</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Open Terminus here</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key>NSSendFileTypes</key>
<array>
<string>public.item</string>
</array>
</dict>
</array>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict>
<key>QuickLook/Thumbnail.png</key>
<dict>
<key>hash</key>
<data>
tv0Qtgo8zZ9+sQPQDNdKJHm7jeQ=
</data>
<key>hash2</key>
<data>
8nlfnBbkORcam9cE84KuxM9Lgf6hYU0jehepX8sSNDU=
</data>
</dict>
<key>document.wflow</key>
<dict>
<key>cdhash</key>
<data>
VK77ipNZktBsDCcUfnfht774juM=
</data>
<key>requirement</key>
<string>identifier document and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = V4JSMC46SY</string>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>444.38</string>
<key>AMApplicationVersion</key>
<string>2.9</string>
<key>AMDocumentVersion</key>
<string>2</string>
<key>actions</key>
<array>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>2.0.3</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>COMMAND_STRING</key>
<dict/>
<key>CheckedForUserDefaultShell</key>
<dict/>
<key>inputMethod</key>
<dict/>
<key>shell</key>
<dict/>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run Shell Script.action</string>
<key>ActionName</key>
<string>Run Shell Script</string>
<key>ActionParameters</key>
<dict>
<key>COMMAND_STRING</key>
<string>/Applications/Terminus.app/Contents/MacOS/terminus open "$1"</string>
<key>CheckedForUserDefaultShell</key>
<true/>
<key>inputMethod</key>
<integer>1</integer>
<key>shell</key>
<string>/bin/sh</string>
<key>source</key>
<string></string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.RunShellScript</string>
<key>CFBundleVersion</key>
<string>2.0.3</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunShellScriptAction</string>
<key>InputUUID</key>
<string>CDBAB8D4-B8B8-4FBB-9115-B4082FB99E1C</string>
<key>Keywords</key>
<array>
<string>Shell</string>
<string>Script</string>
<string>Command</string>
<string>Run</string>
<string>Unix</string>
</array>
<key>OutputUUID</key>
<string>96B5890B-A95F-4BF2-8E5A-38E07A849C33</string>
<key>UUID</key>
<string>62251AFB-502C-4EA0-821C-D9B8CA96E6EE</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<integer>0</integer>
<key>name</key>
<string>inputMethod</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
<key>1</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>1</string>
</dict>
<key>2</key>
<dict>
<key>default value</key>
<false/>
<key>name</key>
<string>CheckedForUserDefaultShell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>2</string>
</dict>
<key>3</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>COMMAND_STRING</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>3</string>
</dict>
<key>4</key>
<dict>
<key>default value</key>
<string>/bin/sh</string>
<key>name</key>
<string>shell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>4</string>
</dict>
</dict>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>529.000000:305.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
</array>
<key>connectors</key>
<dict/>
<key>workflowMetaData</key>
<dict>
<key>applicationBundleID</key>
<string>com.apple.finder</string>
<key>applicationBundleIDsByPath</key>
<dict>
<key>/System/Library/CoreServices/Finder.app</key>
<string>com.apple.finder</string>
</dict>
<key>applicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>applicationPaths</key>
<array>
<string>/System/Library/CoreServices/Finder.app</string>
</array>
<key>inputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject</string>
<key>outputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>presentationMode</key>
<integer>15</integer>
<key>processesInput</key>
<integer>0</integer>
<key>serviceApplicationBundleID</key>
<string>com.apple.finder</string>
<key>serviceApplicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>serviceInputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject</string>
<key>serviceOutputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>serviceProcessesInput</key>
<integer>0</integer>
<key>systemImageName</key>
<string>NSActionTemplate</string>
<key>useAutomaticInputType</key>
<integer>0</integer>
<key>workflowTypeIdentifier</key>
<string>com.apple.Automator.servicesMenu</string>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSIconName</key>
<string>NSActionTemplate</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Paste path into Terminus</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key>NSSendFileTypes</key>
<array>
<string>public.item</string>
</array>
</dict>
</array>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict>
<key>QuickLook/Thumbnail.png</key>
<dict>
<key>hash</key>
<data>
tv0Qtgo8zZ9+sQPQDNdKJHm7jeQ=
</data>
<key>hash2</key>
<data>
8nlfnBbkORcam9cE84KuxM9Lgf6hYU0jehepX8sSNDU=
</data>
</dict>
<key>document.wflow</key>
<dict>
<key>cdhash</key>
<data>
DwLo2M9xZ+aZGtMzRCGHhHB/wMY=
</data>
<key>requirement</key>
<string>identifier document and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = V4JSMC46SY</string>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>444.38</string>
<key>AMApplicationVersion</key>
<string>2.9</string>
<key>AMDocumentVersion</key>
<string>2</string>
<key>actions</key>
<array>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>2.0.3</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>COMMAND_STRING</key>
<dict/>
<key>CheckedForUserDefaultShell</key>
<dict/>
<key>inputMethod</key>
<dict/>
<key>shell</key>
<dict/>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run Shell Script.action</string>
<key>ActionName</key>
<string>Run Shell Script</string>
<key>ActionParameters</key>
<dict>
<key>COMMAND_STRING</key>
<string>/Applications/Terminus.app/Contents/MacOS/terminus paste --escape "$1"</string>
<key>CheckedForUserDefaultShell</key>
<true/>
<key>inputMethod</key>
<integer>1</integer>
<key>shell</key>
<string>/bin/sh</string>
<key>source</key>
<string></string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.RunShellScript</string>
<key>CFBundleVersion</key>
<string>2.0.3</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunShellScriptAction</string>
<key>InputUUID</key>
<string>CDBAB8D4-B8B8-4FBB-9115-B4082FB99E1C</string>
<key>Keywords</key>
<array>
<string>Shell</string>
<string>Script</string>
<string>Command</string>
<string>Run</string>
<string>Unix</string>
</array>
<key>OutputUUID</key>
<string>96B5890B-A95F-4BF2-8E5A-38E07A849C33</string>
<key>UUID</key>
<string>62251AFB-502C-4EA0-821C-D9B8CA96E6EE</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<integer>0</integer>
<key>name</key>
<string>inputMethod</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
<key>1</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>1</string>
</dict>
<key>2</key>
<dict>
<key>default value</key>
<false/>
<key>name</key>
<string>CheckedForUserDefaultShell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>2</string>
</dict>
<key>3</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>COMMAND_STRING</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>3</string>
</dict>
<key>4</key>
<dict>
<key>default value</key>
<string>/bin/sh</string>
<key>name</key>
<string>shell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>4</string>
</dict>
</dict>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>529.000000:305.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
</array>
<key>connectors</key>
<dict/>
<key>workflowMetaData</key>
<dict>
<key>applicationBundleID</key>
<string>com.apple.finder</string>
<key>applicationBundleIDsByPath</key>
<dict>
<key>/System/Library/CoreServices/Finder.app</key>
<string>com.apple.finder</string>
</dict>
<key>applicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>applicationPaths</key>
<array>
<string>/System/Library/CoreServices/Finder.app</string>
</array>
<key>inputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject</string>
<key>outputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>presentationMode</key>
<integer>15</integer>
<key>processesInput</key>
<integer>0</integer>
<key>serviceApplicationBundleID</key>
<string>com.apple.finder</string>
<key>serviceApplicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>serviceInputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject</string>
<key>serviceOutputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>serviceProcessesInput</key>
<integer>0</integer>
<key>systemImageName</key>
<string>NSActionTemplate</string>
<key>useAutomaticInputType</key>
<integer>0</integer>
<key>workflowTypeIdentifier</key>
<string>com.apple.Automator.servicesMenu</string>
</dict>
</dict>
</plist>

View File

@@ -1,6 +1,10 @@
### Changes
##### v0.4.9
- Fixed broken Doskey on Win10 (#438, #451)
##### v0.4.8
- Environment variable 'clink_profile' overrides Clink's profile path (#390).

View File

@@ -136,7 +136,7 @@ h6 { font-size: 1.00em; }
<!-- ----------------------------------------------------- -->
<body onload="go();">
<div id="header">
<div id="title">Clink v0.4.8</div>
<div id="title">Clink v0.4.9</div>
<div id="url">
<a href="http://github.com/mridgers/clink">
http://github.com/mridgers/clink
@@ -697,6 +697,10 @@ The current cursor position within the line buffer.
### Changes
##### v0.4.9
- Fixed broken Doskey on Win10 (#438, #451)
##### v0.4.8
- Environment variable 'clink_profile' overrides Clink's profile path (#390).

BIN
extras/clink/clink_x64.exe Normal file

Binary file not shown.

BIN
extras/clink/clink_x86.exe Normal file

Binary file not shown.

View File

@@ -4,6 +4,7 @@
"@types/electron-config": "^0.2.1",
"@types/electron-debug": "^1.1.0",
"@types/fs-promise": "1.0.1",
"@types/js-yaml": "^3.11.2",
"@types/node": "7.0.5",
"@types/webpack-env": "1.13.0",
"apply-loader": "0.1.0",
@@ -15,7 +16,7 @@
"core-js": "2.4.1",
"cross-env": "4.0.0",
"css-loader": "0.28.0",
"electron": "3.0.0-beta.5",
"electron": "3.0.0",
"electron-builder": "^20.27.1",
"electron-builder-squirrel-windows": "17.0.1",
"electron-installer-snap": "^3.0.0",
@@ -33,7 +34,7 @@
"json-loader": "0.5.4",
"less": "2.7.1",
"less-loader": "2.2.3",
"node-abi": "^2.4.1",
"node-abi": "^2.4.4",
"node-gyp": "^3.6.2",
"node-sass": "^4.5.3",
"npmlog": "4.1.0",
@@ -72,17 +73,21 @@
],
"extraResources": [
"builtin-plugins",
"clink"
"extras"
],
"win": {
"icon": "./build/windows/icon.ico",
"publish": [
"github"
]
],
"artifactName": "terminus-${version}-setup.exe"
},
"squirrelWindows": {
"iconUrl": "https://github.com/Eugeny/terminus/raw/master/build/windows/icon.ico",
"artifactName": "terminus-${version}-${os}-${arch}.exe"
"artifactName": "terminus-${version}-setup.exe"
},
"portable": {
"artifactName": "terminus-${version}-portable.exe"
},
"mac": {
"category": "public.app-category.video",
@@ -95,11 +100,12 @@
}
},
"dmg": {
"artifactName": "terminus-${version}-${os}-${arch}.dmg"
"artifactName": "terminus-${version}-macos.dmg"
},
"linux": {
"category": "Utilities",
"icon": "./build/icons",
"artifactName": "terminus-${version}-linux.${ext}",
"publish": [
"github"
]
@@ -114,20 +120,18 @@
"libxtst6",
"libnss3",
"tmux"
],
"artifactName": "terminus-${version}-${os}-${arch}.deb"
]
},
"rpm": {
"depends": [
"screen",
"gnome-python2-gnomekeyring"
],
"artifactName": "terminus-${version}-${os}-${arch}.rpm"
]
}
},
"scripts": {
"build": "webpack --color --config app/webpack.config.js && webpack --color --config terminus-core/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-terminal/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-plugin-manager/webpack.config.js && webpack --color --config terminus-community-color-schemes/webpack.config.js && webpack --color --config terminus-ssh/webpack.config.js",
"watch": "DEV=1 webpack --progress --color --watch",
"build": "webpack --color --config app/webpack.main.config.js && webpack --color --config app/webpack.config.js && webpack --color --config terminus-core/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-terminal/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-plugin-manager/webpack.config.js && webpack --color --config terminus-community-color-schemes/webpack.config.js && webpack --color --config terminus-ssh/webpack.config.js",
"watch": "cross-env DEV=1 webpack --progress --color --watch",
"start": "cross-env DEV=1 electron app --debug",
"prod": "cross-env DEV=1 electron app",
"lint": "tslint -c tslint.json -t stylish terminus-*/src/**/*.ts terminus-*/src/*.ts app/src/*.ts",

View File

@@ -4,7 +4,7 @@ const vars = require('./vars')
builder({
dir: true,
win: ['squirrel'],
win: ['squirrel', 'portable'],
config: {
extraMetadata: {
version: vars.version,

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-community-color-schemes",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "Community color schemes for Terminus",
"keywords": [
"terminus-builtin-plugin"

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-core",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "Terminus core",
"keywords": [
"terminus-builtin-plugin"
@@ -27,6 +27,7 @@
"electron-updater": "^2.8.9",
"ng2-dnd": "^5.0.2",
"ngx-perfect-scrollbar": "^6.0.0",
"shell-escape": "^0.2.0",
"universal-analytics": "^0.4.17"
},
"peerDependencies": {
@@ -42,6 +43,7 @@
"dependencies": {
"deepmerge": "^1.5.0",
"js-yaml": "^3.9.0",
"winreg": "^1.2.4",
"winston": "^2.4.0"
},
"false": {}

View File

@@ -13,4 +13,5 @@ export { Logger, LogService } from '../services/log.service'
export { HomeBaseService } from '../services/homeBase.service'
export { HotkeysService } from '../services/hotkeys.service'
export { HostAppService, Platform } from '../services/hostApp.service'
export { ShellIntegrationService } from '../services/shellIntegration.service'
export { ThemesService } from '../services/themes.service'

View File

@@ -4,7 +4,7 @@
height: 100vh;
flex-direction: column;
overflow: hidden;
-webkit-user-select: none;
user-select: none;
-webkit-user-drag: none;
-webkit-font-smoothing: antialiased;
will-change: transform;

View File

@@ -142,9 +142,9 @@ export class AppRootComponent {
this.unsortedTabs.push(tab)
tab.progress$.subscribe(progress => {
if (progress !== null) {
this.hostApp.getWindow().setProgressBar(progress / 100.0, 'normal')
this.hostApp.getWindow().setProgressBar(progress / 100.0, { mode: 'normal' })
} else {
this.hostApp.getWindow().setProgressBar(-1, 'none')
this.hostApp.getWindow().setProgressBar(-1, { mode: 'none' })
}
})
})
@@ -154,26 +154,27 @@ export class AppRootComponent {
}
onGlobalHotkey () {
if (this.electron.app.window.isFocused()) {
if (this.hostApp.getWindow().isFocused()) {
// focused
this.electron.loseFocus()
this.hostApp.getWindow().blur()
if (this.hostApp.platform !== Platform.macOS) {
this.electron.app.window.hide()
this.hostApp.getWindow().hide()
}
} else {
if (!this.electron.app.window.isVisible()) {
if (!this.hostApp.getWindow().isVisible()) {
// unfocused, invisible
this.electron.app.window.show()
this.electron.app.window.focus()
this.hostApp.getWindow().show()
this.hostApp.getWindow().focus()
} else {
if (this.config.store.appearance.dock === 'off') {
// not docked, visible
setTimeout(() => {
this.electron.app.window.focus()
this.hostApp.getWindow().focus()
})
} else {
// docked, visible
this.electron.app.window.hide()
this.hostApp.getWindow().hide()
}
}
}
@@ -223,7 +224,7 @@ export class AppRootComponent {
}
private updateVibrancy () {
this.hostApp.setVibrancy(this.config.store.appearance.vibrancy)
this.hostApp.getWindow().setOpacity(this.config.store.appearance.opacity)
this.hostApp.setVibrancy(this.config.store.appearance.vibrancy)
this.hostApp.getWindow().setOpacity(this.config.store.appearance.opacity)
}
}

View File

@@ -15,6 +15,8 @@ export abstract class BaseTabComponent {
protected progress = new Subject<number>()
protected activity = new Subject<boolean>()
private progressClearTimeout: number
get focused$ (): Observable<void> { return this.focused }
get blurred$ (): Observable<void> { return this.blurred }
get titleChange$ (): Observable<string> { return this.titleChange }
@@ -40,6 +42,14 @@ export abstract class BaseTabComponent {
setProgress (progress: number) {
this.progress.next(progress)
if (progress) {
if (this.progressClearTimeout) {
clearTimeout(this.progressClearTimeout)
}
this.progressClearTimeout = setTimeout(() => {
this.setProgress(null)
}, 5000)
}
}
displayActivity (): void {

View File

@@ -20,4 +20,4 @@ footer.d-flex.align-items-center
i.fa.fa-bug
span Report a problem
.form-control-static Version: {{homeBase.appVersion}}
.form-control-static.selectable.no-drag Version: {{homeBase.appVersion}}

View File

@@ -33,6 +33,4 @@ a, button {
width: 16px;
height: 16px;
margin-right: 10px;
fill: white;
fill-opacity: 0.75;
}

View File

@@ -13,8 +13,6 @@ $tabs-height: 36px;
overflow: hidden;
transition: 0.125s ease-out all;
.index {
flex: none;
font-weight: bold;
@@ -44,12 +42,13 @@ $tabs-height: 36px;
flex: none;
background: transparent;
opacity: 0;
-webkit-app-region: no-drag;
$button-size: 26px;
width: $button-size;
height: $button-size;
border-radius: $button-size / 2;
line-height: $button-size;
line-height: $button-size * 0.9;
align-self: center;
margin-right: 10px;
@@ -79,7 +78,8 @@ $tabs-height: 36px;
position: absolute;
left: 0;
top: 0;
bottom: 0;
height: 5px;
z-index: -1;
transition: 0.25s width;
}
}

View File

@@ -9,7 +9,7 @@ button.btn.btn-secondary.btn-maximize(
svg(version='1.1', width='10', height='10')
path(d='M 0,0 0,10 10,10 10,0 Z M 1,1 9,1 9,9 1,9 Z')
button.btn.btn-secondary.btn-close(
(click)='hostApp.quit()',
(click)='hostApp.getWindow().close()',
)
svg(version='1.1', width='10', height='10')
path(d='M 0,0 0,0.7 4.3,5 0,9.3 0,10 0.7,10 5,5.7 9.3,10 10,10 10,9.3 5.7,5 10,0.7 10,0 9.3,0 5,4.3 0.7,0 Z')

View File

@@ -1,4 +1,6 @@
hotkeys:
new-window:
- 'Ctrl-Shift-N'
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:

View File

@@ -1,4 +1,6 @@
hotkeys:
new-window:
- '⌘-N'
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:

View File

@@ -1,4 +1,6 @@
hotkeys:
new-window:
- 'Ctrl-Shift-N'
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:

View File

@@ -0,0 +1,15 @@
import { Directive, AfterViewInit, ElementRef } from '@angular/core'
@Directive({
selector: '[autofocus]'
})
export class AutofocusDirective implements AfterViewInit {
constructor (private el: ElementRef) { }
ngAfterViewInit () {
this.el.nativeElement.blur()
setTimeout(() => {
this.el.nativeElement.focus()
})
}
}

View File

@@ -14,6 +14,7 @@ import { LogService } from './services/log.service'
import { HomeBaseService } from './services/homeBase.service'
import { HotkeysService, AppHotkeyProvider } from './services/hotkeys.service'
import { DockingService } from './services/docking.service'
import { ShellIntegrationService } from './services/shellIntegration.service'
import { TabRecoveryService } from './services/tabRecovery.service'
import { ThemesService } from './services/themes.service'
import { TouchbarService } from './services/touchbar.service'
@@ -30,11 +31,13 @@ import { ToggleComponent } from './components/toggle.component'
import { WindowControlsComponent } from './components/windowControls.component'
import { RenameTabModalComponent } from './components/renameTabModal.component'
import { AutofocusDirective } from './directives/autofocus.directive'
import { HotkeyProvider } from './api/hotkeyProvider'
import { ConfigProvider } from './api/configProvider'
import { Theme } from './api/theme'
import { StandardTheme, StandardCompactTheme } from './theme'
import { StandardTheme, StandardCompactTheme, PaperTheme } from './theme'
import { CoreConfigProvider } from './config'
import 'perfect-scrollbar/css/perfect-scrollbar.css'
@@ -49,6 +52,7 @@ const PROVIDERS = [
HostAppService,
HotkeysService,
LogService,
ShellIntegrationService,
TabRecoveryService,
ThemesService,
TouchbarService,
@@ -56,6 +60,7 @@ const PROVIDERS = [
{ provide: HotkeyProvider, useClass: AppHotkeyProvider, multi: true },
{ provide: Theme, useClass: StandardTheme, multi: true },
{ provide: Theme, useClass: StandardCompactTheme, multi: true },
{ provide: Theme, useClass: PaperTheme, multi: true },
{ provide: ConfigProvider, useClass: CoreConfigProvider, multi: true },
{ provide: PERFECT_SCROLLBAR_CONFIG, useValue: { suppressScrollX: true }}
]
@@ -80,6 +85,7 @@ const PROVIDERS = [
WindowControlsComponent,
RenameTabModalComponent,
SafeModeModalComponent,
AutofocusDirective,
],
entryComponents: [
RenameTabModalComponent,
@@ -88,6 +94,7 @@ const PROVIDERS = [
exports: [
CheckboxComponent,
ToggleComponent,
AutofocusDirective,
]
})
export default class AppModule {

View File

@@ -3,6 +3,7 @@ import { Injectable, ComponentFactoryResolver, Injector } from '@angular/core'
import { BaseTabComponent } from '../components/baseTab.component'
import { Logger, LogService } from './log.service'
import { ConfigService } from './config.service'
import { HostAppService } from './hostApp.service'
export declare type TabComponentType = new (...args: any[]) => BaseTabComponent
@@ -28,6 +29,7 @@ export class AppService {
constructor (
private componentFactoryResolver: ComponentFactoryResolver,
private config: ConfigService,
private hostApp: HostAppService,
private injector: Injector,
log: LogService,
) {
@@ -37,15 +39,21 @@ export class AppService {
openNewTab (type: TabComponentType, inputs?: any): BaseTabComponent {
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(type)
let componentRef = componentFactory.create(this.injector)
componentRef.instance.hostView = componentRef.hostView
Object.assign(componentRef.instance, inputs || {})
let tab = componentRef.instance
tab.hostView = componentRef.hostView
Object.assign(tab, inputs || {})
this.tabs.push(componentRef.instance)
this.selectTab(componentRef.instance)
this.tabs.push(tab)
this.selectTab(tab)
this.tabsChanged.next()
this.tabOpened.next(componentRef.instance)
this.tabOpened.next(tab)
return componentRef.instance
tab.titleChange$.subscribe(title => {
if (tab === this.activeTab) {
this.hostApp.setTitle(title)
}
})
return tab
}
selectTab (tab: BaseTabComponent) {
@@ -66,6 +74,7 @@ export class AppService {
this.activeTabChange.next(tab)
if (this.activeTab) {
this.activeTab.emitFocused()
this.hostApp.setTitle(this.activeTab.title)
}
}
@@ -122,5 +131,6 @@ export class AppService {
emitReady () {
this.ready.next(null)
this.ready.complete()
this.hostApp.emitReady()
}
}

View File

@@ -63,7 +63,7 @@ export class ConfigService {
constructor (
electron: ElectronService,
hostApp: HostAppService,
private hostApp: HostAppService,
@Inject(ConfigProvider) configProviders: ConfigProvider[],
) {
this.path = path.join(electron.app.getPath('userData'), 'config.yaml')
@@ -78,6 +78,11 @@ export class ConfigService {
return defaults
}).reduce(configMerge)
this.load()
hostApp.configChangeBroadcast$.subscribe(() => {
this.load()
this.emitChange()
})
}
getDefaults () {
@@ -96,6 +101,7 @@ export class ConfigService {
save (): void {
fs.writeFileSync(this.path, yaml.safeDump(this._store), 'utf8')
this.emitChange()
this.hostApp.broadcastConfigChange()
}
readRaw (): string {

View File

@@ -76,12 +76,8 @@ export class DockingService {
})
}
getWindow () {
return this.electron.app.window
}
repositionWindow () {
let [x, y] = this.getWindow().getPosition()
let [x, y] = this.hostApp.getWindow().getPosition()
for (let screen of this.electron.screen.getAllDisplays()) {
let bounds = screen.bounds
if (x >= bounds.x && x <= bounds.x + bounds.width && y >= bounds.y && y <= bounds.y + bounds.height) {
@@ -89,6 +85,6 @@ export class DockingService {
}
}
let screen = this.electron.screen.getPrimaryDisplay()
this.getWindow().setPosition(screen.bounds.x, screen.bounds.y)
this.hostApp.getWindow().setPosition(screen.bounds.x, screen.bounds.y)
}
}

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
import { TouchBar } from 'electron'
import { TouchBar, BrowserWindow } from 'electron'
@Injectable()
export class ElectronService {
@@ -13,6 +13,7 @@ export class ElectronService {
screen: any
remote: any
TouchBar: typeof TouchBar
BrowserWindow: typeof BrowserWindow
private electron: any
constructor () {
@@ -27,6 +28,7 @@ export class ElectronService {
this.globalShortcut = this.remote.globalShortcut
this.nativeImage = this.remote.nativeImage
this.TouchBar = this.remote.TouchBar
this.BrowserWindow = this.remote.BrowserWindow
}
remoteRequire (name: string): any {

View File

@@ -25,12 +25,14 @@ export class HomeBaseService {
reportBug () {
let body = `Version: ${this.appVersion}\n`
body += `Platform: ${os.platform()} ${os.release()}\n\n`
body += `Platform: ${os.platform()} ${os.release()}\n`
let label = {
darwin: 'macOS',
windows: 'Windows',
linux: 'Linux',
darwin: 'OS: macOS',
windows: 'OS: Windows',
linux: 'OS: Linux',
}[os.platform()]
let plugins = (window as any).installedPlugins.filter(x => !x.isBuiltin).map(x => x.name)
body += `Plugins: ${plugins.join(', ')}\n\n`
this.electron.shell.openExternal(`https://github.com/eugeny/terminus/issues/new?body=${encodeURIComponent(body)}&labels=${label}`)
}

View File

@@ -1,8 +1,9 @@
import * as path from 'path'
import shellEscape = require('shell-escape')
import { Observable, Subject } from 'rxjs'
import { Injectable, NgZone, EventEmitter } from '@angular/core'
import { ElectronService } from '../services/electron.service'
import { Logger, LogService } from '../services/log.service'
import { ElectronService } from './electron.service'
import { Logger, LogService } from './log.service'
export enum Platform {
Linux, macOS, Windows,
@@ -19,19 +20,23 @@ export interface Bounds {
export class HostAppService {
platform: Platform
nodePlatform: string
ready = new EventEmitter<any>()
shown = new EventEmitter<any>()
isFullScreen = false
private preferencesMenu = new Subject<void>()
private secondInstance = new Subject<void>()
private cliOpenDirectory = new Subject<string>()
private cliRunCommand = new Subject<string[]>()
private cliPaste = new Subject<string>()
private configChangeBroadcast = new Subject<void>()
private logger: Logger
private windowId: number
get preferencesMenu$ (): Observable<void> { return this.preferencesMenu }
get secondInstance$ (): Observable<void> { return this.secondInstance }
get cliOpenDirectory$ (): Observable<string> { return this.cliOpenDirectory }
get cliRunCommand$ (): Observable<string[]> { return this.cliRunCommand }
get cliPaste$ (): Observable<string> { return this.cliPaste }
get configChangeBroadcast$ (): Observable<void> { return this.configChangeBroadcast }
constructor (
private zone: NgZone,
@@ -46,9 +51,12 @@ export class HostAppService {
linux: Platform.Linux
}[this.nodePlatform]
this.windowId = parseInt(location.search.substring(1))
this.logger.info('Window ID:', this.windowId)
electron.ipcRenderer.on('host:preferences-menu', () => this.zone.run(() => this.preferencesMenu.next()))
electron.ipcRenderer.on('uncaughtException', ($event, err) => {
electron.ipcRenderer.on('uncaughtException', (_$event, err) => {
this.logger.error('Unhandled exception:', err)
})
@@ -64,23 +72,33 @@ export class HostAppService {
this.zone.run(() => this.shown.emit())
})
electron.ipcRenderer.on('host:second-instance', ($event, argv: any, cwd: string) => this.zone.run(() => {
electron.ipcRenderer.on('host:second-instance', (_$event, argv: any, cwd: string) => this.zone.run(() => {
this.logger.info('Second instance', argv)
const op = argv._[0]
if (op === 'open') {
this.cliOpenDirectory.next(path.resolve(cwd, argv.directory))
} else if (op === 'run') {
this.cliRunCommand.next(argv.command)
} else if (op === 'paste') {
let text = argv.text
if (argv.escape) {
text = shellEscape([text])
}
this.cliPaste.next(text)
}
}))
this.ready.subscribe(() => {
electron.ipcRenderer.send('app:ready')
})
electron.ipcRenderer.on('host:config-change', () => this.zone.run(() => {
this.configChangeBroadcast.next()
}))
}
getWindow () {
return this.electron.app.window
return this.electron.BrowserWindow.fromId(this.windowId)
}
newWindow () {
this.electron.ipcRenderer.send('app:new-window')
}
getShell () {
@@ -97,7 +115,7 @@ export class HostAppService {
toggleFullscreen () {
let window = this.getWindow()
window.setFullScreen(!window.isFullScreen())
window.setFullScreen(!this.isFullScreen)
}
openDevTools () {
@@ -142,6 +160,26 @@ export class HostAppService {
}
}
setTitle (title: string) {
this.electron.ipcRenderer.send('window-set-title', title)
}
setTouchBar (touchBar: Electron.TouchBar) {
this.getWindow().setTouchBar(touchBar)
}
popupContextMenu (menuDefinition: Electron.MenuItemConstructorOptions[]) {
this.electron.ipcRenderer.send('window-popup-context-menu', menuDefinition)
}
broadcastConfigChange () {
this.electron.ipcRenderer.send('app:config-change')
}
emitReady () {
this.electron.ipcRenderer.send('app:ready')
}
quit () {
this.logger.info('Quitting')
this.electron.app.quit()

View File

@@ -174,6 +174,10 @@ export class HotkeysService {
@Injectable()
export class AppHotkeyProvider extends HotkeyProvider {
hotkeys: IHotkeyDescription[] = [
{
id: 'new-window',
name: 'New window',
},
{
id: 'toggle-window',
name: 'Toggle terminal window',

View File

@@ -0,0 +1,85 @@
import * as path from 'path'
import * as fs from 'mz/fs'
import { exec } from 'mz/child_process'
import { Injectable } from '@angular/core'
import { ElectronService } from './electron.service'
import { HostAppService, Platform } from './hostApp.service'
let Registry = null
try {
Registry = require('winreg')
} catch (_) { } // tslint:disable-line no-empty
@Injectable()
export class ShellIntegrationService {
private automatorWorkflows = ['Open Terminus here.workflow', 'Paste path into Terminus.workflow']
private automatorWorkflowsLocation: string
private automatorWorkflowsDestination: string
private registryKeys = [
{
path: '\\Software\\Classes\\Directory\\Background\\shell\\Open Terminus here',
command: 'open "%V"'
},
{
path: '\\Software\\Classes\\*\\shell\\Paste path into Terminus',
command: 'paste "%V"'
},
]
constructor (
private electron: ElectronService,
private hostApp: HostAppService,
) {
if (this.hostApp.platform === Platform.macOS) {
this.automatorWorkflowsLocation = path.join(
path.dirname(path.dirname(this.electron.app.getPath('exe'))),
'Resources',
'extras',
'automator-workflows',
)
this.automatorWorkflowsDestination = path.join(process.env.HOME, 'Library', 'Services')
}
}
async isInstalled (): Promise<boolean> {
if (this.hostApp.platform === Platform.macOS) {
return await fs.exists(path.join(this.automatorWorkflowsDestination, this.automatorWorkflows[0]))
} else if (this.hostApp.platform === Platform.Windows) {
return await new Promise<boolean>(resolve => {
let reg = new Registry({ hive: Registry.HKCU, key: this.registryKeys[0].path, arch: 'x64' })
reg.keyExists((err, exists) => resolve(!err && exists))
})
}
return true
}
async install () {
if (this.hostApp.platform === Platform.macOS) {
for (let wf of this.automatorWorkflows) {
await exec(`cp -r "${this.automatorWorkflowsLocation}/${wf}" "${this.automatorWorkflowsDestination}"`)
}
} else if (this.hostApp.platform === Platform.Windows) {
for (let registryKey of this.registryKeys) {
let reg = new Registry({ hive: Registry.HKCU, key: registryKey.path, arch: 'x64' })
await new Promise(resolve => {
reg.set('Icon', Registry.REG_SZ, this.electron.app.getPath('exe'), () => {
reg.create(() => {
let cmd = new Registry({
hive: Registry.HKCU,
key: registryKey.path + '\\command',
arch: 'x64'
})
cmd.create(() => {
cmd.set(
'',
Registry.REG_SZ,
this.electron.app.getPath('exe') + ' ' + registryKey.command,
() => resolve()
)
})
})
})
})
}
}
}
}

View File

@@ -3,15 +3,18 @@ import { TouchBarSegmentedControl, SegmentedControlSegment } from 'electron'
import { AppService } from './app.service'
import { ConfigService } from './config.service'
import { ElectronService } from './electron.service'
import { HostAppService } from './hostApp.service'
import { IToolbarButton, ToolbarButtonProvider } from '../api'
@Injectable()
export class TouchbarService {
private tabsSegmentedControl: TouchBarSegmentedControl
private tabSegments: SegmentedControlSegment[] = []
private nsImageCache: {[id: string]: Electron.NativeImage} = {}
constructor (
private app: AppService,
private hostApp: HostAppService,
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
private config: ConfigService,
private electron: ElectronService,
@@ -51,18 +54,24 @@ export class TouchbarService {
...buttons.map(button => this.getButton(button))
]
})
this.electron.app.window.setTouchBar(touchBar)
this.hostApp.setTouchBar(touchBar)
}
private getButton (button: IToolbarButton): Electron.TouchBarButton {
return new this.electron.TouchBar.TouchBarButton({
label: button.touchBarNSImage ? null : this.shortenTitle(button.touchBarTitle || button.title),
icon: button.touchBarNSImage ?
this.electron.nativeImage.createFromNamedImage(button.touchBarNSImage, [0, 0, 1]) : null,
icon: button.touchBarNSImage ? this.getCachedNSImage(button.touchBarNSImage) : null,
click: () => this.zone.run(() => button.click()),
})
}
private getCachedNSImage (name: string) {
if (!this.nsImageCache[name]) {
this.nsImageCache[name] = this.electron.nativeImage.createFromNamedImage(name, [0, 0, 1])
}
return this.nsImageCache[name]
}
private shortenTitle (title: string): string {
if (title.length > 15) {
title = title.substring(0, 15) + '...'

View File

@@ -0,0 +1,398 @@
$black: #002b36;
$base02: #073642;
$base01: #586e75;
$base00: #657b83;
$base0: #839496;
$base1: #93a1a1;
$base2: #eee8d5;
$white: #fdf6e3;
$yellow: #b58900;
$orange: #cb4b16;
$red: #dc322f;
$pink: #d33682;
$purple: #6c71c4;
$blue: #268bd2;
$teal: #2aa198;
$green: #859900;
$tab-border-radius: 5px;
$button-hover-bg: rgba(0, 0, 0, .125);
$button-active-bg: rgba(0, 0, 0, .25);
$theme-colors: (
"primary": $orange,
"secondary": $base0
);
$content-bg: rgba($white, 0.65);
$content-bg-solid: $white;
$body-bg: $base2;
$body-bg2: $base1;
$body-color: $black;
$font-family-sans-serif: "Source Sans Pro";
$font-size-base: 14rem / 16;
$btn-border-radius: 0;
$nav-tabs-border-width: 0;
$nav-tabs-border-radius: 0;
$nav-tabs-link-hover-border-color: $body-bg;
$nav-tabs-active-link-hover-color: $white;
$nav-tabs-active-link-hover-bg: $blue;
$nav-tabs-active-link-hover-border-color: darken($blue, 30%);
$nav-pills-border-radius: 0;
$input-bg: $base2;
$input-disabled-bg: $base1;
$input-color: $body-color;
$input-color-placeholder: $base1;
$input-border-color: $base1;
//$input-box-shadow: inset 0 1px 1px rgba($black,.075);
$input-border-radius: 0;
$custom-select-border-radius: 0;
$input-bg-focus: $input-bg;
//$input-border-focus: lighten($brand-primary, 25%);
//$input-box-shadow-focus: $input-box-shadow, rgba($input-border-focus, .6);
$input-color-focus: $input-color;
$input-group-addon-bg: $body-bg;
$input-group-addon-border-color: $input-border-color;
$modal-content-bg: $content-bg-solid;
$modal-content-border-color: $body-bg;
$modal-header-border-color: transparent;
$modal-footer-border-color: transparent;
$popover-bg: $body-bg;
$dropdown-bg: $body-bg;
$dropdown-link-color: $body-color;
$dropdown-link-hover-color: #333;
$dropdown-link-hover-bg: $body-bg2;
//$dropdown-link-active-color: $component-active-color;
//$dropdown-link-active-bg: $component-active-bg;
$dropdown-link-disabled-color: #333;
$dropdown-header-color: #333;
$list-group-color: $body-color;
$list-group-bg: rgba($black,.05);
$list-group-border-color: rgba($black,.1);
$list-group-hover-bg: rgba($black,.1);
$list-group-link-active-bg: rgba($black,.2);
$list-group-action-color: $body-color;
$list-group-action-bg: rgba($black,.05);
$list-group-action-active-bg: $list-group-link-active-bg;
$list-group-border-radius: 0;
$pre-bg: $dropdown-bg;
$pre-color: $dropdown-link-color;
$alert-danger-bg: $body-bg;
$alert-danger-text: $red;
$alert-danger-border: $red;
$headings-font-weight: lighter;
$headings-color: $base0;
@import '~bootstrap/scss/bootstrap.scss';
window-controls {
svg {
transition: 0.25s fill;
fill: $base01;
}
button:hover {
background: rgba($black, 0.125);
svg {
fill: $black;
}
}
.btn-close:hover {
background: #8a2828;
}
}
$border-color: $base1;
body {
background: $body-bg;
&.vibrant {
background: rgba(255, 255, 255,.4) !important;
}
}
app-root {
&> .content {
.tab-bar {
height: 40px;
.btn-tab-bar {
background: transparent;
line-height: 42px;
svg {
fill: $black;
fill-opacity: 0.75;
}
&:hover { background: rgba(0, 0, 0, .125) !important; }
&:active { background: rgba(0, 0, 0, .25) !important; }
}
&>.tabs {
tab-header {
border-left: 1px solid transparent;
border-right: 1px solid transparent;
color: $base01;
transition: 0.125s ease-out width;
.index {
color: rgba($black, 0.4);
}
button {
color: $body-color;
border: none;
transition: 0.25s all;
&:hover { background: $button-hover-bg !important; }
&:active { background: $button-active-bg !important; }
}
.progressbar {
background: $blue;
}
&.active {
color: $black;
background: $content-bg;
border-left: 1px solid $border-color;
border-right: 1px solid $border-color;
}
}
}
}
&.tabs-on-top .tab-bar {
&>.background {
border-bottom: 1px solid $border-color;
}
tab-header {
border-bottom: 1px solid $border-color;
&.active {
border-bottom-color: transparent;
}
&.has-activity:not(.active) {
background: linear-gradient(to bottom, rgba(208, 0, 0, 0) 95%, #36beff 96%);
}
}
}
&:not(.tabs-on-top) .tab-bar {
&>.background {
border-top: 1px solid $border-color;
}
tab-header {
border-top: 1px solid $border-color;
&.active {
margin-top: -1px;
}
&.has-activity:not(.active) {
background: linear-gradient(to top, rgba(208, 0, 0, 0) 95%, #36beff 96%);
}
}
}
}
&.platform-win32, &.platform-linux {
border: 1px solid #111;
&>.content .tab-bar .tabs tab-header:first-child {
border-left: none;
}
}
}
tab-body {
background: $content-bg;
}
settings-tab > ngb-tabset {
border-right: 1px solid $body-bg;
& > .nav {
background: rgba(0, 0, 0, 0.25);
& > .nav-item > .nav-link {
border: none;
padding: 10px 50px 10px 20px;
font-size: 14px;
&:not(.active) {
color: $body-color;
}
}
}
}
multi-hotkey-input {
.item {
background: $body-bg2;
border: 1px solid $blue;
border-radius: 3px;
margin-right: 5px;
.body {
padding: 3px 0 2px;
.stroke {
padding: 0 6px;
border-right: 1px solid $content-bg;
}
}
.remove {
padding: 3px 8px 2px;
}
}
.add {
color: #777;
padding: 4px 10px 0;
}
.add, .item .body, .item .remove {
&:hover { background: darken($body-bg2, 5%); }
&:active { background: darken($body-bg2, 15%); }
}
}
hotkey-input-modal {
.input {
background: $input-bg;
padding: 10px;
font-size: 24px;
line-height: 27px;
height: 55px;
.stroke {
background: $body-bg2;
border: 1px solid $blue;
border-radius: 3px;
margin-right: 10px;
padding: 3px 10px;
}
}
.timeout {
background: $input-bg;
div {
background: $blue;
}
}
}
.form-group label {
margin-bottom: 2px;
}
.nav-tabs {
.nav-link {
transition: 0.25s all;
border-bottom-color: $nav-tabs-border-color;
}
}
ngb-tabset .tab-content {
padding-top: 20px;
}
[ngbradiogroup] > label.active {
background: $blue;
}
.btn {
i + * {
margin-left: 5px;
}
&.btn-lg i + * {
margin-left: 10px;
}
}
.input-group-addon + .form-control {
border-left: none;
}
.input-group > select.form-control {
flex-direction: row;
}
.list-group-item {
transition: 0.25s background;
&:not(:first-child) {
border-top: none;
}
i + * {
margin-left: 10px;
}
}
select.form-control {
-webkit-appearance: none;
background-image: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'><path fill='#444' d='M7.406 7.828l4.594 4.594 4.594-4.594 1.406 1.406-6 6-6-6z'></path></svg>");
background-position: 100% 50%;
background-repeat: no-repeat;
padding-right: 30px;
}
checkbox i.on {
color: $blue;
}
toggle {
.body {
border-color: $base0 !important;
.toggle {
background: $base0 !important;
}
}
&.active .body .toggle {
background: theme-colors(primary) !important;
}
}
.list-group-item svg {
fill: $black;
}
.terminus-title {
color: $base01;
}
.terminus-logo {
filter: saturate(0);
}
start-page footer {
background: $white !important;
}

View File

@@ -36,8 +36,7 @@ $btn-secondary-border: #444;
//$btn-warning-bg: rgba($orange, .5);
$nav-tabs-border-color: $body-bg;
$nav-tabs-border-width: 1px;
$nav-tabs-border-width: 0;
$nav-tabs-border-radius: 0;
$nav-tabs-link-hover-border-color: $body-bg;
$nav-tabs-active-link-hover-color: $white;
@@ -83,6 +82,10 @@ $list-group-border-color: rgba(255,255,255,.1);
$list-group-hover-bg: rgba(255,255,255,.1);
$list-group-link-active-bg: rgba(255,255,255,.2);
$list-group-action-color: $body-color;
$list-group-action-bg: rgba(255,255,255,.05);
$list-group-action-active-bg: $list-group-link-active-bg;
$pre-bg: $dropdown-bg;
$pre-color: $dropdown-link-color;
@@ -124,9 +127,9 @@ app-root {
&> .content {
.tab-bar {
.btn-tab-bar {
&:not(:hover):not(:active) {
background: transparent;
}
background: transparent;
&:hover { background: rgba(0, 0, 0, .25) !important; }
&:active { background: rgba(0, 0, 0, .5) !important; }
}
&>.tabs {
@@ -134,10 +137,10 @@ app-root {
border-left: 1px solid transparent;
border-right: 1px solid transparent;
transition: 0.25s all;
transition: 0.125s ease-out width;
.index {
color: #888;
color: rgba(255, 255, 255, 0.4);
}
button {
@@ -219,10 +222,7 @@ settings-tab > ngb-tabset {
background: rgba(0, 0, 0, 0.25);
& > .nav-item > .nav-link {
border-left: none;
border-right: none;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
border: none;
padding: 10px 50px 10px 20px;
font-size: 14px;
@@ -233,11 +233,6 @@ settings-tab > ngb-tabset {
color: $white;
}
}
&.active {
border-top-color: $nav-tabs-active-link-hover-border-color;
border-bottom-color: $nav-tabs-active-link-hover-border-color;
}
}
}
}
@@ -361,3 +356,8 @@ checkbox i.on {
toggle.active .body .toggle {
background: $blue;
}
.list-group-item svg {
fill: white;
fill-opacity: 0.75;
}

View File

@@ -14,3 +14,10 @@ export class StandardCompactTheme extends Theme {
css = require('./theme.compact.scss')
terminalBackground = '#1D272D'
}
@Injectable()
export class PaperTheme extends Theme {
name = 'Paper'
css = require('./theme.paper.scss')
terminalBackground = '#1D272D'
}

View File

@@ -460,6 +460,10 @@ semver@^5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
shell-escape@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/shell-escape/-/shell-escape-0.2.0.tgz#68fd025eb0490b4f567a027f0bf22480b5f84133"
sntp@2.x.x:
version "2.1.0"
resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8"
@@ -545,6 +549,10 @@ verror@1.10.0:
core-util-is "1.0.2"
extsprintf "^1.2.0"
winreg@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
winston@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/winston/-/winston-2.4.0.tgz#808050b93d52661ed9fb6c26b3f0c826708b0aee"

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-plugin-manager",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "Terminus' plugin manager",
"keywords": [
"terminus-builtin-plugin"

View File

@@ -72,7 +72,7 @@ div(*ngIf='npmInstalled')
)
.list-group(*ngIf='availablePlugins$')
.list-group.mb-4(*ngIf='availablePlugins$')
ng-container(*ngFor='let plugin of (availablePlugins$|async|orderBy:"name")')
.list-group-item.flex-column.align-items-start(*ngIf='!isAlreadyInstalled(plugin)')
.d-flex.w-100

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-settings",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "Terminus terminal settings page",
"keywords": [
"terminus-builtin-plugin"

View File

@@ -19,6 +19,14 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
i.fa.fa-bug
span Report a problem
.form-line(*ngIf='!isShellIntegrationInstalled')
.header
.title Shell integration
.description Allows quickly opening a terminal in the selected folder
button.btn.btn-primary((click)='installShellIntegration()')
i.fa.fa-check
span Install
.form-line
.header
.title Theme

View File

@@ -1,7 +1,19 @@
import * as yaml from 'js-yaml'
import { Subscription } from 'rxjs'
import { Component, Inject, Input } from '@angular/core'
import { ElectronService, DockingService, ConfigService, IHotkeyDescription, HotkeyProvider, BaseTabComponent, Theme, HostAppService, Platform, HomeBaseService } from 'terminus-core'
import {
ElectronService,
DockingService,
ConfigService,
IHotkeyDescription,
HotkeyProvider,
BaseTabComponent,
Theme,
HostAppService,
Platform,
HomeBaseService,
ShellIntegrationService
} from 'terminus-core'
import { SettingsTabProvider } from '../api'
@@ -21,6 +33,7 @@ export class SettingsTabComponent extends BaseTabComponent {
Platform = Platform
configDefaults: any
configFile: string
isShellIntegrationInstalled = false
private configSubscription: Subscription
constructor (
@@ -29,6 +42,7 @@ export class SettingsTabComponent extends BaseTabComponent {
public docking: DockingService,
public hostApp: HostAppService,
public homeBase: HomeBaseService,
public shellIntegration: ShellIntegrationService,
@Inject(HotkeyProvider) hotkeyProviders: HotkeyProvider[],
@Inject(SettingsTabProvider) public settingsProviders: SettingsTabProvider[],
@Inject(Theme) public themes: Theme[],
@@ -47,6 +61,10 @@ export class SettingsTabComponent extends BaseTabComponent {
})
}
async ngOnInit () {
this.isShellIntegrationInstalled = await this.shellIntegration.isInstalled()
}
getRecoveryToken (): any {
return { type: 'app:settings' }
}
@@ -75,4 +93,9 @@ export class SettingsTabComponent extends BaseTabComponent {
return false
}
}
async installShellIntegration () {
await this.shellIntegration.install()
this.isShellIntegrationInstalled = true
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-ssh",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "SSH connection manager for Terminus",
"keywords": [
"terminus-builtin-plugin"

View File

@@ -1,5 +1,10 @@
import { BaseSession } from 'terminus-terminal'
export interface LoginScript {
expect?: string
send: string
}
export interface SSHConnection {
name?: string
host: string
@@ -7,18 +12,45 @@ export interface SSHConnection {
user: string
password?: string
privateKey?: string
group?: string
scripts?: LoginScript[]
keepaliveInterval?: number
keepaliveCountMax?: number
readyTimeout?: number
}
export class SSHSession extends BaseSession {
constructor (private shell: any) {
scripts?: LoginScript[]
constructor (private shell: any, conn: SSHConnection) {
super()
this.scripts = conn.scripts || []
}
start () {
this.open = true
this.shell.on('data', data => {
this.emitOutput(data.toString())
let dataString = data.toString()
this.emitOutput(dataString)
if (this.scripts) {
let found = false
for (let script of this.scripts) {
if (dataString.includes(script.expect)) {
console.log('Executing script:', script.send)
this.shell.write(script.send + '\n')
this.scripts = this.scripts.filter(x => x !== script)
found = true
} else {
break
}
}
if (found) {
this.executeUnconditionalScripts()
}
}
})
this.shell.on('end', () => {
@@ -26,6 +58,8 @@ export class SSHSession extends BaseSession {
this.destroy()
}
})
this.executeUnconditionalScripts()
}
resize (columns, rows) {
@@ -51,4 +85,23 @@ export class SSHSession extends BaseSession {
async getWorkingDirectory (): Promise<string> {
return null
}
private executeUnconditionalScripts () {
if (this.scripts) {
for (let script of this.scripts) {
if (!script.expect) {
console.log('Executing script:', script.send)
this.shell.write(script.send + '\n')
this.scripts = this.scripts.filter(x => x !== script)
} else {
break
}
}
}
}
}
export interface ISSHConnectionGroup {
name: string
connections: SSHConnection[]
}

View File

@@ -1,45 +1,139 @@
.modal-body
.form-group
label Name
input.form-control(
type='text',
[(ngModel)]='connection.name',
)
ngb-tabset(type='pills', [activeId]='basic')
ngb-tab(id='basic')
ng-template(ngbTabTitle)
| Basic Setting
ng-template(ngbTabContent)
.form-group
label Name
input.form-control(
type='text',
autofocus,
[(ngModel)]='connection.name',
)
.form-group
label Host
input.form-control(
type='text',
[(ngModel)]='connection.host',
)
.form-group
label Group
input.form-control(
type='text',
placeholder='Ungrouped',
[(ngModel)]='connection.group',
)
.form-group
label Port
input.form-control(
type='number',
placeholder='22',
[(ngModel)]='connection.port',
)
.form-group
label Host
input.form-control(
type='text',
[(ngModel)]='connection.host',
)
.form-group
label Username
input.form-control(
type='text',
[(ngModel)]='connection.user',
)
.form-group
label Port
input.form-control(
type='number',
placeholder='22',
[(ngModel)]='connection.port',
)
.form-group
label Private key
.input-group
input.form-control(
type='text',
placeholder='Key file path',
[(ngModel)]='connection.privateKey'
)
.input-group-btn
button.btn.btn-secondary((click)='selectPrivateKey()')
i.fa.fa-folder-open
.form-group
label Username
input.form-control(
type='text',
[(ngModel)]='connection.user',
)
.alert.alert-info.d-flex.bg-transparent.text-white.align-items-center(*ngIf='hasSavedPassword')
.mr-auto There is a saved password for this connection
button.btn.btn-danger.ml-4((click)='clearSavedPassword()') Forget
.form-group
label Private key
.input-group
input.form-control(
type='text',
placeholder='Key file path',
[(ngModel)]='connection.privateKey'
)
.input-group-btn
button.btn.btn-secondary((click)='selectPrivateKey()')
i.fa.fa-folder-open
ngb-tab(id='advanced')
ng-template(ngbTabTitle)
| Advanced Setting
ng-template(ngbTabContent)
.form-group
label Keep Alive Interval (Milliseconds)
input.form-control(
type='number',
placeholder='0',
[(ngModel)]='connection.keepaliveInterval',
)
.form-group
label Max Keep Alive Count
input.form-control(
type='number',
placeholder='3',
[(ngModel)]='connection.keepaliveCountMax',
)
.form-group
label Ready Timeout (Milliseconds)
input.form-control(
type='number',
placeholder='20000',
[(ngModel)]='connection.readyTimeout',
)
ngb-tab(id='scripts')
ng-template(ngbTabTitle)
| Login Scripts
ng-template(ngbTabContent)
table
tr
th String to expect
th String to be sent
th Actions
tr(*ngFor='let script of connection.scripts')
td
input.form-control(
type='text',
[(ngModel)]='script.expect'
)
td
input.form-control(
type='text',
[(ngModel)]='script.send'
)
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='moveScriptUp(script)')
i.fa.fa-arrow-up
button.btn.btn-outline-info.ml-0((click)='moveScriptDown(script)')
i.fa.fa-arrow-down
button.btn.btn-outline-danger.ml-0((click)='deleteScript(script)')
i.fa.fa-trash-o
tr
td
input.form-control(
type='text',
placeholder='Enter a string to expect',
[(ngModel)]='newScript.expect'
)
td
input.form-control(
type='text',
placeholder='Enter a string to be sent',
[(ngModel)]='newScript.send'
)
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='addScript()')
i.fa.fa-check
button.btn.btn-outline-danger.ml-0((click)='clearScript()')
i.fa.fa-trash-o
.modal-footer
button.btn.btn-outline-primary((click)='save()') Save
button.btn.btn-outline-danger((click)='cancel()') Cancel

View File

@@ -1,19 +1,34 @@
import { Component } from '@angular/core'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { ElectronService, HostAppService } from 'terminus-core'
import { SSHConnection } from '../api'
import { PasswordStorageService } from '../services/passwordStorage.service'
import { SSHConnection, LoginScript } from '../api'
@Component({
template: require('./editConnectionModal.component.pug'),
})
export class EditConnectionModalComponent {
connection: SSHConnection
newScript: LoginScript
hasSavedPassword: boolean
constructor (
private modalInstance: NgbActiveModal,
private electron: ElectronService,
private hostApp: HostAppService,
) { }
private passwordStorage: PasswordStorageService,
) {
this.newScript = { expect: '', send: '' }
}
async ngOnInit () {
this.hasSavedPassword = !!(await this.passwordStorage.loadPassword(this.connection))
}
clearSavedPassword () {
this.hasSavedPassword = false
this.passwordStorage.deletePassword(this.connection)
}
selectPrivateKey () {
let path = this.electron.dialog.showOpenDialog(
@@ -34,4 +49,39 @@ export class EditConnectionModalComponent {
cancel () {
this.modalInstance.dismiss()
}
moveScriptUp (script: LoginScript) {
let index = this.connection.scripts.indexOf(script)
if (index > 0) {
this.connection.scripts.splice(index, 1)
this.connection.scripts.splice(index - 1, 0, script)
}
}
moveScriptDown (script: LoginScript) {
let index = this.connection.scripts.indexOf(script)
if (index >= 0 && index < this.connection.scripts.length - 1) {
this.connection.scripts.splice(index, 1)
this.connection.scripts.splice(index + 1, 0, script)
}
}
deleteScript (script: LoginScript) {
if (confirm(`Delete?`)) {
this.connection.scripts = this.connection.scripts.filter(x => x !== script)
}
}
addScript () {
if (!this.connection.scripts) {
this.connection.scripts = []
}
this.connection.scripts.push({...this.newScript})
this.clearScript()
}
clearScript () {
this.newScript.expect = ''
this.newScript.send = ''
}
}

View File

@@ -1,6 +1,7 @@
.modal-body
input.form-control(
[type]='password ? "password" : "text"',
autofocus,
[(ngModel)]='value',
#input,
[placeholder]='prompt',

View File

@@ -4,6 +4,7 @@
[(ngModel)]='quickTarget',
autofocus,
placeholder='Quick connect: [user@]host[:port]',
(ngModelChange)='refresh()',
(keyup.enter)='quickConnect()'
)
@@ -12,13 +13,16 @@
i.fa.fa-fw.fa-history
span {{lastConnection.name}}
.list-group.mt-3
a.list-group-item.list-group-item-action(*ngFor='let connection of connections', (click)='connect(connection)')
i.fa.fa-fw.fa-globe
span {{connection.name}}
a.list-group-item.list-group-item-action((click)='manageConnections()')
i.fa.fa-fw.fa-wrench
span Manage connections
//.modal-footer
button.btn.btn-outline-primary((click)='close()') Cancel
.list-group.mt-3.connections-list
ng-container(*ngFor='let group of childGroups')
.list-group-item.list-group-item-action.d-flex.align-items-center(
(click)='groupCollapsed[group.name] = !groupCollapsed[group.name]'
)
.fa.fa-fw.fa-chevron-right(*ngIf='groupCollapsed[group.name]')
.fa.fa-fw.fa-chevron-down(*ngIf='!groupCollapsed[group.name]')
.ml-2 {{group.name || "Ungrouped"}}
ng-container(*ngIf='!groupCollapsed[group.name]')
.list-group-item.list-group-item-action.pl-5.d-flex.align-items-center(
*ngFor='let connection of group.connections',
(click)='connect(connection)'
) {{connection.name}}

View File

@@ -0,0 +1,5 @@
.list-group.connections-list {
display: block;
max-height: 70vh;
overflow-y: auto;
}

View File

@@ -4,16 +4,19 @@ import { ToastrService } from 'ngx-toastr'
import { ConfigService, AppService } from 'terminus-core'
import { SettingsTabComponent } from 'terminus-settings'
import { SSHService } from '../services/ssh.service'
import { SSHConnection } from '../api'
import { SSHConnection, ISSHConnectionGroup } from '../api'
@Component({
template: require('./sshModal.component.pug'),
//styles: [require('./sshModal.component.scss')],
styles: [require('./sshModal.component.scss')],
})
export class SSHModalComponent {
connections: SSHConnection[]
childFolders: ISSHConnectionGroup[]
quickTarget: string
lastConnection: SSHConnection
childGroups: ISSHConnectionGroup[]
groupCollapsed: {[id: string]: boolean} = {}
constructor (
public modalInstance: NgbActiveModal,
@@ -28,6 +31,7 @@ export class SSHModalComponent {
if (window.localStorage.lastConnection) {
this.lastConnection = JSON.parse(window.localStorage.lastConnection)
}
this.refresh()
}
quickConnect () {
@@ -65,4 +69,26 @@ export class SSHModalComponent {
close () {
this.modalInstance.close()
}
refresh () {
this.childGroups = []
let connections = this.connections
if (this.quickTarget) {
connections = connections.filter(connection => (connection.name + connection.group).toLowerCase().includes(this.quickTarget))
}
for (let connection of connections) {
connection.group = connection.group || null
let group = this.childGroups.find(x => x.name === connection.group)
if (!group) {
group = {
name: connection.group,
connections: [],
}
this.childGroups.push(group)
}
group.connections.push(connection)
}
}
}

View File

@@ -1,15 +1,25 @@
h3 Connections
.list-group.mt-3.mb-3
.list-group-item(*ngFor='let connection of connections')
.d-flex.w-100
.mr-auto
div
span {{connection.name}}
.text-muted {{connection.host}}
button.btn.btn-outline-info.ml-2((click)='editConnection(connection)')
ng-container(*ngFor='let group of childGroups')
.list-group-item.list-group-item-action.d-flex.align-items-center((click)='groupCollapsed[group.name] = !groupCollapsed[group.name]')
.fa.fa-fw.fa-chevron-right(*ngIf='groupCollapsed[group.name]')
.fa.fa-fw.fa-chevron-down(*ngIf='!groupCollapsed[group.name]')
span.ml-3.mr-auto {{group.name || "Ungrouped"}}
button.btn.btn-outline-info.ml-2((click)='editGroup(group)')
i.fa.fa-pencil
button.btn.btn-outline-danger.ml-1((click)='deleteConnection(connection)')
button.btn.btn-outline-danger.ml-1((click)='deleteGroup(group)')
i.fa.fa-trash-o
ng-container(*ngIf='!groupCollapsed[group.name]')
.list-group-item.pl-5.d-flex.align-items-center(*ngFor='let connection of group.connections')
.mr-auto
div {{connection.name}}
.text-muted {{connection.host}}
button.btn.btn-outline-info.ml-2((click)='editConnection(connection)')
i.fa.fa-pencil
button.btn.btn-outline-danger.ml-1((click)='deleteConnection(connection)')
i.fa.fa-trash-o
button.btn.btn-outline-primary((click)='createConnection()') Add connection
button.btn.btn-outline-primary((click)='createConnection()')
div.fa.fa-fw.fa-globe
span.ml-2 Add connection

View File

@@ -1,20 +1,24 @@
import { Component } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { ConfigService } from 'terminus-core'
import { SSHConnection } from '../api'
import { SSHConnection, ISSHConnectionGroup } from '../api'
import { EditConnectionModalComponent } from './editConnectionModal.component'
import { PromptModalComponent } from './promptModal.component'
@Component({
template: require('./sshSettingsTab.component.pug'),
})
export class SSHSettingsTabComponent {
connections: SSHConnection[]
childGroups: ISSHConnectionGroup[]
groupCollapsed: {[id: string]: boolean} = {}
constructor (
public config: ConfigService,
private ngbModal: NgbModal,
) {
this.connections = this.config.store.ssh.connections
this.refresh()
}
createConnection () {
@@ -24,12 +28,14 @@ export class SSHSettingsTabComponent {
port: 22,
user: 'root',
}
let modal = this.ngbModal.open(EditConnectionModalComponent)
modal.componentInstance.connection = connection
modal.result.then(result => {
this.connections.push(result)
this.config.store.ssh.connections = this.connections
this.config.save()
this.refresh()
})
}
@@ -39,6 +45,7 @@ export class SSHSettingsTabComponent {
modal.result.then(result => {
Object.assign(connection, result)
this.config.save()
this.refresh()
})
}
@@ -47,6 +54,49 @@ export class SSHSettingsTabComponent {
this.connections = this.connections.filter(x => x !== connection)
this.config.store.ssh.connections = this.connections
this.config.save()
this.refresh()
}
}
editGroup (group: ISSHConnectionGroup) {
let modal = this.ngbModal.open(PromptModalComponent)
modal.componentInstance.prompt = 'New group name'
modal.componentInstance.value = group.name
modal.result.then(result => {
if (result) {
for (let connection of this.connections.filter(x => x.group === group.name)) {
connection.group = result
}
this.config.save()
this.refresh()
}
})
}
deleteGroup (group: ISSHConnectionGroup) {
if (confirm(`Delete "${group}"?`)) {
for (let connection of this.connections.filter(x => x.group === group.name)) {
connection.group = null
}
this.config.save()
this.refresh()
}
}
refresh () {
this.childGroups = []
for (let connection of this.connections) {
connection.group = connection.group || null
let group = this.childGroups.find(x => x.name === connection.group)
if (!group) {
group = {
name: connection.group,
connections: [],
}
this.childGroups.push(group)
}
group.connections.push(connection)
}
}
}

View File

@@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
import { ToolbarButtonProvider, ConfigProvider } from 'terminus-core'
import TerminusCoreModule from 'terminus-core'
import { SettingsTabProvider } from 'terminus-settings'
import { EditConnectionModalComponent } from './components/editConnectionModal.component'
@@ -23,6 +24,7 @@ import { SSHSettingsTabProvider } from './settings'
CommonModule,
FormsModule,
ToastrModule,
TerminusCoreModule,
],
providers: [
PasswordStorageService,

View File

@@ -55,7 +55,7 @@ export class SSHService {
modal.componentInstance.password = true
try {
privateKeyPassphrase = await modal.result
} catch (_err) { }
} catch (_err) { } // tslint:disable-line
}
}
}
@@ -110,6 +110,9 @@ export class SSHService {
tryKeyboard: true,
agent,
agentForward: !!agent,
keepaliveInterval: connection.keepaliveInterval,
keepaliveCountMax: connection.keepaliveCountMax,
readyTimeout: connection.readyTimeout,
})
let keychainPasswordUsed = false
@@ -148,7 +151,7 @@ export class SSHService {
})
})
let session = new SSHSession(shell)
let session = new SSHSession(shell, connection)
return this.zone.run(() => this.app.openNewTab(
TerminalTabComponent,

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-terminal",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.55",
"description": "Terminus' terminal emulation core",
"keywords": [
"terminus-builtin-plugin"
@@ -41,7 +41,7 @@
"@types/async-lock": "0.0.19",
"async-lock": "^1.0.0",
"font-manager": "0.3.0",
"hterm-umdjs": "1.1.3",
"hterm-umdjs": "1.4.1",
"mz": "^2.6.0",
"node-pty-tmp": "0.7.2",
"ps-node": "^0.1.6",

View File

@@ -15,25 +15,6 @@ export class ButtonProvider extends ToolbarButtonProvider {
hotkeys: HotkeysService,
) {
super()
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
if (hotkey === 'new-tab') {
this.terminal.openTab()
}
})
hostApp.cliOpenDirectory$.subscribe(async directory => {
if (await fs.exists(directory)) {
if ((await fs.stat(directory)).isDirectory()) {
this.terminal.openTab(null, directory)
}
}
})
hostApp.cliRunCommand$.subscribe(async command => {
this.terminal.openTab({
id: '',
command: command[0],
args: command.slice(1),
}, null, true)
})
if (!electron.remote.process.env.DEV) {
setImmediate(async () => {
let argv: string[] = electron.remote.process.argv

View File

@@ -199,7 +199,7 @@ export class TerminalTabComponent extends BaseTabComponent {
}
})
this.contextMenu = this.electron.remote.Menu.buildFromTemplate([
this.contextMenu = [
{
label: 'New terminal',
click: () => {
@@ -227,7 +227,7 @@ export class TerminalTabComponent extends BaseTabComponent {
})
}
},
])
]
}
detachTermContainerHandlers () {
@@ -249,9 +249,7 @@ export class TerminalTabComponent extends BaseTabComponent {
if (event.type === 'mousedown') {
if (event.which === 3) {
if (this.config.store.terminal.rightClick === 'menu') {
this.contextMenu.popup({
async: true,
})
this.hostApp.popupContextMenu(this.contextMenu)
} else if (this.config.store.terminal.rightClick === 'paste') {
this.paste()
}
@@ -292,14 +290,17 @@ export class TerminalTabComponent extends BaseTabComponent {
sendInput (data: string) {
this.session.write(data)
this.frontend.scrollToBottom()
}
write (data: string) {
let percentageMatch = /(\d+(\.\d+)?)%/.exec(data)
let percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
if (percentageMatch) {
let percentage = percentageMatch[2] ? parseFloat(percentageMatch[1]) : parseInt(percentageMatch[1])
this.setProgress(percentage)
console.log('Detected progress:', percentage)
let percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
if (percentage > 0 && percentage <= 100) {
this.setProgress(percentage)
console.log('Detected progress:', percentage)
}
} else {
this.setProgress(null)
}

View File

@@ -52,6 +52,7 @@ export abstract class Frontend {
abstract write (data: string): void
abstract clear (): void
abstract visualBell (): void
abstract scrollToBottom (): void
abstract configure (configStore: any): void
abstract setZoom (zoom: number): void

View File

@@ -8,6 +8,7 @@ export class HTermFrontend extends Frontend {
private initialized = false
private configuredFontSize = 0
private configuredLinePadding = 0
private configuredBackgroundColor = 'transparent'
private zoom = 0
attach (host: HTMLElement) {
@@ -87,6 +88,8 @@ export class HTermFrontend extends Frontend {
preferenceManager.set('background-color', 'transparent')
}
this.configuredBackgroundColor = preferenceManager.get('background-color')
if (config.terminal.colorScheme.colors) {
preferenceManager.set(
'color-palette-overrides',
@@ -134,13 +137,16 @@ export class HTermFrontend extends Frontend {
}
visualBell (): void {
const color = preferenceManager.get('background-color')
preferenceManager.set('background-color', 'rgba(128,128,128,.25)')
setTimeout(() => {
preferenceManager.set('background-color', color)
preferenceManager.set('background-color', this.configuredBackgroundColor)
}, 125)
}
scrollToBottom (): void {
this.term.scrollEnd()
}
private setFontSize () {
preferenceManager.set('font-size', this.configuredFontSize * Math.pow(1.1, this.zoom))
}

View File

@@ -77,6 +77,10 @@ export class XTermFrontend extends Frontend {
(this.xterm as any).bell()
}
scrollToBottom (): void {
this.xterm.scrollToBottom()
}
configure (config: any): void {
this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`)
this.xterm.setOption('bellStyle', config.terminal.bell)

View File

@@ -1,9 +1,12 @@
import * as fs from 'mz/fs'
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
import TerminusCorePlugin from 'terminus-core'
import { HostAppService } from 'terminus-core'
import { ToolbarButtonProvider, TabRecoveryProvider, ConfigProvider, HotkeysService, HotkeyProvider, AppService, ConfigService } from 'terminus-core'
import { SettingsTabProvider } from 'terminus-settings'
@@ -35,6 +38,8 @@ import { GitBashShellProvider } from './shells/gitBash'
import { LinuxDefaultShellProvider } from './shells/linuxDefault'
import { MacOSDefaultShellProvider } from './shells/macDefault'
import { POSIXShellsProvider } from './shells/posix'
import { PowerShellCoreShellProvider } from './shells/powershellCore'
import { WindowsDefaultShellProvider } from './shells/winDefault'
import { WindowsStockShellsProvider } from './shells/windowsStock'
import { WSLShellProvider } from './shells/wsl'
@@ -64,16 +69,23 @@ import { hterm } from './hterm'
{ provide: SessionPersistenceProvider, useClass: ScreenPersistenceProvider, multi: true },
{ provide: SessionPersistenceProvider, useClass: TMuxPersistenceProvider, multi: true },
{ provide: ShellProvider, useClass: CmderShellProvider, multi: true },
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
{ provide: ShellProvider, useClass: WindowsDefaultShellProvider, multi: true },
{ provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true },
{ provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true },
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
{ provide: ShellProvider, useClass: CmderShellProvider, multi: true },
{ provide: ShellProvider, useClass: CustomShellProvider, multi: true },
{ provide: ShellProvider, useClass: Cygwin32ShellProvider, multi: true },
{ provide: ShellProvider, useClass: Cygwin64ShellProvider, multi: true },
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
{ provide: ShellProvider, useClass: POSIXShellsProvider, multi: true },
{ provide: ShellProvider, useClass: PowerShellCoreShellProvider, multi: true },
{ provide: ShellProvider, useClass: WSLShellProvider, multi: true },
// For WindowsDefaultShellProvider
PowerShellCoreShellProvider,
WSLShellProvider,
WindowsStockShellsProvider
],
entryComponents: [
TerminalTabComponent,
@@ -91,6 +103,7 @@ export default class TerminalModule {
config: ConfigService,
hotkeys: HotkeysService,
terminal: TerminalService,
hostApp: HostAppService,
) {
let events = [
{
@@ -121,6 +134,36 @@ export default class TerminalModule {
terminal.openTab()
})
}
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
if (hotkey === 'new-tab') {
terminal.openTab()
}
})
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
if (hotkey === 'new-window') {
hostApp.newWindow()
}
})
hostApp.cliOpenDirectory$.subscribe(async directory => {
if (await fs.exists(directory)) {
if ((await fs.stat(directory)).isDirectory()) {
terminal.openTab(null, directory)
}
}
})
hostApp.cliRunCommand$.subscribe(async command => {
terminal.openTab({
id: '',
command: command[0],
args: command.slice(1),
}, null, true)
})
hostApp.cliPaste$.subscribe(text => {
if (app.activeTab instanceof TerminalTabComponent && app.activeTab.session) {
(app.activeTab as TerminalTabComponent).sendInput(text)
}
})
}
}

View File

@@ -38,9 +38,9 @@ export class TerminalService {
if (!cwd) {
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
cwd = await this.app.activeTab.session.getWorkingDirectory()
} else {
cwd = this.config.store.terminal.workingDirectory || null
}
cwd = cwd || this.config.store.terminal.workingDirectory
cwd = cwd || null
}
if (!shell) {
let shells = await this.shells$.toPromise()

View File

@@ -4,7 +4,6 @@ import { HostAppService, Platform } from 'terminus-core'
import { ShellProvider, IShell } from '../api'
@Injectable()
export class CmderShellProvider extends ShellProvider {
constructor (

Some files were not shown because too many files have changed in this diff Show More