QOwnNotes icon indicating copy to clipboard operation
QOwnNotes copied to clipboard

[Feature Request] - Pinned notes and marking notes visible to sub-directory

Open maqp opened this issue 6 years ago • 10 comments

I manage course work etc. with QOwnNotes and I often like to create subfolders to keep everything sorted. So I might have directory structure like

  • notes_root_dir/
    • TODO.md
    • course_root_dir/
      • Description.md
      • Schedule.md
      • Course Progress.md
      • week_1/
        • Assignment 1.md
        • Assignment 2.md
      • week_2/
        • Assignment 3.md
        • Assignment 4.md
    • another_course_root_dir/

I often find myself needing to make edits to TODO.md and Course Progress.md while mainly working on e.g. assignment 2.md.

It would be really helpful if I could right-click a note in the list and select something like pin this note that then displays the note at the top of any note list of any directory.

Also I'd love if I could right-click the note and select something like make note visible in sub-directories that does just that: e.g. setting it for Course Progress.md would show it e.g. when week_1/ is selected but not when another_course_root_dir/ is selected.

As for the note listing, here's a mockup I made

I used the bookmark symbol (🔖) to denote a pinned note, those should IMO be on top.

The notes that are located in a higher level directory and marked visible to subdirectories I denoted with the symbol and I'll refer to them as ↑-notes below. IMO those should be listed below pinned notes, but above notes of the sub directory.

As for the ordering of notes amidst the two groups

  • Pinned notes can be located anywhere, so they can only be sorted in alphabetical order or by time last edited. It's most likely enough if they obey the global setting for note sorting.

  • As for the ↑-notes, there could be additional setting group ↑-notes by directory level, that displays the notes so that ↑-notes of the parent directory are sorted just above the sub-directory notes, the ↑-notes of grand parent directory are sorted among themselves above the parent directory ↑-notes etc.

In addition to the unpin and don't display note in sub-directories buttons, general toggle settings Hide pinned notes and Hide notes marked to be visible in subdirectories would be helpful as one doesn't have to edit a dozen notes if they want to hide them when they want to focus on a task.

maqp avatar Oct 21 '19 15:10 maqp

Thank you for your suggestion.

Similar to #351 or #774. As nice it would be to have something like that the unlikely it is that we will. That would mean a larger rewrite of how QOwnNotes operates. There is no notes database (for portability). Notes are only read from their folders every time.

I created the script https://github.com/pbek/QOwnNotes/blob/develop/doc/scripting/favorite-note.qml back then.

pbek avatar Oct 21 '19 17:10 pbek

That's unfortunate. However, I almost managed to hack around this issue by writing a Python script that takes a file I want to create an ↑-note for, and creates symlinks recursively to any directories and subdirectories in the directory where the note is: When QOwnnotes opens the symlink it edits the original file in the top-most directory. The problem here is this requires the notes to be reloaded every time they are opened via another symlink or the original file.

I added a QML script that reloads the note. The last problem I'm facing is the API only seems to have two options

  • noteDoubleClickedHook works, but if I edit the note in two places and forget to open the note every time with double click, it will cause loss of data from all edits except the last.

  • noteOpenedHook seemed to work for a second but it caused a busy loop and crashed the application.

The script I wrote looks like this:

import QtQml 2.0
import QOwnNotesTypes 1.0
Script {
    function noteDoubleClickedHook(note) {
        mainWindow.buildNotesIndexAndLoadNoteDirectoryList(true, true);
        script.setCurrentNote(note);
    }
}

So would it be possible to add noteSingleClickedHook to the API? (Also, should I make a separate issue for that?)

maqp avatar Oct 21 '19 21:10 maqp

So would it be possible to add noteSingleClickedHook to the API? (Also, should I make a separate issue for that?)

I don't fancy hooks on things that will be triggered a lot, because every time they trigger every script needs to be searched for that hook.

Also clicking on a note is not the only way to trigger a change of the current note.

pbek avatar Oct 22 '19 06:10 pbek

Would tags help you to mark "often used" notes?

pbek avatar Oct 22 '19 06:10 pbek

You're probably right. However, wouldn't this be mainly the problem of the user if they choose to run lots of scripts including ones that slow the application down (the API documentation could warn about the adverse effects)?

(Also I didn't notice slow-downs when I double-clicked notes with the script above. A hook for single click on a note shouldn't be any different in nature than hook for double click. I only have three scripts at the moment and I don't see myself adding many more. Also I'd assume C++ runs fast enough on modern laptop with NVMe storage for this not to be a problem.

But! I'll look into the tags as soon as I have a moment of spare time and see if I can get desired functionality from those!

maqp avatar Oct 23 '19 05:10 maqp

Thank you for your suggestion.

Similar to #351 or #774. As nice it would be to have something like that the unlikely it is that we will. That would mean a larger rewrite of how QOwnNotes operates. There is no notes database (for portability). Notes are only read from their folders every time.

I created the script https://github.com/pbek/QOwnNotes/blob/develop/doc/scripting/favorite-note.qml back then.

how is this script used? I already have it activated but I didn't see any new options in the menus

fabianski7 avatar Sep 17 '20 19:09 fabianski7

New link: https://github.com/pbek/QOwnNotes/blob/develop/docs/content/scripting/examples/favorite-note.qml

Scripting menu, Custom actions

pbek avatar Sep 17 '20 19:09 pbek

I'd really like to see this feature however as an interim measure I've just added an underscore to the name of my notes I use most frequently and set the notes to sort by Name.

Justinzobel avatar Mar 28 '22 23:03 Justinzobel

When notes are sorted by last edit, the underscore solution does not work :s

Having pinned notes would be a nice feature indeed @pbek The link to the script that you provided is no more reachable https://github.com/pbek/QOwnNotes/blob/develop/docs/content/scripting/examples/favorite-note.qml Can you please share the right location?

joomlafun avatar Feb 13 '24 13:02 joomlafun

Best just use the one from the script repository now. https://github.com/qownnotes/scripts/tree/master/favorite-note

pbek avatar Feb 13 '24 13:02 pbek