Skip to content

feat(simple-notes): icon customization, hide widget, IPC toggle, and file export (v1.1.0)#378

Draft
fusuyfusuy wants to merge 1 commit intonoctalia-dev:mainfrom
fusuyfusuy:main
Draft

feat(simple-notes): icon customization, hide widget, IPC toggle, and file export (v1.1.0)#378
fusuyfusuy wants to merge 1 commit intonoctalia-dev:mainfrom
fusuyfusuy:main

Conversation

@fusuyfusuy
Copy link
Copy Markdown
Contributor

@fusuyfusuy fusuyfusuy commented Mar 16, 2026

Implemented this requests: #212

Summary

  • Add customizable bar icon via NIconPicker (pattern: update-count)
  • Add hide bar widget toggle with smooth opacity/size animation (pattern: screen-recorder)
  • Add IPC handler for togglePanel with keyboard shortcut display in Settings (pattern: notes-scratchpad)
  • Add optional .md file export with directory picker and per-note filenames (pattern: notes-scratchpad FileView)
  • Bump version 1.0.3 → 1.1.0, add missing default settings, add i18n keys

Changes from review feedback (@spiros132)

  • Use cfg/defaults pattern throughout: cfg.key ?? defaults.key ?? fallback so defaultSettings in manifest.json are actually used as fallbacks
  • Removed Component.onCompleted settings initialization from Main.qml — defaults are now handled by the cfg/defaults pattern in each component
  • Removed all translation fallback strings (|| 'Value') from Panel.qml and Settings.qml
  • Added error handling for file export: try/catch in exportNoteToFile(), exportError state property, and a dismissable error banner in the Panel UI
  • Changed notesDirectory default to ~/Documents in manifest.json

Copy link
Copy Markdown
Collaborator

@spiros132 spiros132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback and questions about the PR :)

Comment thread simple-notes/Panel.qml
id: fileExporter
path: ""
watchChanges: false
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to have some type of error handling so that the user would be able to know what was wrong if the file was weirdly formatted?

Comment thread simple-notes/manifest.json Outdated
"positionMode": "attached",
"barIcon": "paperclip",
"hideBarWidget": false,
"notesDirectory": ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused you are including these defaultSettings but not including them anywhere in the code. For example you could do the following:

// Instead of this
readonly property string barIcon: pluginApi?.pluginSettings?.barIcon ?? "paperclip"

// You can have the following instead:
// (NOTE: the following functions aren't needed but you can add them for readabilities sake)
readonly property cfg: pluginApi?.pluginSettings ?? ({})
readonly property defaults: pluginApi?.manifest?.metadata?.defaultSettings ?? ({})

readonly property string barIcon: cfg.barIcon ?? defaults.barIcon ?? "paperclip"

Comment thread simple-notes/Panel.qml Outdated
property real contentPreferredWidth: 700 * Style.uiScaleRatio
property real contentPreferredHeight: 500 * Style.uiScaleRatio
readonly property bool allowAttach: true
readonly property string positionMode: pluginApi?.pluginSettings?.positionMode || "attached"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example of the above comment is here

