srg-kostyrko / obsidian-journal

MIT License
70 stars 7 forks source link

Feature request: Default/Priority journal (for hotkey) #23

Closed oschrenk closed 4 months ago

oschrenk commented 4 months ago

Thank you for the great plugin. It's one of the "features" that finally made me stick with Obsidian. I was looking for a solution to keep multiple work and private journals and this is the one.

Context: I currently have 3 journals, let's say "personal", "private", "work". All of them have a daily note. I use the "work" journal 80% of the time. 95% of the time I go to today's note. I mapped a hotkey to open today's note.

Problem: I have to invoke the hotkey to open today's note, press "down" twice, and then press enter to reach the daily note I use most often.

Want: I would love to bring the number of key presses down to a single hotkey press for the most important use case (for me).

Idea:

Discussion: This is of course geared towards my personal use case and I am not sure how it fits into the vision of the plugin overall.

Maybe it is possible to add "default" versions for "today", "this week", "this month", "this quarter", "this year", "this interval", and have "next", and "previous" commands figure out which journal your are currently interacting with. This would then only add 6 or so commands.

This way I can have Cmd+T mapped to open today's note of my "default" journal and maybe Cmd+Shift+T open the selection menu as is now.

What do you think?

srg-kostyrko commented 4 months ago

You have a good point here about being able to speed you your regular workflow.

The only "concern" that I have on suggested approach - for users that have only 1 journal there will be commands duplication (2 commands doing the same thing).

I have a slightly different approach in mind:

The downside of this approach - no way to configure hotkey to selection menu if you configured default journal - you would need to open calendar view (hotkey avaliable) and them click on today button (or exact date) to see selection menu.

What do you think?

oschrenk commented 4 months ago

for users that have only 1 journal there will be commands duplication (2 commands doing the same thing)

Valid concern. Might be confusing for users.

Another idea is to pre-select the default in the selection box. That way it's only one more key press (return).

srg-kostyrko commented 4 months ago

I'll check but not sure I have enough control there to change what is preselected (I'm using built in SuggestModal)

oschrenk commented 4 months ago

That seems to be a limitation. I found that if you do not make any choice, but just press enter, the SuggestModal will select the first entry of the list.

That especially means that if you have multiple journals you can keep the most important one with a name that is high in the lexicographic order so it ends up being first in the list.

For me, that is good enough I had a list of "personal", "private", "work" but I can happily rename it to "job", "personal", "private". I still have to press an additional "enter" but that's ok for now.

srg-kostyrko commented 4 months ago

I've checked and I will need to update suggestions to show in lexicographic order (now it shows in order journals were created)

srg-kostyrko commented 4 months ago

Lexicographic order of journals in selection menu was released in 1.2.0.

oschrenk commented 4 months ago

That is good enough. Hotkeys for a specific journal might be nicer, but this feature request detracts from the rest of the vision. I'm closing the issue, maybe it can be revisited later.

Thank you!

oschrenk commented 3 days ago

This "problem" got a bit more weight for me, since I now I have two laptops (job changed). One for work one, one for personal use.

I stick to my one vault approach and using your plugin to switch between different journals.

On my work laptop of course I choose the work journal most of the time, and on my personal laptop the personal journal most of the time. Having a selection presented got in my way (especially at work).

I recently forked the project and introduced two ideas:

  1. A vault-local "Context" file living in some directory. Just a note containing front matter data. I then exclude this directory via selective sync.
  2. Each open command now gets a "contextual" copy (so yes, unfortunately a few more command)

If the command is fired I then check if the command is supported by a journal

    case "calendar:open-day-contextual":
       return this.config.day.enabled && this.calendar.hasContext(this.app, this.config.id);

by checking if the "local context"

   hasContext(app: App, id: string): boolean {
    // this file requires frontmatter
    const path = "path/to some/file.md";
    const file = app.vault.getFileByPath(path);
    if (!file) {
      return false;
    }
    const fm = app.metadataCache.getFileCache(file)?.frontmatter;
    if (!fm) {
      return false;
    }
    const defaultId = fm["journals.default.id"];

    return id == defaultId;
  }

That way I can map a key to load the "contextual" daily note on each machine by have a "vault local" configuration.

See also: Comparing srg-kostyrko:main...oschrenk:support-multiple-hotkeys · srg-kostyrko/obsidian-journal · GitHub

It's dirty but it works for me and the context idea might actually be interesting for other workflow as well).

Thank you for the plugin! It was easy to make my idea happen.

srg-kostyrko commented 2 days ago

Thanks for sharing Thats an interesting idea I generally though as part v2 allow configuring more commands and idea with context might be a good addition to this