matryer / matryer/xbar-plugins

002-todotxt.15s.sh:

Open
#1,812 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

shell
Dominant language
Shell
Stars
2.6k
Forks
1.1k
Avg merge
9d 15h
Merged PRs (30d)
1

Description

#!/bin/sh

reminder=$(osascript -e 'tell application "Reminders"
set activeReminders to (reminders of list "测试" whose completed is true)
set numOfActiveReminders to (count of activeReminders)
set allReminders to (reminders of list "测试")
set numOfAllReminders to (count of allReminders)
set result to ((numOfActiveReminders as string) & "/" & numOfAllReminders as string)
return result
end tell')

todolist=$(osascript -e 'tell application "Reminders"
set todos to (reminders of list "测试" whose completed is false)
set newlist to {}
repeat with todo in todos
copy (name of todo as text) to the end of the newlist
end repeat
return newlist
end tell')
todolist=${todolist// /} # 删除空格
todolist=${todolist//,/ } # 转换 AppleScript 的 list 为 shell 的 list 格式

if [ "$1" = "done" ]; then
osascript -e "tell application \"Reminders\"
set activeReminders to (reminders of list \"测试\" whose completed is false)
repeat with todo in activeReminders
if (name of todo as text) is equal to \"$2\" then
tell todo
set completed to true
end tell
end if
end repeat
end tell"
fi

if [ "$1" = "open" ]; then
osascript -e 'tell application "Reminders" to activate'
fi

echo "✔︎ $reminder"
echo "---"
echo "Open Reminder| bash='$0' param1='open' terminal=false"
echo "---"
for loop in $todolist
do
echo "${loop%*,} | bash='$0' param1='done' param2='${loop%*,}' terminal=false refresh=true"
done | sort
echo "---"
echo "↻ Refresh| terminal=false refresh=true"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the submitted 002-todotxt.15s.sh script and review its xbar output, osascript calls, and shell parameter handling. Done means it lists the named Reminders list, opens Reminders, marks a selected reminder done, and refreshes the displayed list as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, shell
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.