Commit to not lose files

master
Guus van Meerveld 3 years ago
parent e63af2581c
commit 9e7d40d707

@ -6,6 +6,10 @@ const {
autoUpdater,
} = require("electron");
const path = app.getAppPath();
const info = require(path + "/json/app.json");
const electronLocalshortcut = require("electron-localshortcut");
const Store = require("electron-store");
const store = new Store();
@ -100,7 +104,7 @@ app.on("ready", () => {
}
let autoLaunch = new AutoLaunch({
name: "Keyzo",
name: info.name,
path: app.getPath("exe"),
});

@ -0,0 +1,4 @@
{
"name": "Keyzo",
"version": "0.1"
}

@ -1,20 +1,42 @@
{
"Applications": {
[
{
"title": "applications",
"description": "Open/Close/Modify your applications",
"open app": {
"description": "Open an application"
},
"close app": {
"description": "Close an application"
}
"children": [
{
"title": "open app",
"description": "Open an application",
"children": [
{
"title": "test"
},
{
"title": "lksfjslkd"
}
]
}
]
},
"System": {
{
"title": "system",
"description": "Open/Close/Modify your applications",
"children": [
{
"title": "yeetapp",
"children": [
{
"title": "lksfjslkd"
}
]
}
]
},
{
"title": "system functions",
"description": "Interact with your system"
},
"Keys": {
{
"title": "keys",
"description": "Output keyboard inputs"
},
"System Functions": {
"description": "Some predefined functions"
}
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -1,159 +0,0 @@
const app = require("electron").remote.app;
const path = app.getAppPath();
const q = document.querySelector.bind(document);
const c = document.createElement.bind(document);
const $ = require(path + "/src/javascripts/jquery.min.js");
const functions = require(path + "/json/functions.json");
// Predefine some vars
var keys = {},
showsFunctions = {},
keybind;
// Detect keybinds
$(".keybind-input").on("keyup", (e) => {
keys[e.key.toUpperCase()] = false;
setInput();
});
$(".keybind-input").on("keydown", (e) => {
e.preventDefault();
Object.keys(keys).forEach((g) => {
if (!keys[g]) delete keys[g];
});
keys[e.key.toUpperCase()] = true;
setInput();
});
function setInput() {
keybind = Object.keys(keys).join(" + ");
if (Object.values(keys).filter((k) => k).length == 0) {
$(".keybind-input").hide();
$(".customize").show();
}
$(".show-keybind").html(keybind);
$(".keybind-input").val(keybind);
}
// Configure buttons
$(".add-keybind").click(() => {
$(".dark-overlay").show().addClass("d-flex");
$(".keybind-input").show().focus();
});
$(".cancel-btn").click(resetKeyAdder);
$(".done-btn").click(resetKeyAdder);
$(".change-btn").click(() => {
$(".keybind-input").show().focus().val("");
$(".customize").hide();
});
function resetKeyAdder() {
$(".dark-overlay").hide().removeClass("d-flex");
$(".keybind-input").val("");
$(".customize").hide();
$(".done-btn").hide();
keybind = null;
}
// Load functions from json
Object.keys(functions).forEach((cat) => {
let catNoSpace = cat.replace(/ /g, "");
// Select category
let catagoryItem = createCatagoryItem(cat, catNoSpace),
catagoryFunctions = c("div"),
functionItems = createFunctionItem(functions[cat]);
q(".select-category").appendChild(catagoryItem);
catagoryFunctions.classList.add(catNoSpace);
catagoryFunctions.style.display = "none";
functionItems.forEach((item) => {
catagoryFunctions.appendChild(item);
});
q(".select-function").appendChild(catagoryFunctions);
});
function createCatagoryItem(f, noSpace) {
let title = c("div"),
trailing = c("i"),
subtitle = c("div");
title.classList.add("category-item");
title.classList.add("bold");
title.innerHTML = f.toUpperCase();
title.addEventListener("click", () => {
showsFunctions[f] = !showsFunctions[f] ?? true;
Object.keys(showsFunctions).forEach((i) => {
if (f !== i) {
showsFunctions[i] = false;
$("." + i.replace(/ /g, "")).hide();
}
});
if (showsFunctions[f]) {
$(".select-function").show();
$("." + noSpace).show();
} else {
$(".select-function").hide();
$("." + noSpace).hide();
}
});
trailing.classList.add("category-arrow");
trailing.classList.add("material-icons");
trailing.innerHTML = "arrow_forward_ios";
subtitle.classList.add("text-muted");
subtitle.innerHTML = functions[f].description;
title.appendChild(subtitle);
title.appendChild(trailing);
return title;
}
function createFunctionItem(f) {
delete f.description;
var result = [];
Object.keys(f).forEach((func) => {
result.push(createFunctionItem(func, f[func].description));
});
return result;
}
function createListItem(title, subtitle) {
let titleEl = c("div"),
trailing = c("i"),
subtitleEl = c("div");
titleEl.classList.add("category-item");
titleEl.classList.add("bold");
titleEl.innerHTML = title.toUpperCase();
trailing.classList.add("category-arrow");
trailing.classList.add("material-icons");
trailing.innerHTML = "arrow_forward_ios";
subtitleEl.classList.add("text-muted");
subtitleEl.innerHTML = subtitle;
titleEl.appendChild(trailing);
titleEl.appendChild(subtitleEl);
return titleEl;
}

@ -0,0 +1,59 @@
const path = require("electron").remote.app.getAppPath();
const $ = require(path + "/src/javascripts/jquery.min.js");
// Predefine some vars
var keys = {},
keybind;
// Detect keybinds
$(".keybind-input").on("keyup", (e) => {
keys[e.key.toUpperCase()] = false;
setInput();
});
$(".keybind-input").on("keydown", (e) => {
e.preventDefault();
Object.keys(keys).forEach((g) => {
if (!keys[g]) delete keys[g];
});
keys[e.key.toUpperCase()] = true;
setInput();
});
function setInput() {
keybind = Object.keys(keys).join(" + ");
if (Object.values(keys).filter((k) => k).length == 0) {
$(".keybind-input").hide();
$(".customize").show();
}
$(".show-keybind").html(keybind);
$(".keybind-input").val(keybind);
}
// Configure buttons
$(".add-keybind").click(() => {
$(".dark-overlay").show().addClass("d-flex");
$(".keybind-input").show().focus();
});
$(".cancel-btn").click(resetKeyAdder);
$(".done-btn").click(resetKeyAdder);
$(".change-btn").click(() => {
$(".keybind-input").show().focus().val("");
$(".customize").hide();
});
function resetKeyAdder() {
$(".dark-overlay").hide().removeClass("d-flex");
$(".keybind-input").val("");
$(".customize").hide();
$(".done-btn").hide();
keybind = null;
}

@ -0,0 +1,75 @@
const c = document.createElement.bind(document);
const q = document.querySelector.bind(document);
const functions = require(path + "/json/functions.json");
var showsFunctions = [];
// Load functions from json
function init() {
cycleList(functions, "", 0);
}
function cycleList(list, title, i) {
let div = c("div");
showsFunctions[i] = {};
list.forEach((item) => {
showsFunctions[i][item.title] = false;
div.appendChild(createListItem(i, item.title, item.description));
if (item.children) {
cycleList(item.children, item.title.replace(/ /g, ""), i + 1);
}
});
if (title) div.classList.add(title);
q(".select-function-" + i).appendChild(div);
}
function createListItem(which, t, s) {
let showsFunctionsLocal = showsFunctions[which],
title = c("div"),
trailing = c("i"),
subtitle = c("div"),
noSpace = t.replace(/ /g, "");
title.classList.add("category-item");
title.classList.add("bold");
title.innerHTML = t.toUpperCase();
trailing.classList.add("category-arrow");
trailing.classList.add("material-icons");
trailing.innerHTML = "arrow_forward_ios";
title.addEventListener("click", () => {
showsFunctionsLocal[t] = !showsFunctionsLocal[t];
Object.keys(showsFunctionsLocal).forEach((i) => {
if (t !== i) {
showsFunctionsLocal[i] = false;
// console.log("Clicked: " + t, "Did not click: " + i);
$("." + i.replace(/ /g, "")).hide();
}
});
// console.log(showsFunctions, which, t);
if (showsFunctionsLocal[t]) {
$(".select-function-" + (which + 1)).show();
$("." + noSpace).show();
} else {
$(".select-function-" + (which + 1)).hide();
$("." + noSpace).hide();
}
});
subtitle.classList.add("text-muted");
subtitle.innerHTML = s;
title.appendChild(trailing);
if (s) title.appendChild(subtitle);
return title;
}
init();

@ -1,7 +1,9 @@
const Store = require("electron-store");
const store = new Store();
const $ = require("./jquery.min.js");
const path = require("electron").remote.app.getAppPath();
const $ = require(path + "/src/javascripts/jquery.min.js");
const settings = ["minimize", "startup", "startup-min"];

@ -25,15 +25,15 @@
<button class="change-btn btn btn-info ml-3">Change</button>
</div>
<div class="row h-100">
<div class="select-category right-border custom-function col-md-4">
<div class="select-function-0 right-border custom-function col-md-4">
<h4 class="bold text-muted mb-3 text-center">CATEGORIES</h4>
</div>
<div class="select-function right-border custom-function col-md-4" style="display: none;">
<div class="select-function-1 right-border custom-function col-md-4" style="display: none;">
<h4 class="bold text-muted mb-3 text-center">FUNCTIONS</h4>
</div>
<div class="select-sub-function custom-function col-md-4" style="display: none;">
<div class="select-function-2 custom-function col-md-4" style="display: none;">
<h4 class="bold text-muted mb-3 text-center">CONFIGURE</h4>
</div>
</div>
</div>
@ -45,6 +45,7 @@
</div>
</div>
<script src="../javascripts/keybinds.js"></script>
<script src="../javascripts/keybinds/detection.js"></script>
<script src="../javascripts/keybinds/menu.js"></script>
</body>
</html>