Comment thread simple-notes/Main.qml Outdated
if (pluginApi.pluginSettings.notesDirectory === undefined) {
pluginApi.pluginSettings.notesDirectory = "";
pluginApi.saveSettings();
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion you shouldn't depend on the main file to instantiate and save the settings. By using the method before with the default settings you could technically also have the following:

// As a quick example with no fallback value since the value is taken from the defaults
...
readonly property key: cfg.key ?? defaults.key ?? ""

Comment thread simple-notes/Panel.qml Outdated
Layout.fillWidth: true
placeholderText: titleInput.text
? root.sanitizeFileName(titleInput.text)
: (pluginApi?.tr("panel.editor.filename_placeholder") || "auto-generated-from-title.md")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it comes to translations, you don't need to use fallback values anymore. So the following works:

// From:
pluginApi?.tr("key") || "Value"
// To this:
pluginApi?.tr("key")

Comment thread simple-notes/manifest.json Outdated
"positionMode": "attached",
"barIcon": "paperclip",
"hideBarWidget": false,
"notesDirectory": ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the ~/Documents folder be a good default for the notesDirectory?

Comment thread simple-notes/Settings.qml Outdated
// 3. Hide Bar Widget
NToggle {
label: pluginApi?.tr("settings.hide_bar_widget.label") || "Hide Bar Widget"
description: pluginApi?.tr("settings.hide_bar_widget.description") || "Hide the bar widget from the status bar"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As before you don't need translation fallbacks anymore

@ItsLemmy ItsLemmy marked this pull request as draft March 19, 2026 22:29
@fusuyfusuy
Copy link
Copy Markdown
Contributor Author

Thx for the feedback. Working on it

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Automatic Code Quality Review


File: simple-notes/BarWidget.qml

  • (H) Missing required property sectionWidgetIndex. For example:
property int sectionWidgetIndex: -1
  • (H) Missing required property sectionWidgetsCount. For example:
property int sectionWidgetsCount: 0

File: simple-notes/Panel.qml

  • (L) Line 98: When it comes to translations there is no need for fallback values. From: pluginApi?.tr("example") || "value". To: pluginApi?.tr("example")
+      root.exportError = pluginApi?.tr("panel.export.error") ?? ("Failed to export note: " + e);

File: simple-notes/Settings.qml

  • (H) Line 146: Use translations instead of hardcoded text. Instead of: "Example Label". To: pluginApi?.tr("panel.example-label")
+        text: "qs -c noctalia-shell ipc call plugin:simple-notes togglePanel"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Automatic Code Quality Review


File: simple-notes/Panel.qml

  • (L) Line 85: When it comes to translations there is no need for fallback values. From: pluginApi?.tr("example") || "value". To: pluginApi?.tr("example")
+      root.exportError = pluginApi?.tr("panel.export.error") ?? ("Failed to export note: " + e);

File: simple-notes/Settings.qml

  • (H) Line 130: Use translations instead of hardcoded text. Instead of: "Example Label". To: pluginApi?.tr("panel.example-label")
+        text: "qs -c noctalia-shell ipc call plugin:simple-notes togglePanel"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Automatic Code Quality Review


File: simple-notes/Panel.qml

  • (L) Line 85: When it comes to translations there is no need for fallback values. From: pluginApi?.tr("example") || "value". To: pluginApi?.tr("example")
+      root.exportError = pluginApi?.tr("panel.export.error") ?? ("Failed to export note: " + e);

File: simple-notes/Settings.qml

  • (H) Line 130: Use translations instead of hardcoded text. Instead of: "Example Label". To: pluginApi?.tr("panel.example-label")
+        text: "qs -c noctalia-shell ipc call plugin:simple-notes togglePanel"

… export (v1.1.0)

Implements: noctalia-dev#212

Changes:
- Add customizable bar icon via NIconPicker (pattern: update-count)
- Add hide bar widget toggle with smooth opacity/size animation
- Add IPC handler for togglePanel with keyboard shortcut display in Settings
- Add optional .md file export with directory picker and per-note filenames
- Bump version 1.0.3 -> 1.1.0

Review feedback addressed (@spiros132):
- Use cfg/defaults pattern throughout: cfg.key ?? defaults.key ?? fallback
  so defaultSettings in manifest.json are actually used as fallbacks
- Remove Component.onCompleted settings initialization from Main.qml
- Remove translation fallback strings (|| 'Value') from Panel.qml and Settings.qml
- Add error handling for file export: try/catch, exportError state, dismissable
  error banner in the Panel UI
- Change notesDirectory default to ~/Documents in manifest.json

Upstream changes incorporated:
- Add mandatory sectionWidgetIndex and sectionWidgetsCount props to BarWidget.qml
- Fix NButton delete button to use backgroundColor instead of color (704eb32)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Automatic Code Quality Review


File: simple-notes/Panel.qml

  • (L) Line 85: When it comes to translations there is no need for fallback values. From: pluginApi?.tr("example") || "value". To: pluginApi?.tr("example")
+      root.exportError = pluginApi?.tr("panel.export.error") ?? ("Failed to export note: " + e);

File: simple-notes/Settings.qml

  • (H) Line 130: Use translations instead of hardcoded text. Instead of: "Example Label". To: pluginApi?.tr("panel.example-label")
+        text: "qs -c noctalia-shell ipc call plugin:simple-notes togglePanel"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants