goetzd / alfred-timewarrior

Alfred workflow for timewarrior

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timewarrior for Alfred

Get an overview over your latest tracked times in timewarrior and edit them easily.

Requirements

You need to have node installed and accessable via the node command. (In case it is not, find out where your desired local node executable is located and replace node in the file execute.sh with that path).

Configuration

alfred-timewarrior comes with a default configuration with good chances that it works out of the box on your Mac.

This default configuration assumes that you either installed timew using Homebrew or your installed it any other way to the path /usr/local/bin/timew.

If this is not the case, or you want to adapt alfred-timewarrior to your needs, you can customize it as follows: In your home directory, create a directory .alfred-timewarrior:

mkdir ~/.alfred-timewarrior 

In this folder, create a file alfred-timewarrior.json with the following example content:

{
  "timewExecutable": "/usr/local/bin/timew",
  "granularityInMinutes": "1",
  "ignoredTagsForWorkingTime": [],
  "logoForTag": {
    "<tag>": "<iconPathRelativeToAlfredTimewarriorFolder>"
  }
}

This file provides a couple of options:

  • timewExecutable is the path to your timewarrior executable. Set this only if the default doesn't work out of the box.
  • granularityInMinutes allows you to set a granularity of timestamps that is respected for default timestamps and in other places of alfred-timewarrior. The default is 1, meaning that timestamps are by default rounded to one minute. Why would you use this? For my day to day projects, I am required to only book times with a granularity of three minutes because this converts easily into decimal numbers with a precision of two (e.g. 3 minutes = 0.05 hours).
  • ignoredTagsForWorkingTime is a list of tags which should be ignored for determining working time. This can be used if lunch breaks are tracked using their own tag but are obviously not work time, for example.
  • logoForTag contains a map of tags to images/icons on your harddrive. This means that if you want specific icons for different clients/projects/etc. it is easy to define them here. The value must be a relative(!) path from inside the ~/.alfred-timewarrior folder. I.e. if you have an icon ~/.alfred-timewarrior/icon/client1.png which should be used for the Tag Client1, you should add the line
    "logoForTag": {
      "Client1": "icon/client1.png"
    }
    If a tag is not found in this list, the fallback is always the alfred-timewarrior icon. You can, however, also define your own default icon by defining a logo for "DefaultIcon".

Installation

Clone the package and run

npm install
npm run package

Then copy the contents of the dist folder to your Alfred workflows folder.

Usage

Assign your favorite hotkey by opening the workflow in Alfred's settings (default is Ctrl+Z) or simply type tw.

Without specifying an argument, you get your total work time for today, your over-/undertime for today and for the month. Then, your most recent timecards are displayed.

There are a couple of arguments you can specify. For an overview and description, type ?. There are a few special commands which are not present as such in timewarrior, but are combinations of at least two commands:

  • split splits the currently running timecard at the given time in two. I need this frequently when I need a new annotation, but the same tags and a seamless transition between timecards.
  • retag removes all tags from a selected timecard and replaces it with the given tag.

ToDo

  • Provide a .alfredworkflow file.
  • Improve configuration of node executable.

Credits

The icon was created by Good Ware from Flaticon.

About

Alfred workflow for timewarrior

License:Apache License 2.0


Languages

Language:TypeScript 99.8%Language:Shell 0.2%