Toxblh / MTMR

🌟 [My TouchBar My rules]. The Touch Bar Customisation App for your MacBook Pro
https://mtmr.app
MIT License
4.22k stars 219 forks source link

up next isn't working for me #390

Open james-rose opened 3 years ago

james-rose commented 3 years ago

It just leaves a blank space on my touchbar but nothing else. Has anyone got this to work? I'm on M1 Big Sur 11.2.1.

Config: { "type": "upnext", "from": 0, "to": 12, "maxToShow": 3, "autoResize": false },

spnq commented 3 years ago

Same behaviour on mbp 16', Big Sur 11.2.3 with the same code snippet.

horror894 commented 3 years ago

Same behavior on mbp 16', Big Sur 11.2.3 with the same code snippet.

mjabdulm commented 3 years ago

Same behavior on mbp 13", Mojave with the same code snippet

fmatray commented 3 years ago

Here too with Big Sur 11.2.3

ckarmy commented 3 years ago

Not working on Big Sur 11.5.1

mjabdulm commented 3 years ago

any update?

leikoilja commented 2 years ago

Same for M1, Monterey 12.4

vivacenontroppo commented 1 year ago

Not working for MacBook pro 13" M1 2020; macOS Ventura 13.0 FVFGL6Y8Q05N

JinchaoLove commented 1 year ago

Not working for MacBook pro 13" Intel 2019; macOS Catalina 10.15.7 (19H2026). May I know why? Should I set something in Calendar?

JinchaoLove commented 1 year ago

Here's a kind of solution for this with AppleScript:

{
    "type": "appleScriptTitledButton",
    "align": "right",
    "bordered": true,
    "autoResize": true,
    "source": {
      "inline": "tell application \"Reminders\"\n\tset reminderLists to every list\n\tif (count of reminderLists) > 0 then\n\t\tset firstList to item 1 of reminderLists\n\t\tif (count of reminders in firstList) > 0 then\n\t\t\tset firstReminder to item 1 of reminders in firstList\n\t\t\t\n\t\t\treturn {name of firstReminder, \"\"}\n\t\telse\n\t\t\treturn {\"The first list is empty\", \"\"}\n\t\tend if\n\telse\n\t\t\treturn {\"No lists found\", \"\"}\n\tend if\nend tell"
    },
    "refreshInterval": 3600,  // in seconds
    "longAction": "appleScript",
    "longActionAppleScript": {
      "inline": "activate application \"Reminders\""
    }
},

You can change the number of list or item in set firstList to item 1 of reminderLists set firstReminder to item 1 of reminders in firstList.

To get the itemLeft to itemRight in the listNumber from "Reminders", use below script to get "title" and embed it into your MTMR json:

on get_reminders(listNumber, itemLeft, itemRight)
    tell application "Reminders"
        set reminderLists to every list
        if (count of reminderLists) > 0 then
            set listToGet to item listNumber of reminderLists
            set remindersToGet to items itemLeft thru itemRight of reminders in listToGet
            set reminderNames to {}
            repeat with thisReminder in remindersToGet
                set end of reminderNames to name of thisReminder
            end repeat
            return reminderNames
        else
            return "There are no reminders"
        end if
    end tell
end get_reminders
JinchaoLove commented 1 year ago

To get the first upcoming event within 3 days in the Calendar (return title and remaining hours):

{
  "type": "appleScriptTitledButton",
  "align": "right",
  "bordered": true,
  "autoResize": true,
  "source": {
    "inline": "tell application \"Calendar\"\n\tset today to current date\n\tset futureDate to today + (3 * days)\n\tset upcomingEvents to every event of calendar 1 whose start date is greater than or equal to today and start date is less than or equal to futureDate\n\tif upcomingEvents is {} then\n\t\treturn \"\"\n\telse\n\t\tset firstEvent to item 1 of upcomingEvents\n\t\tset eventTitle to summary of firstEvent\n\t\tset remainingTime to ((start date of firstEvent) - (current date)) div hours\n\t\treturn eventTitle & remainingTime & \"H\"\n\tend if\nend tell"
  },
  "refreshInterval": 3600,  // in seconds
  "longAction": "appleScript",
  "longActionAppleScript": {
    "inline": "activate application \"Calendar\""
  }
},
bendadaniel commented 8 months ago

To get the first upcoming event within 3 days in the Calendar (return title and remaining hours):

{
  "type": "appleScriptTitledButton",
  "align": "right",
  "bordered": true,
  "autoResize": true,
  "source": {
    "inline": "tell application \"Calendar\"\n\tset today to current date\n\tset futureDate to today + (3 * days)\n\tset upcomingEvents to every event of calendar 1 whose start date is greater than or equal to today and start date is less than or equal to futureDate\n\tif upcomingEvents is {} then\n\t\treturn \"\"\n\telse\n\t\tset firstEvent to item 1 of upcomingEvents\n\t\tset eventTitle to summary of firstEvent\n\t\tset remainingTime to ((start date of firstEvent) - (current date)) div hours\n\t\treturn eventTitle & remainingTime & \"H\"\n\tend if\nend tell"
  },
  "refreshInterval": 3600,  // in seconds
  "longAction": "appleScript",
  "longActionAppleScript": {
    "inline": "activate application \"Calendar\""
  }
},

is it still working? :/

kawaiier commented 8 months ago

To get the first upcoming event within 3 days in the Calendar (return title and remaining hours):

{
  "type": "appleScriptTitledButton",
  "align": "right",
  "bordered": true,
  "autoResize": true,
  "source": {
    "inline": "tell application \"Calendar\"\n\tset today to current date\n\tset futureDate to today + (3 * days)\n\tset upcomingEvents to every event of calendar 1 whose start date is greater than or equal to today and start date is less than or equal to futureDate\n\tif upcomingEvents is {} then\n\t\treturn \"\"\n\telse\n\t\tset firstEvent to item 1 of upcomingEvents\n\t\tset eventTitle to summary of firstEvent\n\t\tset remainingTime to ((start date of firstEvent) - (current date)) div hours\n\t\treturn eventTitle & remainingTime & \"H\"\n\tend if\nend tell"
  },
  "refreshInterval": 3600,  // in seconds
  "longAction": "appleScript",
  "longActionAppleScript": {
    "inline": "activate application \"Calendar\""
  }
},

Thanks for sharing but this code isn't working now