matryer / xbar-plugins

Plugin repository for xbar (the BitBar reboot)
https://xbarapp.com
2.43k stars 1.04k forks source link

002-todotxt.15s.sh: #1812

Open april4xxxx opened 2 years ago

april4xxxx commented 2 years ago

!/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"

sprak3000 commented 1 year ago

@april4xxxx

Are you trying to create a new plugin or modify an existing one?