Skip to content

Commit

Permalink
reduced app size
Browse files Browse the repository at this point in the history
  • Loading branch information
leth4 committed Jun 30, 2023
1 parent a42aec1 commit 4145da7
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 43 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Visually inspired by [Left](https://github.com/hundredrabbits/Left), functionall

## Usage

Create a file directory to store your notes. Open the app, press `Ctrl + O` and select the directory. You can browse, open, create, delete and move files and folders via the sidebar. Deleted files and folders are kept in a `.trash` folder in the working directory. All your changes are auto-saved.
Create a file directory to store your notes. Open the app, press `Ctrl + O` and select the directory. You can browse, open, create, pin, rename, delete and move files and folders via the sidebar. Deleted files and folders are kept in a `.trash` folder in the working directory. All your changes are auto-saved.

Markdown `# headers`, `*italics*` and `` `inline code` `` are highlighted. There's also syntax highlighting for code blocks wrapped between `` ``` `` symbols — you can specify the language in the first line, like `` ```csharp ``. Languages that support highlighting are *C#*, *C++*, *C*, *JavaScript*, *Python*, *Rust*, *Java* and *HLSL*.

The default font is [Inter](https://fonts.google.com/specimen/Inter), but you can input any font via the Preferences menu (opened with `Ctrl+P`). Note that you need the font installed locally.
The default font is [Inter](https://github.com/rsms/inter), but you can input any font via the Preferences menu (opened with `Ctrl+P`). Note that you need the font installed locally.

## Shortcuts

Shortcut | Action
:-|:-
`Ctrl + O` | Open a new directory
`Ctrl + Shift + S` | Save active file as new (leto will stay in current directory)
`Ctrl + Shift + S` | Save active file as new
`Ctrl + Q` | Exit leto
`Ctrl + M` | Minimize leto
`Ctrl + P` | Show/hide preferences
Expand All @@ -29,11 +29,11 @@ Shortcut | Action
`Ctrl + ] / [` | Change font weight
`Ctrl + N` | Create a new file
`Ctrl + Shift + N` | Create a new folder
`Ctrl + Number` |Open pinned file
`Ctrl + Number` | Open pinned file
`Ctrl + Tab` | Switch to the previous file
`Ctrl + ↑ / ↓` | Jump between headers
`Alt + ↑ / ↓` | Move the current line
`Alt + Shift + ↑ / ↓` | Duplicate the current line
`Alt + ↑ / ↓` | Move selected lines
`Alt + Shift + ↑ / ↓` | Duplicate selected lines
`Ctrl + Enter` | Create or check/uncheck a to-do task
`Ctrl + L` | Select the current line
`Ctrl + X` | Cut the current line
Expand Down
9 changes: 8 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2.4", features = ["clipboard-read-text", "dialog-confirm", "dialog-message", "dialog-open", "dialog-save", "fs-copy-file", "fs-create-dir", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-dir", "fs-remove-file", "fs-write-file", "path-all", "shell-open", "window-all"] }
tauri = { version = "1.2.4", features = ["clipboard-read-text", "dialog-message", "dialog-open", "dialog-save", "fs-create-dir", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-dir", "fs-remove-file", "fs-write-file", "objc-exception", "path-all", "window-all", "wry"], default-features = false }
window-shadows = "0.2.1"

[features]
Expand All @@ -27,3 +27,10 @@ default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

[profile.release]
panic = "abort" # Strip expensive panic clean-up logic
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
lto = true # Enables link to optimizations
opt-level = "s" # Optimize for binary size
strip = true # Remove debug symbols
20 changes: 4 additions & 16 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@
"dialog" : {
"open" : true,
"save" : true,
"message": true,
"confirm" : true
"message": true
},
"path": {
"all" : true
},
"fs": {
"exists": true,
"writeFile": true,
"readFile": true,
"readDir": true,
"writeFile": true,
"removeFile": true,
"copyFile" : true,
"createDir" : true,
"removeDir": true,
"scope":["**"]
},
"shell": {
"open": ".*"
}
},
"bundle": {
Expand All @@ -58,16 +53,9 @@
"icons/icon.ico"
],
"identifier": "leto",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"longDescription": "Minimalistic text editor",
"resources": [],
"shortDescription": "",
"shortDescription": "Minimalistic text editor",
"targets": "all",
"windows": {
"certificateThumbprint": null,
Expand Down
3 changes: 2 additions & 1 deletion web/src/directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { invoke } = window.__TAURI__.tauri;
const editor = document.getElementById('text-editor');
const DIRECTORY_ENTRIES_LIMIT = 2000;
const TOO_BIG_MESSAGE = `Selected directory is too big. You can only have ${DIRECTORY_ENTRIES_LIMIT} files and subfolders in the directory.`;
const NO_DIRECTORY_MESSAGE = `Press <Ctrl+O> to open a directory.`
const NO_DIRECTORY_MESSAGE = "Press `Ctrl+O` to open a directory.";

export default class Directory {

Expand Down Expand Up @@ -135,6 +135,7 @@ export default class Directory {

#removeActiveDirectory() {
leto.explorer.clearFileTree();
leto.explorer.setPins(null);
this.activeDirectory = null;
this.#removeActiveFile();
}
Expand Down
6 changes: 6 additions & 0 deletions web/src/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class Preview {
else if (languageName == 'cs' || languageName == 'csharp') language = csharp;
else if (languageName == 'js' || languageName == 'javascript') language = javascript;
else if (languageName == 'python' || languageName == 'py') language = python;
else if (languageName == 'go' || languageName == 'golang') language = golang;
else if (languageName == 'rust') language = rust;
else if (languageName == 'cpp') language = cpp;
else if (languageName == 'c') language = c;
Expand Down Expand Up @@ -91,6 +92,11 @@ const java = new Language(
/(\/\/.*)|(\/\*[\s\S]*?\*\/)/g
);

const golang = new Language(
/(?<=[\s|\n|^|.|\(|-])(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)(?=[$|\s|\n|\.|;|\(])/g,
/(\/\/.*)|(\/\*[\s\S]*?\*\/)/g
);

const cpp = new Language(
/(?<=[\s|\n|^|.|\(|-])(asm|auto|bool|break|case|catch|char|class|const|const_cast|continue|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|xor|xor_eq)(?=[$|\s|\n|\.|;|\(])/g,
/(\/\/.*)|(\/\*[\s\S]*?\*\/)/g
Expand Down
1 change: 0 additions & 1 deletion web/src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const fontInput = document.getElementById('font-input');
const themes = [
'gleam',
'aske',
'frost',
'zima',
'spirit',
'perlin',
Expand Down
2 changes: 1 addition & 1 deletion web/themes/dart.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
--sidebar-file-color: #c6bd9f;
--sidebar-selection-color: #3b2f2f;

--divider-color: #c6bd9f;
--divider-color: #918076;
--shadow: 0px;
}
16 changes: 0 additions & 16 deletions web/themes/frost.css

This file was deleted.

2 changes: 1 addition & 1 deletion web/themes/perlin.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:root {
--editor-background-color: #2b2b2b;
--editor-code-background-color: #1a1a1a;
--editor-code-background-color: #232323;
--editor-text-color: #bab6b6;
--editor-header-color: #9a94cb;
--editor-hashtag-color: #747171;
Expand Down

0 comments on commit 4145da7

Please sign in to comment.