Focus Budget: Updated Implementation

hammerspoon logo

I’ve been playing around with using Hammerspoon to modify my interaction layer in OSX to enhance efficiency while maintaining focus.

Some time ago I wrote a blog post about the rough pattern of my weekly planning of a “focus budget.” The objective is to estimate the time I have available for important tasks.

Thanks to a Jacob Collins pointing out a cool feature on Things I’ve started using a new trick and written a new headspace that has dramatically sped up my weekly planning and daily scheduling.

Understanding this new system requires you to know three facts:

  1. If you copy or drag a to-do in Things you can get the plaintext version of that to-do or project.
  2. If you drag any body of text into Fantastical, it creates an event using the current default calendar.
  3. You can set the default calendar for new events in each Calendar Set in Fantastical.

So… armed with these facts, I’ve written a simple layout “space” using my Headspace module.

You can read the whole thing here, but here’s the gist of it.

  1. Open Fantastical and Things, and position them so that I can see the whole week in Fantastical and a list in Things. If it’s Sunday, I’m doing my weekly planning, so I show the Upcoming list. Otherwise, I show Today. Both are filtered to my work to-dos.
  2. Switch the Fantastical calendar set to “Focus Planning,” a calendar set where the default calendar is a private calendar I use to plan my week.
  3. Once all is in place, I drag todos from my Upcoming view in Things onto my calendar, creating little time blocks! I adjust their length based on how much time I’ve estimated… and this is a really good way to see if I’ve even got enough time to do all that I’ve planned.
  4. When I move away from the space, the tear down function will put Fantastical and Things back to their normal states. It’s great!

I really love this pattern. Thanks to the tags on my to-dos, I can see if I have enough time to execute on my daily plan.I have to admit that the little bit o’ automation that chooses the right Things list based on the time makes me really happy.

-- setup the space for Headspace
table.insert(config.spaces, {
-- […]
})

config.funcs.focus_budget = {
  setup = function()

    if os.date("%a") == "Sun" or os.date("%a") == "Sat" then
      hs.urlevent.openURL("things:///show?id=upcoming&filter=%40Proctoru%2CEstimates")
    else
      hs.urlevent.openURL("things:///show?id=today&filter=%40Proctoru%2CEstimates")
    end

    hs.application.launchOrFocusByBundleID('com.culturedcode.ThingsMac')
    hs.application.launchOrFocusByBundleID('com.flexibits.fantastical2.mac')

    local things = hs.application.find('com.culturedcode.ThingsMac')
    local fantastical = hs.application.find('com.flexibits.fantastical2.mac')

    local upcoming = things:focusedWindow()
    upcoming:application():selectMenuItem("Hide Sidebar")

    local cal = fantastical:focusedWindow()
    cal:application():selectMenuItem("Hide Sidebar")
    cal:application():selectMenuItem("Focus Budget")
    cal:application():selectMenuItem("By Week")

    hs.layout.apply(
      {
        {"Fantastical", nil, hs.screen.primaryScreen(), hs.layout.left70, 0, 0},
        {"Things", nil, hs.screen.primaryScreen(), hs.layout.right30, 0, 0}
      }
    )
  end,
  teardown = function()
    local fantastical = hs.application.find('com.flexibits.fantastical2.mac')
    fantastical:selectMenuItem("Show Sidebar")
    fantastical:selectMenuItem("Daily Focus")
  end
}