From 993443be9eaab4bd10f581f280e2771b33b7f0ff Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Sun, 22 Mar 2026 10:35:09 +0100 Subject: [PATCH] Updated preset options ("features") --- tests/e2e/integration.spec.js | 21 ++++++++++++------- .../nickelmenu/features/hide-notices/index.js | 15 +++++++++++++ .../features/hide-recommendations/index.js | 15 +++++++++++++ web/src/nickelmenu/features/koreader/index.js | 15 +++++++------ .../features/simplify-home/index.js | 15 ------------- web/src/nickelmenu/installer.js | 8 ++++--- 6 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 web/src/nickelmenu/features/hide-notices/index.js create mode 100644 web/src/nickelmenu/features/hide-recommendations/index.js delete mode 100644 web/src/nickelmenu/features/simplify-home/index.js diff --git a/tests/e2e/integration.spec.js b/tests/e2e/integration.spec.js index 57cd6dc..e6f29c1 100644 --- a/tests/e2e/integration.spec.js +++ b/tests/e2e/integration.spec.js @@ -43,11 +43,13 @@ test.describe('NickelMenu', () => { await expect(page.locator('input[name="nm-cfg-readerly-fonts"]')).toBeChecked(); await expect(page.locator('input[name="nm-cfg-screensaver"]')).not.toBeChecked(); await expect(page.locator('input[name="nm-cfg-simplify-tabs"]')).not.toBeChecked(); - await expect(page.locator('input[name="nm-cfg-simplify-home"]')).not.toBeChecked(); + await expect(page.locator('input[name="nm-cfg-hide-recommendations"]')).not.toBeChecked(); + await expect(page.locator('input[name="nm-cfg-hide-notices"]')).not.toBeChecked(); await expect(page.locator('input[name="nm-cfg-koreader"]')).not.toBeChecked(); - // Enable simplifyHome for testing - await page.check('input[name="nm-cfg-simplify-home"]'); + // Enable both home screen hiding options for testing + await page.check('input[name="nm-cfg-hide-recommendations"]'); + await page.check('input[name="nm-cfg-hide-notices"]'); await expect(page.locator('#btn-nm-next')).toBeEnabled(); await page.click('#btn-nm-next'); @@ -90,7 +92,7 @@ test.describe('NickelMenu', () => { // Must NOT contain screensaver (unchecked by default) expect(zipFiles.some(f => f.startsWith('.kobo/screensaver/'))).toBe(false); - // Verify items file has simplifyHome modifications + // Verify items file has hide-recommendations and hide-notices modifications const itemsContent = await zip.file('.adds/nm/items').async('string'); expect(itemsContent).toContain('experimental:hide_home_row1col2_enabled:1'); expect(itemsContent).toContain('experimental:hide_home_row3_enabled:1'); @@ -141,6 +143,9 @@ test.describe('NickelMenu', () => { expect(zipFiles).toContainEqual('.adds/nm/items'); // KOReader files should be present under .adds/koreader/ expect(zipFiles.some(f => f.startsWith('.adds/koreader/'))).toBe(true); + // KOReader launcher should be at the top of the items file + const itemsContent = await zip.file('.adds/nm/items').async('string'); + expect(itemsContent.startsWith('menu_item:main:KOReader')).toBe(true); }); test('with device — install with KOReader writes files to device', async ({ page }) => { @@ -253,7 +258,8 @@ test.describe('NickelMenu', () => { // Enable all options for testing await page.check('input[name="nm-cfg-simplify-tabs"]'); - await page.check('input[name="nm-cfg-simplify-home"]'); + await page.check('input[name="nm-cfg-hide-recommendations"]'); + await page.check('input[name="nm-cfg-hide-notices"]'); await page.click('#btn-nm-next'); @@ -262,7 +268,8 @@ test.describe('NickelMenu', () => { await expect(page.locator('#nm-review-list')).toContainText('NickelMenu'); await expect(page.locator('#nm-review-list')).toContainText('Readerly fonts'); await expect(page.locator('#nm-review-list')).toContainText('Hide certain navigation tabs'); - await expect(page.locator('#nm-review-list')).toContainText('Hide certain home screen elements'); + await expect(page.locator('#nm-review-list')).toContainText('Hide home screen recommendations'); + await expect(page.locator('#nm-review-list')).toContainText('Hide home screen notices'); // Both buttons visible when device is connected await expect(page.locator('#btn-nm-write')).toBeVisible(); @@ -291,7 +298,7 @@ test.describe('NickelMenu', () => { // Verify NickelMenu items file exists and has expected modifications const items = await readMockFile(page, '.adds', 'nm', 'items'); expect(items, '.adds/nm/items should exist').not.toBeNull(); - // With simplifyHome enabled, the hide lines should be appended + // With hide-recommendations and hide-notices enabled, the hide lines should be appended expect(items).toContain('experimental:hide_home_row1col2_enabled:1'); expect(items).toContain('experimental:hide_home_row3_enabled:1'); }); diff --git a/web/src/nickelmenu/features/hide-notices/index.js b/web/src/nickelmenu/features/hide-notices/index.js new file mode 100644 index 0000000..4b8289b --- /dev/null +++ b/web/src/nickelmenu/features/hide-notices/index.js @@ -0,0 +1,15 @@ +export default { + id: 'hide-notices', + title: 'Hide home screen notices', + description: 'Hides the third row on the home screen that shows notices below your books, such as reading time, release notes for updates, and Kobo Plus or Store promotions.', + default: false, + + postProcess(files) { + const items = files.find(f => f.path === '.adds/nm/items'); + if (!items || typeof items.data !== 'string') return files; + + items.data += '\nexperimental:hide_home_row3_enabled:1\n'; + + return files; + }, +}; diff --git a/web/src/nickelmenu/features/hide-recommendations/index.js b/web/src/nickelmenu/features/hide-recommendations/index.js new file mode 100644 index 0000000..1e31460 --- /dev/null +++ b/web/src/nickelmenu/features/hide-recommendations/index.js @@ -0,0 +1,15 @@ +export default { + id: 'hide-recommendations', + title: 'Hide home screen recommendations', + description: 'Hides the recommendations column next to your current read on the home screen. Useful if you are only reading one book at a time.', + default: false, + + postProcess(files) { + const items = files.find(f => f.path === '.adds/nm/items'); + if (!items || typeof items.data !== 'string') return files; + + items.data += '\nexperimental:hide_home_row1col2_enabled:1\n'; + + return files; + }, +}; diff --git a/web/src/nickelmenu/features/koreader/index.js b/web/src/nickelmenu/features/koreader/index.js index d92f57d..62757ef 100644 --- a/web/src/nickelmenu/features/koreader/index.js +++ b/web/src/nickelmenu/features/koreader/index.js @@ -3,7 +3,7 @@ import JSZip from 'jszip'; export default { id: 'koreader', title: 'Install KOReader', - description: 'Installs KOReader, an alternative e-book reader with advanced features like PDF reflow, customizable fonts, and more.', + description: 'Installs KOReader, an alternative e-book reader with advanced features like PDF reflow, customizable fonts, and more. Installing this requires many files to be copied and that can take a bit, so please be patient when transferring this to your Kobo.', default: false, available: false, // set to true at runtime if KOReader assets exist @@ -40,11 +40,14 @@ export default { }); } - // Add NickelMenu launcher config - files.push({ - path: '.adds/nm/koreader', - data: 'menu_item:main:KOReader:cmd_spawn:quiet:exec /mnt/onboard/.adds/koreader/koreader.sh\n', - }); + return files; + }, + + postProcess(files) { + const items = files.find(f => f.path === '.adds/nm/items'); + if (!items || typeof items.data !== 'string') return files; + + items.data = 'menu_item:main:KOReader:cmd_spawn:quiet:exec /mnt/onboard/.adds/koreader/koreader.sh\n\n' + items.data; return files; }, diff --git a/web/src/nickelmenu/features/simplify-home/index.js b/web/src/nickelmenu/features/simplify-home/index.js deleted file mode 100644 index 334f283..0000000 --- a/web/src/nickelmenu/features/simplify-home/index.js +++ /dev/null @@ -1,15 +0,0 @@ -export default { - id: 'simplify-home', - title: 'Hide certain home screen elements', - description: 'If you are reading only one book, no recommendations will appear next to your current read, and third row on your homescreen with advertisements for Kobo Plus and the Kobo Store will be hidden. For minimalists who want fewer distractions.', - default: false, - - postProcess(files) { - const items = files.find(f => f.path === '.adds/nm/items'); - if (!items || typeof items.data !== 'string') return files; - - items.data += '\nexperimental:hide_home_row1col2_enabled:1\nexperimental:hide_home_row3_enabled:1\n'; - - return files; - }, -}; diff --git a/web/src/nickelmenu/installer.js b/web/src/nickelmenu/installer.js index 1495efd..cd9ad86 100644 --- a/web/src/nickelmenu/installer.js +++ b/web/src/nickelmenu/installer.js @@ -4,7 +4,8 @@ import customMenu from './features/custom-menu/index.js'; import readerlyFonts from './features/readerly-fonts/index.js'; import koreader from './features/koreader/index.js'; import simplifyTabs from './features/simplify-tabs/index.js'; -import simplifyHome from './features/simplify-home/index.js'; +import hideRecommendations from './features/hide-recommendations/index.js'; +import hideNotices from './features/hide-notices/index.js'; import screensaver from './features/screensaver/index.js'; /** @@ -15,9 +16,10 @@ import screensaver from './features/screensaver/index.js'; export const ALL_FEATURES = [ customMenu, readerlyFonts, - koreader, simplifyTabs, - simplifyHome, + hideRecommendations, + hideNotices, + koreader, screensaver, ];