-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
42 lines (38 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { Terminal } = require('xterm');
const ipc = require('electron').ipcRenderer;
const { FitAddon } = require('xterm-addon-fit');
const customTitlebar = require('custom-electron-titlebar');
const { Themebar } = require('custom-electron-titlebar');
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex('#000'),
drag: true,
minimizable: true,
maximizable: true,
closeable: true,
menu: false,
iconsTheme: Themebar.mac,
overflow: 'hidden',
unfocusEffect: true,
icon: './icons/terminex-dark-circle-outline.png',
});
var term = new Terminal({
cursorBlink: true,
cursorStyle: 'block',
fastScrollModifier: 'ctrl',
logLevel: 'info',
rightClickSelectsWord: true,
screenReaderMode: true,
scrollback: 6,
bellSound: './images/bell.mp3',
});
var fit = new FitAddon();
term.loadAddon(fit);
fit.activate;
term.open(document.getElementById('terminal'));
fit.fit();
term.onData((e) => {
ipc.send('terminal.toTerm', e);
});
ipc.on('terminal.incData', function (event, data) {
term.write(data);
});