javascriptcoffeescriptgeektool

Coffee Script Replace


Found this new app called Ubersicht. It's seems to be a decent GeekTool desktop replacement on mac, the widgets use coffee script.

I found a great script : https://github.com/bgartenmann/uebersicht-only-this-widget

The script has no instructions. It references a text file called today.txt on the desktop. The idea is to put in your tasks for the day and they display in the widget.

 todayfile = '~/Desktop/today.txt'

 command: "cat #{today file}"

 refreshFrequency: 5000

 style: (a long list of css went here, did not think it was relevant)

 render: (output) -> 
 placeholder = "_____________"
 outputArray = output.split "*"
 goal = outputArray[0] || placeholder
 step1 = outputArray[1] || placeholder
 step2 = outputArray[2] || placeholder
 step3 = outputArray[3] || placeholder

    <p>If nothing else, today I am going to <span class="fillout">#{goal}</span>.<br />
     I am going to do this by <span class="fillout">#{step1}</span> then <span class="fillout">#{step2}</span> then <span class="fillout">#{step3}</span>.<br />
     <span class="motivation">If I do this and only this,<br /> today will be a <strong>good</strong> day.</span>"

I can't figure out how how to format the entries in the .txt file so that the entries end up in the right locations on the widget. I have tried multiple ways to reference step1 , one example being..

step1 = "this step"

Whenever I insert text, they always end up on the first line. How would I make it so the "tasks" entered in the .txt end up in their intended display location on the widget ?


Solution

  • First of all, thanks for spreading a word about Übersicht and this widget! They're awesome!

    The separator for items in the ~/Desktop/today.txt file is an asterisk * character.

    Here's is how my ~/Desktop/today.txt looks like:

    answer a beyonddynamic’s question on stackoverflow
    *
    reading widget’s source code
    *
    taking a screenshot
    *
    posting an answer on stackoverfow
    

    Sentences could be written on one line if you prefer. New lines are optional.

    screenhot