New version base

This commit is contained in:
GitSquared 2017-09-29 18:28:50 +02:00
parent 8704ef4510
commit f4c117fd04
No known key found for this signature in database
GPG Key ID: CD90D37C8F2993E8
28 changed files with 82 additions and 3775 deletions

42
_boot.js Normal file
View File

@ -0,0 +1,42 @@
const {app, BrowserWindow} = require("electron");
const electron = require("electron");
const path = require("path");
const url = require("url");
let win;
app.on('ready', () => {
let {x, y, width, height} = electron.screen.getPrimaryDisplay().bounds;
width++; height++;
win = new BrowserWindow({
title: "eDEX-UI",
x,
y,
width,
height,
show: false,
resizable: true,
movable: false,
alwaysOnTop: true,
fullscreen: true,
// focusable: false,
skipTaskbar: true,
autoHideMenuBar: true,
frame: true
});
win.loadURL(url.format({
pathname: path.join(__dirname, 'ui.html'),
protocol: 'file:',
slashes: true
}));
win.once("ready-to-show", () => {
win.show();
win.setResizable(false);
});
});
app.on('window-all-closed', () => {
app.quit();
});

27
assets/css/fonts.css Normal file
View File

@ -0,0 +1,27 @@
@font-face {
font-family: "Fira Mono";
src: url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.eot"); /* IE9*/
src: url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.woff2") format("woff2"), /* chrome、firefox */
url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.woff") format("woff"), /* chrome、firefox */
url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url("../fonts/2b8448d01a50ec1ac97d96c883b8a9b8.svg#Fira Mono") format("svg"); /* iOS 4.1- */
}
@font-face {
font-family: "United Sans Medium";
src: url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.eot"); /* IE9*/
src: url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.woff2") format("woff2"), /* chrome、firefox */
url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.woff") format("woff"), /* chrome、firefox */
url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url("../fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.svg#United Sans Reg Medium") format("svg"); /* iOS 4.1- */
}
body {
font-family: "United Sans Medium", sans-serif;
}
pre {
font-family: "Fira Mono", sans-serif;
}

View File

@ -1,11 +1,10 @@
html, body {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
padding: 0px;
overflow: hidden;
}
body {
/*cursor: none !important;*/
color: #bec4c1;
@ -15,13 +14,5 @@ body {
justify-content: center;
flex-wrap: wrap;
padding-top: 3%;
background: url("images/background.png") repeat left top;
}
section {
border: 2px solid #a0a5a3;
background-color: rgba(5, 5, 5, 0.5);
padding: 15px;
overflow: hidden;
opacity: 0.6;
background: url("../png/bg.png") repeat top left;
}

View File

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

BIN
assets/png/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

1181
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"name": "edex-ui",
"version": "0.0.1",
"description": "A science fiction desktop running everywhere. Awesome.",
"main": "startup.js",
"main": "_boot.js",
"scripts": {
"start": "./node_modules/.bin/electron ."
},
@ -16,11 +16,6 @@
"url": "https://github.com/GitSquared/edex-ui/issues"
},
"homepage": "https://github.com/GitSquared/edex-ui#readme",
"dependencies": {
"electron": "^1.4.15",
"jquery": "^3.1.1"
},
"devDependencies": {
"devtron": "^1.4.0"
}
"dependencies": {},
"devDependencies": {}
}

View File

@ -1,27 +0,0 @@
@font-face {
font-family: "Fira Mono";
src: url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.eot"); /* IE9*/
src: url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.woff2") format("woff2"), /* chrome、firefox */
url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.woff") format("woff"), /* chrome、firefox */
url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url("fonts/2b8448d01a50ec1ac97d96c883b8a9b8.svg#Fira Mono") format("svg"); /* iOS 4.1- */
}
@font-face {
font-family: "United Sans Medium";
src: url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.eot"); /* IE9*/
src: url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.woff2") format("woff2"), /* chrome、firefox */
url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.woff") format("woff"), /* chrome、firefox */
url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url("fonts/001fbf0f03dcd8de5cf2fa710d1c66fa.svg#United Sans Reg Medium") format("svg"); /* iOS 4.1- */
}
body {
font-family: "United Sans Medium", sans-serif;
}
pre {
font-family: "Fira Mono", sans-serif;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

View File

@ -1,7 +0,0 @@
{
"keyboard_numbers": ["ESC", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "BACK"],
"keyboard_qwerty": ["TAB", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "|"],
"keyboard_asdfgh": ["CAPS", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "ENTER"],
"keyboard_zxcvbn": ["SHIFT", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "SHIFT"],
"keyboard_spacebar": [" "]
}

View File

@ -1 +0,0 @@
qwerty

View File

@ -1,70 +0,0 @@
section#keyboard {
width: 100%;
align-self: flex-start;
border: none;
}
section#keyboard table, section#keyboard tbody {
width: 100%;
}
section#keyboard tr {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: nowrap;
flex-direction: row;
position: relative;
}
section#keyboard td {
font-size: 23px;
border: none;
border-radius: 3px;
margin: 6px;
padding: 2px;
margin-left: 8px;
margin-right: 8px;
height: 38px;
width: 33px;
display: flex;
align-items: center;
justify-content: center;
transition: background-color .3s ease-out;
}
section#keyboard td:active, section#keyboard td.active {
background-color: #bec4c1;
transition: none;
}
section#keyboard td.long_active {
background-color: #bec4c1;
transition: none;
color: black;
}
section#keyboard td.function_key {
width: auto;
font-size: 17px;
padding-left: 10px;
padding-right: 10px;
}
#keyboard_numbers {
right: 10px;
}
#keyboard_qwerty {
right: 5px;
}
#keyboard_asdfgh {
left: 25px;
}
#keyboard_spacebar td {
width: 20% !important;
height: 19px !important;
border: 1px solid #a0a5a3 !important;
}

