Commit 7a16552b authored by ransome1's avatar ransome1
Browse files

Fixed priority keyboard shortcuts, enhanced theme support

parent c5f23de7
{
"name": "sleek",
"productName": "sleek",
"version": "1.1.8-rc.4",
"version": "1.1.8-rc.5",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"category": "ProjectManagement",
......
This diff is collapsed.
This diff is collapsed.
......@@ -591,45 +591,45 @@
<td><span class="tag is-info is-large">.</span></td>
<td><span class="tag is-info is-large">.</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR19TD1"></td>
<td><span class="tag is-info is-large">P</span></td>
<td><span class="tag is-info is-large">P</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR20TD1"></td>
<td><span class="tag is-info is-large">1-9</span></td>
<td><span class="tag is-info is-large">1-9</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR19TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">P</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">P</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR5TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">O</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">O</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">O</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">O</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR11TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">C</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">C</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">C</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">C</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR21TD1"></td>
<td><span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">?</span></td>
<td><span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">?</span></td>
<td><span class="tag is-dark is-large">Shift</span>&nbsp;<span class="tag is-info is-large">?</span></td>
<td><span class="tag is-dark is-large">Shift</span>&nbsp;<span class="tag is-info is-large">?</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR22TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">Tab</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR23TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-dark is-large">Shift</span>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-dark is-large">Shift</span>&nbsp;<span class="tag is-info is-large">Tab</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR24TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">W</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">W</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">W</span></td>
<td><span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">W</span></td>
</tr>
......@@ -658,33 +658,33 @@
</tr>
<tr>
<td id="helpTabKeyboardTR7TD1"></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">A-Z</span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">A-Z</span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">Windows</span>&nbsp;<span class="tag is-info is-large">A-Z</span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large">A-Z</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR13TD1"></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">Windows</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR14TD1"></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
<td></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">Windows</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
<td><span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-dark is-large">command</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
</tr>
<tr>
<td id ="helpTabKeyboardTR15TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
<td><span class="tag is-dark is-large">cmd</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
</tr>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-up"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-down"></i></span></td>
</tr>
<tr>
<td id ="helpTabKeyboardTR16TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
<td><span class="tag is-dark is-large">cmd</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-dark is-large">Alt</span>&nbsp;<span class="tag is-info is-large"><i class="fas fa-arrow-left"></i>&nbsp;/&nbsp;<i class="fas fa-arrow-right"></i></span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR10TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Enter</span></td>
<td><span class="tag is-dark is-large">cmd</span>&nbsp;<i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Enter</span></td>
<td><span class="tag is-dark is-large">Ctrl</span>&nbsp;<span class="tag is-info is-large">Enter</span></td>
<td><span class="tag is-dark is-large">Command</span>&nbsp;<span class="tag is-info is-large">Enter</span></td>
</tr>
</table>
</section>
......
......@@ -276,6 +276,10 @@ function setFriendlyLanguageNames() {
export function showModal(modalId) {
try {
// TODO: make this more generic
// set the theme selection field
document.getElementById("theme").value = userData.theme;
// in case a content window was open, it will be closed
modalWindows.forEach(function(modalWindow) { modalWindow.classList.remove("is-active") });
......
......@@ -490,13 +490,7 @@ async function show(todo, templated) {
}
// if there is a recurrence
if(todo.rec) {
setInput(todo.rec).then(function(result) {
console.log(result);
}).catch(function(error) {
handleError(error);
});
}
if(todo.rec) setInput(todo.rec)
// if so we paste it into the input field
if(todo.dueString) datePickerInput.value = todo.dueString;
}
......
......@@ -30,6 +30,7 @@ const renderer = {
};
marked.use({ renderer });
// TODO: check if this still works
export function jumpToItem(item) {
try {
const isInViewport = function(item) {
......
......@@ -6,9 +6,6 @@ import { showDrawer } from "./drawer.mjs";
import { resetFilters } from "./filters.mjs";
import { triggerToggle } from "./toggles.mjs";
//const helper = await import("./helper.mjs");
//const render = await import("../render.js");
// receives todo.txt data from main process as string and passes it to build function
window.api.receive("buildTable", (args) => {
buildTable(...args).then(function(response) {
......
......@@ -149,7 +149,7 @@ export async function registerShortcuts() {
if(isModalOpen()) {
// // set priority directly
// if(event.altKey && event.metaKey && event.key.length === 1 && event.key.match(/[A-Z]/i)) {
// if(event.altKey && event.key.length === 1 && event.key.match(/[A-Z]/i)) {
// setPriority(event.key.substr(0,1)).then(response => {
// console.log(response);
......@@ -474,7 +474,7 @@ export async function registerShortcuts() {
// priority up
if(event.ctrlKey && event.metaKey && event.key === "ArrowUp") {
if(event.altKey && event.metaKey && event.key === "ArrowUp") {
setPriority(-1).then(function(result) {
console.log(result);
}).catch(function(error) {
......@@ -485,7 +485,7 @@ export async function registerShortcuts() {
// priority down
if(event.ctrlKey && event.metaKey && event.key === "ArrowDown") {
if(event.altKey && event.metaKey && event.key === "ArrowDown") {
setPriority(1).then(function(result) {
console.log(result);
}).catch(function(error) {
......@@ -496,9 +496,11 @@ export async function registerShortcuts() {
// set priority directly
if(event.ctrlKey && event.metaKey && event.key.length === 1 && event.key.match(/[A-Z]/i)) {
if(event.altKey && event.metaKey && event.key.length === 1) {
setPriority(event.key.toUpperCase()).then(response => {
if(!event.code.includes("Key")) return false
setPriority(event.code.substr(3).toUpperCase()).then(response => {
console.log(response);
}).catch(error => {
handleError(error);
......@@ -510,7 +512,7 @@ export async function registerShortcuts() {
// remove priority
if(event.ctrlKey && event.metaKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
if(event.altKey && event.metaKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
setPriority(false).then(response => {
console.log(response);
......
......@@ -708,6 +708,8 @@ function sortTodosInGroup(group) {
async function setTodoComplete(todo) {
try {
if(typeof todo === "string") todo = await generateTodoTxtObject(todo)
// get index of todo
const index = await items.objects.map(function(item) {return item.toString(); }).indexOf(todo.toString());
......
......@@ -422,10 +422,9 @@ function showNotification(config) {
}
function configureWindowEvents() {
try {
nativeTheme.on("updated", () => {
userData.set("theme", nativeTheme.themeSource);
(nativeTheme.shouldUseDarkColors) ? mainWindow.webContents.executeJavaScript(`body.classList.add("dark"); document.getElementById("theme").value="${nativeTheme.themeSource}"`) : mainWindow.webContents.executeJavaScript(`body.classList.remove("dark"); document.getElementById("theme").value="${nativeTheme.themeSource}"`)
})
// nativeTheme.on("updated", () => {
// (nativeTheme.shouldUseDarkColors) ? mainWindow.webContents.executeJavaScript(`body.classList.add("dark");`) : mainWindow.webContents.executeJavaScript(`body.classList.remove("dark");`)
// })
mainWindow
.on("resize", function() {
......@@ -448,9 +447,15 @@ function configureWindowEvents() {
event.preventDefault();
(userData.data.maximizeWindow) ? mainWindow.maximize() : mainWindow.unmaximize()
})
.webContents.on("new-window", function(event, url) {
.webContents
.on("new-window", function(event, url) {
event.preventDefault();
require("electron").shell.openExternal(url);
})
.on("did-finish-load", function() {
nativeTheme.themeSource = userData.data.theme;
//(nativeTheme.shouldUseDarkColors) ? mainWindow.webContents.executeJavaScript(`body.classList.add("dark");`) : mainWindow.webContents.executeJavaScript(`body.classList.remove("dark");`)
});
ipcMain.handle("userData", (event, args) => {
......@@ -474,6 +479,7 @@ function configureWindowEvents() {
.on("setTheme", (event, theme) => {
if(!theme) theme = (nativeTheme.shouldUseDarkColors) ? "light" : "dark"
nativeTheme.themeSource = theme;
userData.set("theme", nativeTheme.themeSource);
})
.on("closeWindow", () => {
mainWindow.close()
......@@ -647,9 +653,6 @@ async function createWindow() {
});
mainWindow.loadFile(path.join(appData.path, "index.html"));
// apply theme setting
nativeTheme.themeSource = userData.data.theme;
// load the translations
translations = await i18next.getDataByLanguage(userData.data.language).translation
if(!translations) throw("Error: Translations could not be loaded")
......@@ -835,7 +838,7 @@ async function createWindow() {
}
]
}
const menuTemplate = (getActiveFile()) ? [menuTemplateApp, menuTemplateFile, menuTemplateEdit, menuTemplateTodos, menuTemplateView, menuTemplateAbout] : [menuTemplateApp, menuTemplateFile]
const menuTemplate = (getActiveFile()) ? [menuTemplateApp, menuTemplateFile, menuTemplateEdit, menuTemplateTodos, menuTemplateView, menuTemplateAbout] : [menuTemplateApp, menuTemplateFile, menuTemplateEdit]
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate))
// hide quit menu item on all platforms but macos
if(appData.os !== "mac") Menu.getApplicationMenu().getMenuItemById("quit").visible = false;
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment