fsnotes icon indicating copy to clipboard operation
fsnotes copied to clipboard

Improvement on the "Auto rename by Title"

Open DesBw opened this issue 1 year ago • 7 comments

This is a very useful feature. I appreciate it you have it here. But, it needs a little tweak so that FSnotes will play good with other apps such as Obsidian. Currently, if we select "Auto renmame by title" in setting, editing notes that are already created in Obisidian or other app will get renamed to the first line text. That is too much. I think a better option would be to not touch the names of old notes; and rename only the ones we are creating inside fsnotes.

DesBw avatar Oct 07 '24 04:10 DesBw

Files created in FSNotes are no different from any other markdown files. How to implement this?

And why shouldn't some files be renamed if auto-rename is selected? Old notes are sometimes edited too.

After a while, users will come to me asking "why aren't the notes renamed"?

glushchenko avatar Oct 08 '24 07:10 glushchenko

After a while, users will come to me asking "why aren't the notes renamed"?

I don't think that ever happens because if a user is editing an old file, he/she already assigned a file name to it. In rare occasions that we need to rename old files, it is not that hard to hit CMD+R.

The problem with the current system is any file we edit inside FSNotes is going to renamed. It could cause a lot of unexpected results.

As to the implementation, how about using the CreationDate attribute provided by the macOS? Auto rename a file --> iff it has been created in the last few seconds (or sth like that).

DesBw avatar Oct 08 '24 09:10 DesBw

Look at a comment by @xor-gate here

I think this feature works, but it did automagicly rename my files which I did not expect. If I use the setting other than "Auto Rename By Title" it should not touch my filenames every again right? I'm now using the "Format: Untitled Note" setting.

He expressed the problem of the current implementation. Editing a file should not trigger renaming, honestly. Creating a file can, well because we are creating it, need to name it anyways.

DesBw avatar Oct 08 '24 10:10 DesBw

As to the implementation, how about using the CreationDate attribute provided by the macOS?

That's possible, I can even make an additional option for that.

glushchenko avatar Oct 08 '24 17:10 glushchenko

That's possible, I can even make an additional option for that.

thank you

DesBw avatar Oct 08 '24 17:10 DesBw

Please check dev build FSNotes_6.9.8.zip

New option available here: Settings -> Files Naming -> Auto Rename By Title (New Only)

glushchenko avatar Oct 08 '24 18:10 glushchenko

Wow, that is impressive man.
Yes, it is working. May I suggest the name "Autoname by Title", because this one doesn't rename existing files. It assigns names to the newly created ones (unnamed yet).

Brilliant. Thank you.

DesBw avatar Oct 08 '24 18:10 DesBw

I was excited about it. Unfortunately, I just realized that the improvement actually is not working. Here, I have recorded a video to show that the setting is not applying. https://monosnap.com/file/30OPWxCZI6q95M0CFHviTbHk1YdsIk The video also shows that the Fsnotes is not getting the title from the YAML, even if it was supposed to do so, according to this: https://github.com/glushchenko/fsnotes/issues/1108

DesBw avatar Nov 18 '24 10:11 DesBw

@DesBw please check this:

https://github.com/glushchenko/fsnotes/releases/download/6.9.8/FSNotes_6.9.8.zip

glushchenko avatar Nov 24 '24 16:11 glushchenko

I am afraid I am getting the same behavior (renaming files based on the first line). https://monosnap.com/file/RhselaliDVG54PSIiRYQhBrgW1Go9M

DesBw avatar Nov 25 '24 11:11 DesBw

This works through checking the file creation date, I don't see any bugs here.

    func isOlderThanOneDay(from date: Date? = nil) -> Bool {
        if let date = date, let differenceInDays = Calendar.current.dateComponents([.day], from: date, to: Date()).day {
            return differenceInDays >= 1
        }
        
        return false
    }

glushchenko avatar Nov 25 '24 20:11 glushchenko

@glushchenko will this be coming to the iOS version?

RainofTerra avatar Mar 03 '25 22:03 RainofTerra

@RainofTerra 100%

glushchenko avatar Mar 07 '25 19:03 glushchenko

Implemented in 6.10.0 and available in AppStore

glushchenko avatar Mar 14 '25 15:03 glushchenko