GTD with Obsidian: a ready-to-go GTD system with Task Sequencing, Quick-add template, Waiting-on, Someday/Maybe, and more

Thank you for this beautiful script! It works great.

I just madea little tweak for adding context. I didnโ€™t want to bloat the page with different groupings, so instead I added emojis at the start of the task according to the tag.

Also I added a little logic for the tags to not be shown when displayed in the Master Task List.

See the examples below:

image
image

image

It adds :house:,:handbag: and :star2: emojis as prefix to the tasks/projects that has #home, #work and #personal respectively.

It also removes these tags from the display, so they are not shown beside the task text in Master Task List.

The changes made on only generateTaskElement function and it can be reached from below.

/**
 * Take a task and the page it's from, and return a formatted element for the tasks array
 * @param {*} task
 * @param {*} page
 * @returns {object}
 */
function generateTaskElement(task, page) {
  let group = Groups.Normal;
  if (task.tags.includes('#someday')) {
    group = Groups.Someday;
  } else if (task.tags.includes('#waiting-on')) {
    group = Groups.Waiting;
  } else if (task.tags.includes('#๐Ÿ”ผ') || page.tags.includes('#๐Ÿ”ผ')) {
    group = Groups.Priority;
  }

  // Set emoji for specific tags and project tags
  let prefixEmoji = '';
  if (task.tags.includes('#home') || page.tags.includes('#home')) {
    prefixEmoji = '๐Ÿ ';
  } else if (task.tags.includes('#work') || page.tags.includes('#work')) {
    prefixEmoji = '๐Ÿ’ผ';
  } else if (task.tags.includes('#personal') || page.tags.includes('#personal')) {
    prefixEmoji = '๐ŸŒŸ';
  }

  // Remove specific tags and the ๐Ÿ”ผ emoji from the task text
  task.text = task.text
    .replace(/#home|#work|#personal|#๐Ÿ”ผ/g, '') // Remove the specific tags and ๐Ÿ”ผ emoji
    .trim(); // Remove any extra spaces left after removing tags

  // Add the prefix emoji at the beginning of the task text
  task.text = `${prefixEmoji} ${task.text}`.trim();

  // Remove the specific tags from `task.tags` so they donโ€™t display
  task.tags = task.tags.filter(tag => !['#home', '#work', '#personal', '#๐Ÿ”ผ'].includes(tag));

  // Get the created date of a task for sorting, either from the task text
  // in the format of โž•2024-04-20, or from the page metadata.
  let date;
  const hasDate = task?.text?.match(/โž•\s?(\d{4}-\d{2}-\d{2})/);
  if (hasDate) { // Task inline created date
    date = moment(hasDate[1].valueOf());
  } else if (page.created) { // Page `created` frontmatter property
    date = page.created?.ts || moment(page.created).valueOf();
  }
  date = date || page.ctime.ts;

  return {
    task,
    date,
    group
  };
}

Thanks again!

3 Likes