View File

@ -1,152 +0,0 @@
const $ = require('jquery')
const fs = require('fs')
const path = require('path')
const function_keys = ["SHIFT", "ENTER", "CAPS", "TAB", "ESC", "BACK"];
window.keyboard_caps = false;
var selected_keyboard = path.join(__dirname, '../keyboards/selected_keyboard.txt');
fs.readFile(selected_keyboard, {encoding: 'utf-8'}, function(err, data) {
if (!err) {
var data = data.replace(/\n/g, "");
console.log('Selected keymap: ' + data);
var selected_keyboard = path.join(__dirname, '../keyboards/'+data+'.json');
loadKeyboard(selected_keyboard);
} else {
console.log("ERROR: "+err);
}
});
function loadKeyboard(file) {
console.log('Loading keyboard file: '+file);
fs.readFile(file, {encoding: 'utf-8'}, function(err, data) {
if (!err) {
var keyboard = JSON.parse(data);
keyboard.keyboard_numbers.forEach((value, index) => {
if (contains.call(function_keys, value)) {
$( "#keyboard_numbers" ).append('<td class="function_key" onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
} else {
$( "#keyboard_numbers" ).append('<td onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
}
});
keyboard.keyboard_qwerty.forEach((value, index) => {
if (contains.call(function_keys, value)) {
$( "#keyboard_qwerty" ).append('<td class="function_key" onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
} else {
$( "#keyboard_qwerty" ).append('<td onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
}
});
keyboard.keyboard_asdfgh.forEach((value, index) => {
if (contains.call(function_keys, value)) {
$( "#keyboard_asdfgh" ).append('<td class="function_key" onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
} else {
$( "#keyboard_asdfgh" ).append('<td onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
}
});
keyboard.keyboard_zxcvbn.forEach((value, index) => {
if (contains.call(function_keys, value)) {
$( "#keyboard_zxcvbn" ).append('<td class="function_key" onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
} else {
$( "#keyboard_zxcvbn" ).append('<td onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
}
});
keyboard.keyboard_spacebar.forEach((value, index) => {
if (contains.call(function_keys, value)) {
$( "#keyboard_spacebar" ).append('<td class="function_key" onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
} else {
$( "#keyboard_spacebar" ).append('<td onmousedown="window.pressKey(\''+value+'\', false);">'+value+'</td>');
}
});
} else {
console.log("ERROR: "+err);
}
});
}
window.pressKey = function(key, animate) {
if (animate == false) {
if (contains.call(function_keys, key)) {
switch (key) {
case "ESC":
$( "#shell_input" ).val("exit");
window.exeCommand();
break;
case "BACK":
var tmp = $( "#shell_input" ).val();
tmp = tmp.slice(0, -1);
$( "#shell_input" ).val(tmp);
break;
case "ENTER":
window.exeCommand();
break;
case "TAB":
var tmp = $( "#shell_input" ).val()+" ";
$( "#shell_input" ).val(tmp);
break;
case "CAPS":
if (window.keyboard_caps == true) {
window.keyboard_caps = false;
$( "#keyboard td.function_key:contains('CAPS')" ).removeClass('long_active');
} else {
window.keyboard_caps = true;
$( "#keyboard td.function_key:contains('CAPS')" ).addClass('long_active');
}
break;
case "SHIFT":
window.keyboard_caps = true;
$( "#keyboard td.function_key:contains('SHIFT')" ).addClass('long_active');
$( "#keyboard td.function_key:contains('SHIFT')" ).mouseup(() => {
window.keyboard_caps = false;
$( "#keyboard td.function_key:contains('SHIFT')" ).removeClass('long_active');
});
break;
}
} else {
if (window.keyboard_caps == false) {
var key = key.toLowerCase();
}
var key = $( "#shell_input" ).val()+key;
$( "#shell_input" ).val(key);
}
} else {
if (contains.call(function_keys, key)) {
var key = $( "#keyboard td.function_key:contains('"+key+"')" );
key.addClass('active');
setTimeout(function(){key.removeClass('active');},100);
} else {
var key = $( "#keyboard td:contains('"+key+"'):not(.function_key)" );
key.addClass('active');
setTimeout(function(){key.removeClass('active');},100);
}
}
}
// Register keyboard shortcuts
$(document).keydown(function (e) {
switch(e.key) {
case "Backspace":
var key = "BACK";
break;
case "Tab":
var key = "TAB";
break;
case "Shift":
var key = "SHIFT";
break;
case "Escape":
var key = "ESC";
break;
case "Enter":
var key = "ENTER";
break;
case "CapsLock":
var key = "CAPS";
break;
default:
var key = e.key;
}
var key = key.toUpperCase();
window.pressKey(key, true);
});
var contains=function(needle){var findNaN=needle!==needle;var indexOf;if(!findNaN&&typeof Array.prototype.indexOf==='function'){indexOf=Array.prototype.indexOf}else{indexOf=function(needle){var i=-1,index=-1;for(i=0;i<this.length;i+=1){var item=this[i];if((findNaN&&item!==item)||item===needle){index=i;break}}return index}}return indexOf.call(this,needle)>-1};

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +0,0 @@
const pty = require('node-pty');
const $ = require('jquery');
const app = require('electron').remote.app;
const Terminal = require('./../../node_modules/xterm/dist/xterm.js');
const TerminalFit = require('./../../node_modules/xterm/dist/addons/fit/fit.js');
const shell = process.platform === 'win32' ? 'cmd.exe' : 'bash';
const lineEnd = process.platform === 'win32' ? '\r\n' : '\n';
initShell = () => {
window.shellDisplay = new Terminal({
cursorBlink: true,
scrollback: 1500,
tabStopWidth: 4
});
window.shellDisplay.open(document.getElementById('xterm-container'));
window.shellProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});
app.on('before-quit', () => {
window.shellProcess.kill();
});
setTimeout(() => {
var tmp = TerminalFit.proposeGeometry(window.shellDisplay);
console.log('Proposed '+tmp.cols+' cols and '+tmp.rows+' rows,');
tmp.cols = tmp.cols + 2;
tmp.rows = tmp.rows - 2;
console.log('applied '+tmp.cols+' cols and '+tmp.rows+' rows.');
window.shellDisplay.resize(tmp.cols, tmp.rows);
window.shellProcess.resize(tmp.cols, tmp.rows);
}, 500);
window.shellProcess.on('data', (data) => {
window.shellDisplay.write(data);
});
window.exeCommand = () => {
window.shellProcess.write(window.command+lineEnd);
return false;
}
}
$(() => {
initShell();
});
$(document).click(() => {
// Get keyboard focus back on the shell after a click.
$( ".xterm-helper-textarea" ).focus();
});
$(document).keydown((e) => {
// Get keyboard focus back on the shell after a tab.
if (e.key == "Tab") {
$( ".xterm-helper-textarea" ).focus();
}
});

View File

@ -1,2 +0,0 @@
require('./resources/sections/main_shell.js')
require('./resources/sections/keyboard.js')

View File

@ -1,46 +0,0 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
console.log('Starting eDEX-UI with Node '+process.versions.node+', Chrome '+process.versions.chrome+' and Electron '+process.versions.electron)
console.log('Detected platform: '+process.platform)
app.on('ready', startup)
app.on('before-quit', function() {console.log('Terminating eDEX-UI...');global.shell.kill();})
app.on('will-quit', function() {
console.log("Process terminated, exit code 0")
})
app.on('window-all-closed', () => {
app.quit()
})
function launchMainWindow() {
global.win = new BrowserWindow({title: "eDEX-UI", show: false, autoHideMenuBar: true, backgroundColor: '#000000', fullscreen: true})
global.win.loadURL(url.format({
pathname: path.join(__dirname, 'ui.html'),
protocol: 'file:',
slashes: true
}))
global.win.once('ready-to-show', () => {
global.win.show();
global.win.center();
global.win.maximize();
})
global.win.on('closed', () => {
global.win = null;
})
console.log('UI launched')
}
function launchShellDaemon() {
global.shell = require('child_process').fork('./tty.js', [], {silent: true});
}
function startup () {
launchMainWindow();
}

15
tty.js
View File

@ -1,15 +0,0 @@
var tty = require('tty.js');
var tty = tty.createServer({
shell: (process.platform == 'win32') ? 'cmd.exe' : 'bash',
users: {
foo: 'bar'
},
port: 8000
});
tty.get('/foo', function(req, res, next) {
res.send('bar');
});
tty.listen();

26
ui.html
View File

@ -4,27 +4,15 @@
<meta charset="utf-8" />
<title>eDEX-UI</title>
<link rel="stylesheet" href="resources/ui.css" />
<link rel="stylesheet" href="resources/fonts.css" />
<link rel="stylesheet" href="resources/sections/main_shell.css" />
<link rel="stylesheet" href="resources/sections/keyboard.css" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" href="assets/css/fonts.css" />
<script src="resources/ui.js"></script>
<!-- <script src="resources/ui.js"></script> -->
</head>
<body>
<section id="main_shell">
<pre id="xterm-container"></pre>
</section>
<section id="keyboard">
<table>
<tbody>
<tr id="keyboard_numbers"></tr>
<tr id="keyboard_qwerty"></tr>
<tr id="keyboard_asdfgh"></tr>
<tr id="keyboard_zxcvbn"></tr>
<tr id="keyboard_spacebar"></tr>
</tbody>
</table>
</section>
<h1>Some text</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</body>
</html>