Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Notes: store notes in ~/Notes and move ~/Notas there on first run

Federico Pereira389abc94e082
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0932fe..a69f0fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -86,6 +86,8 @@ architecture and dependency policy are in `docs/ARCHITECTURE.md`.
- One-line installer for an existing Debian 13 system (`curl -fsSL https://lordos.org/install.sh | sh`,
`tools/install/install.sh`, `docs/INSTALL-DEBIAN.md`): SHA-256 check, apt install, the ISO's
setup, display manager switch and `--uninstall`. Tested in containers; a real-machine run is pending.
+- Notes keeps its notes in `~/Notes` (it was `~/Notas`) and moves the old folder on first run; the
+ SDK's user-folder defaults are the English names when `user-dirs.dirs` is missing.
### Known gaps
diff --git a/apps/notes/index.jsx b/apps/notes/index.jsx
index 60cc4e7..124d1f5 100644
--- a/apps/notes/index.jsx
+++ b/apps/notes/index.jsx
@@ -1,6 +1,6 @@
// Notes — advanced sticky notes: markdown with reading view and outline, images, attachments, emojis and
// notes that live on the desktop as widgets (they move, resize and come back on
-// login). Everything is saved automatically in ~/Notas/<note>/nota.md (see store.js and docs/NOTES.md).
+// login). Everything is saved automatically in ~/Notes/<note>/nota.md (see store.js and docs/NOTES.md).
import {
View, Text, useTheme, useLocale, useAppWindow, useStore, useKeyboard, Button, TextInput, ScrollView, ThemeProvider, Segmented,
Toolbar, ToolbarButton, ToolbarSpacer, MenuButton, SearchField, EmptyState, textDirection,
diff --git a/apps/notes/store.js b/apps/notes/store.js
index 88de5f3..eefb112 100644
--- a/apps/notes/store.js
+++ b/apps/notes/store.js
@@ -1,4 +1,4 @@
-// store.js — the notes on disk: ~/Notas/<slug>/nota.md (markdown with a minimal YAML
+// store.js — the notes on disk: ~/Notes/<slug>/nota.md (markdown with a minimal YAML
// header) and its attachments next to it. They save themselves, about 600 ms after the last change.
//
// ---
@@ -17,7 +17,8 @@
// - [ ] yerba mate
import { createStore, fs, screen, registerWidgetType, setWidgets } from '@lordos/sdk';
-export const DIR = 'Notas';
+export const DIR = 'Notes';
+const OLD_DIR = 'Notas'; // before 0.7.0: moved to ~/Notes on first run (see ensureDir)
export const COLORS = ['yellow', 'pink', 'green', 'blue', 'purple', 'gray'];
export const notesStore = createStore({ loaded: false, list: [] });
@@ -59,7 +60,20 @@ export function titleOf(body) {
export const folder = (slug) => `${DIR}/${slug}`;
export const absFolder = (slug) => `${fs.home()}/${DIR}/${slug}`;
+const exists = (p) => { try { return !!fs.stat(p); } catch (e) { return false; } };
+
+// First run after the rename: ~/Notas becomes ~/Notes. If both exist, ~/Notes wins and ~/Notas is
+// left untouched.
+let migrated = false;
+function migrateOldDir() {
+ if (migrated) return;
+ migrated = true;
+ if (exists(DIR) || !exists(OLD_DIR)) return;
+ try { fs.rename(OLD_DIR, DIR); console.log('notes: moved ~/Notas to ~/Notes'); } catch (e) { console.log(`notes: could not move ~/Notas to ~/Notes: ${e.message}`); }
+}
+
function ensureDir() {
+ migrateOldDir();
try { fs.list(DIR); } catch (e) { try { fs.mkdir(DIR); } catch (e2) { /* no home folder */ } }
}
@@ -113,8 +127,8 @@ export function updateNote(slug, patch, { touch = true } = {}) {
const stamp = () => new Date().toISOString().replace(/[-:]/g, '').replace(/\..*/, '').replace('T', '-');
function newSlug() {
const taken = new Set(notesStore.get().list.map((n) => n.slug));
- let s = `nota-${stamp()}`, i = 2;
- while (taken.has(s)) s = `nota-${stamp()}-${i++}`;
+ let s = `note-${stamp()}`, i = 2;
+ while (taken.has(s)) s = `note-${stamp()}-${i++}`;
return s;
}
@@ -142,15 +156,15 @@ export function duplicateNote(slug) {
return copy;
}
-// Delete: to the Trash if it exists; otherwise, to ~/Notas/.papelera (can be recovered by hand).
+// Delete: to the Trash if it exists; otherwise, to ~/Notes/.trash (can be recovered by hand).
export function deleteNote(slug) {
clearTimeout(timers.get(slug));
timers.delete(slug);
let ok = false;
try { if (fs.trash) { fs.trash(folder(slug)); ok = true; } } catch (e) { ok = false; }
if (!ok) {
- try { fs.mkdir(`${DIR}/.papelera`); } catch (e) { /* already there */ }
- try { fs.rename(folder(slug), `${DIR}/.papelera/${slug}`); ok = true; } catch (e) { ok = false; }
+ try { fs.mkdir(`${DIR}/.trash`); } catch (e) { /* already there */ }
+ try { fs.rename(folder(slug), `${DIR}/.trash/${slug}`); ok = true; } catch (e) { ok = false; }
}
if (ok) patchList((list) => list.filter((n) => n.slug !== slug));
return ok;
@@ -183,15 +197,15 @@ export function attachFile(slug, path) {
return isImage(name) ? `![${name}](${name})` : `[📎 ${name}](${name})`;
}
-// The clipboard image (copied in any app) as the note's imagen-N.png.
+// The clipboard image (copied in any app) as the note's image-N.png.
export function pasteClipboardImage(slug) {
const data = lord.clipboard.imageData ? lord.clipboard.imageData() : null;
if (!data) return null;
let names;
try { names = new Set(fs.list(folder(slug)).map((e) => e.name)); } catch (e) { names = new Set(); }
let i = 1;
- while (names.has(`imagen-${i}.png`)) i++;
- const name = `imagen-${i}.png`;
+ while (names.has(`image-${i}.png`)) i++;
+ const name = `image-${i}.png`;
try { fs.write(`${folder(slug)}/${name}`, data); } catch (e) { return null; }
return `![${name}](${name})`;
}
diff --git a/apps/photos/index.jsx b/apps/photos/index.jsx
index 9e5fb31..ced882f 100644
--- a/apps/photos/index.jsx
+++ b/apps/photos/index.jsx
@@ -1,6 +1,6 @@
// Photos — image viewer and library (our own design, in the style of desktop viewers).
//
-// The library is ~/Imágenes (and its folders), with thumbnails in ~/.cache/lordos/thumbs. The
+// The library is the XDG pictures folder, ~/Pictures by default (and its folders), with thumbnails in ~/.cache/lordos/thumbs. The
// viewer decodes with lord-media (PNG, JPEG, animated GIF, WebP, BMP; HEIC/AVIF if FFmpeg can)
// and C draws it: zoom, panning, rotation, full screen and slideshow. Edits
// (crop, rotation, brightness and contrast) are saved as a copy: the original is left untouched.
diff --git a/assets/help/en/notes.md b/assets/help/en/notes.md
index 171941d..faff2c3 100644
--- a/assets/help/en/notes.md
+++ b/assets/help/en/notes.md
@@ -18,5 +18,5 @@ Quick notes in markdown that can also stay on the desktop as sticky notes.
- **On the desktop:** each note can stay as a sticky note, in a color, and be pinned above windows.
- **Delete:** the note goes to the Trash and can be restored.
-Notes are regular folders in `~/Notas`, with a `nota.md` inside. Search finds them by title and
+Notes are regular folders in `~/Notes`, with a `nota.md` inside. Search finds them by title and
by text.
diff --git a/assets/help/es/notes.md b/assets/help/es/notes.md
index 4b13dd3..8e6f2ff 100644
--- a/assets/help/es/notes.md
+++ b/assets/help/es/notes.md
@@ -19,5 +19,5 @@ Notas rápidas con markdown, que también se pueden dejar pegadas en el escritor
las ventanas.
- **Borrar:** la nota va a la Papelera y se puede restaurar.
-Las notas son carpetas comunes en `~/Notas`, con un `nota.md` adentro. Buscar las encuentra
+Las notas son carpetas comunes en `~/Notes`, con un `nota.md` adentro. Buscar las encuentra
por título y por texto.
diff --git a/assets/help/pt/notes.md b/assets/help/pt/notes.md
index 6ba9de3..82369c9 100644
--- a/assets/help/pt/notes.md
+++ b/assets/help/pt/notes.md
@@ -19,5 +19,5 @@ Notas rápidas em markdown, que também podem ficar coladas na área de trabalho
janelas.
- **Apagar:** a nota vai para a Lixeira e pode ser restaurada.
-As notas são pastas comuns em `~/Notas`, com um `nota.md` dentro. Pesquisar as encontra pelo
+As notas são pastas comuns em `~/Notes`, com um `nota.md` dentro. Pesquisar as encontra pelo
título e pelo texto.
diff --git a/docs/ISO.md b/docs/ISO.md
index 0f29a8a..9b9d027 100644
--- a/docs/ISO.md
+++ b/docs/ISO.md
@@ -366,8 +366,9 @@ Idle (after a minute without input):
3. **Package copyright** said the license was undefined; it now carries the MIT text and lists
Plus Jakarta Sans with the other OFL fonts.
-Noted, not changed: Notes stores its notes in `~/Notas`, a Spanish folder name that also appears in
-English sessions (`apps/notes/store.js`); changing it needs a migration.
+Noted then, fixed for 0.7.0-beta: Notes stored its notes in `~/Notas`, a Spanish folder name that
+also appeared in English sessions. It now uses `~/Notes` and moves `~/Notas` there on first run
+(`docs/NOTES.md`).
## Tests (VM 117 `lordos-live`, Proxmox)
diff --git a/docs/NOTES.md b/docs/NOTES.md
index 4e57ae9..87b3cf1 100644
--- a/docs/NOTES.md
+++ b/docs/NOTES.md
@@ -20,16 +20,21 @@ save themselves in the home folder.
## Where they are stored
-Each note is a folder in `~/Notas/<note>/`:
+Each note is a folder in `~/Notes/<note>/`:
```
-~/Notas/nota-20261016-135509/
+~/Notes/note-20261016-135509/
├── nota.md the note
-├── imagen-1.png pasted from the clipboard
+├── image-1.png pasted from the clipboard
├── m1-first-frame.png inserted with «Image»
└── informe.txt attached with «Attach»
```
+Before 0.7.0 the folder was `~/Notas`. On the first run Notes moves it to `~/Notes` (a rename
+in the home folder through `lord.fs`). If both folders exist, Notes uses `~/Notes` and leaves
+`~/Notas` untouched; Search also falls back to `~/Notas` while `~/Notes` doesn't exist yet. If
+there is no Trash, a deleted note goes to `~/Notes/.trash`.
+
`nota.md` is plain markdown with a small YAML header: it opens with any editor. If it is edited
by hand while LordOS is running, the change shows up the next time the session is opened.
@@ -94,7 +99,7 @@ Each note marked «On the desktop» is a sticky note between the wallpaper and t
| Enter in a list | continues the list (next number, empty checkbox); on an empty item it ends it |
| Tab / ⇧Tab in a list | indent / outdent |
| ❖Z / ❖⇧Z | undo / redo |
-| ❖C / ❖X / ❖V | copy / cut / paste. If what was copied is an image (from any app, Linux ones too), it is saved as `imagen-N.png` in the note and inserted |
+| ❖C / ❖X / ❖V | copy / cut / paste. If what was copied is an image (from any app, Linux ones too), it is saved as `image-N.png` in the note and inserted |
| `:` + name | emoji suggestions (`:cafe` → ☕); Enter or Tab picks |
The editor is our own (`apps/notes/NoteEditor.jsx`): text in a monospace font with word wrap,
@@ -111,7 +116,7 @@ and `toggleTask(text, line)`.
checkboxes (`- [ ]` / `- [x]`, ticked with a click, which changes the `.md`), code blocks,
tables with alignment, and separators.
- **Inline:** bold, italic, strikethrough, `code`, links, bare URLs, local images
- `![](imagen.png)` (relative to the note's folder, at their real size up to the available
+ `![](image.png)` (relative to the note's folder, at their real size up to the available
width) and `:emoji:`.
- **How mixed-style text is built.** The LordOS engine has no runs with different styles inside
a single `<Text>`. So a paragraph is a row with `flexWrap: 'wrap'` and one `<Text>` per word
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index 4ef73e5..24b1c5d 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -174,7 +174,7 @@ our own installer, and network, VPN, sound and clipboard with our own interface.
permissions, a signed LordOS app repository.
- [x] `flexWrap` in our own layout engine (`layout.c`).
- [x] Notes: sticky notes on the desktop (widgets), markdown with reading view and index, images,
- attachments and emoji, saved automatically in `~/Notas` (`NOTES.md`).
+ attachments and emoji, saved automatically in `~/Notes` (`NOTES.md`).
## M8 — Session and system
diff --git a/docs/SPOTLIGHT.md b/docs/SPOTLIGHT.md
index de83a93..f497d21 100644
--- a/docs/SPOTLIGHT.md
+++ b/docs/SPOTLIGHT.md
@@ -41,7 +41,7 @@ Sections are ordered by their best result; the calculator always goes on top.
| Settings | the Settings sections and their translated keywords (`settings.keywords.*`) | `wm.open('settings', { args: { section } })` |
| Actions | dark or light mode; log out | the action |
| Files | name in the home folder: the server's `lord.fs.search` (up to 6 levels); if unavailable, our own walk in chunks (4 levels, 5000 entries, no hidden files) | folders in Files, text in the Editor, the rest in Files with the file selected |
-| Notes | `~/Notas/*/nota.md` (title from the Notes app's YAML header, and the content); the section only appears if the Notes app is present | `wm.open('notes', { args: { slug } })` |
+| Notes | `~/Notes/*/nota.md` (title from the Notes app's YAML header, and the content); the section only appears if the Notes app is present | `wm.open('notes', { args: { slug } })` |
| Clipboard | texts from the history | copies again |
| Store | `lord.pkg.search`: only AppStream apps that aren't installed, up to 5 | `wm.open('store', { args: { search } })` |
diff --git a/sdk/media.js b/sdk/media.js
index 112ebaf..f790a19 100644
--- a/sdk/media.js
+++ b/sdk/media.js
@@ -180,7 +180,7 @@ export function useThumb(path, size = 256) {
return thumbFor(path, size);
}
-// User folders (xdg-user-dirs; if missing, the LordOS names).
+// User folders (xdg-user-dirs; if missing, the English defaults).
export function userDirs() {
let conf = '';
try { conf = fs.read('.config/user-dirs.dirs'); } catch (e) { /* no xdg-user-dirs */ }
@@ -189,7 +189,7 @@ export function userDirs() {
const m = new RegExp(`^XDG_${key}_DIR="\\$HOME/([^"]+)"`, 'm').exec(conf);
return `${home}/${m ? m[1] : def}`;
};
- return { home, pictures: get('PICTURES', 'Imágenes'), music: get('MUSIC', 'Música'), videos: get('VIDEOS', 'Videos'), desktop: get('DESKTOP', 'Escritorio') };
+ return { home, pictures: get('PICTURES', 'Pictures'), music: get('MUSIC', 'Music'), videos: get('VIDEOS', 'Videos'), desktop: get('DESKTOP', 'Desktop') };
}
// ---- what's playing now (Control Center and media keys) ----
diff --git a/sdk/spotlight.js b/sdk/spotlight.js
index 7fada29..b45f6bb 100644
--- a/sdk/spotlight.js
+++ b/sdk/spotlight.js
@@ -224,7 +224,7 @@ function revealFile(f) {
wm.open('files', { new: true, args: { path: parent, select: f.name } });
}
-// ---- notes (Notes app: ~/Notas/<note>/nota.md) ----
+// ---- notes (Notes app: ~/Notes/<note>/nota.md; ~/Notas before 0.7.0) ----
let notesCache = { at: 0, list: [] };
function loadNotes() {
@@ -232,10 +232,11 @@ function loadNotes() {
if (Date.now() - notesCache.at < 30000) return notesCache.list;
const list = [];
let dirs = [];
- try { dirs = fs.list('Notas'); } catch (e) { dirs = []; }
+ let base = 'Notes';
+ try { dirs = fs.list(base); } catch (e) { base = 'Notas'; try { dirs = fs.list(base); } catch (e2) { dirs = []; } }
for (const d of dirs.filter((x) => x.dir).slice(0, 400)) {
let text = '';
- try { text = fs.read(`Notas/${d.name}/nota.md`).slice(0, 65536); } catch (e) { continue; }
+ try { text = fs.read(`${base}/${d.name}/nota.md`).slice(0, 65536); } catch (e) { continue; }
// the Notes app's YAML header (title: …) and the markdown body
const head = /^---\n([\s\S]*?)\n---\n?/.exec(text);
const body = head ? text.slice(head[0].length) : text;