Timewarrior Documentation
repository·develop·Indexed 23 days ago
https://github.com/gothenburgbitfactory/timewarriorA portable, open-source time tracking utility supporting simple stopwatch features, complex calendar-based backfilling, and flexible reporting. Includes documentation on building from source, managing holiday files, using the timew-chart visualizer, and command-line operations such as timew annotate, timew cancel, and timew config.
What's inside Timewarrior
- Timewarrior is a time tracking utility designed for both simple stopwatch-style tracking and sophisticated calendar-based backfilling. It provides flexible reporting capabilities and is a portable, open-source project. For extensive documentation, news, and downloads, visit timewarrior.net.
Understand Timewarrior command line syntax and elements
developTimewarrior uses a command-line interface where the first word is the
command, followed by optionalargs. Commands can also usesubcommandsto specify specific behaviors.Key Syntax Elements
- Words: The basic elements separated by whitespace (or quotes).
- Subcommands: Used to refine command behavior (e.g.,
timew tag list). - Dates: Points in time like
1pm,10:33,2017-04-11T17:12:23, ornow. - Durations: Time spans like
one day,two weeks,today, oryesterday. - Ranges: Time intervals defined by two dates (e.g.,
09:45 - 11:15) or a date and a duration (e.g.,two hours before 10:45). - Tags: Lexical tokens used to label intervals.
- Filters: Used to limit operations to specific
tagsorranges. - Hints: Words starting with
:(e.g.,:quiet) that request modified behavior. Hints are optional and commands may ignore them if they are not relevant to the context.
Use hints to fill gaps or resolve overlaps in timew modify
developThe
timew modifycommand supports two specific hints to handle interval boundaries and collisions::fill: Automatically adjusts the interval to close gaps with adjacent intervals.- When using
start, it fills the gap between the interval and the previous interval. - When using
end, it fills the gap between the interval and the next interval. - When using
range, it fills gaps on both sides.
- When using
:adjust: Forces the modification even if the new range overlaps with an existing interval. This will overwrite the overlapping interval.
Configure Timewarrior settings
developTimewarrior configuration is stored in
timewarrior.cfg. On Unix systems, it defaults to~/.config/timewarrior/timewarrior.cfg(following XDG Base Directory specs) unless~/.timewarriorexists. On non-Unix systems, it is located at~/.timewarrior/timewarrior.cfg.You can also override the data location using the
TIMEWARRIORDBenvironment variable.Use Timewarrior hints
developTimewarrior supports 'hints', which are single-word command line features prefixed with a colon (e.g.,:week). Hints can be used to provide shortcuts for date ranges or to control the behavior of the application, such as enabling debug mode or suppressing output for automation.Handle overlapping intervals with the :adjust hint
developWhen importing data, Timewarrior checks for overlaps with existing intervals. If you want the imported intervals to take precedence, use the:adjusthint. When this hint is provided, the imported interval will overwrite any existing intervals that it overlaps with.Specify date and time intervals in Timewarrior
developTimewarrior uses flexible syntax to define intervals (blocks of time). An interval can be 'closed' (having both a start and an end date) or 'open' (having only a start date).
You can specify intervals using the following patterns:
[from] <date>: An open interval starting at a specific time.[from] <date> to/- <date>: A closed interval between two points.[from] <date> for <duration>: An open interval starting at a time and lasting for a specific duration.<duration> before/after <date>: A closed interval relative to a specific time.<duration> ago: A closed interval relative to the current time.[for] <duration>: An open interval representing a duration (often used relative to now).
Note:
<duration>refers to time lengths like2h(2 hours).from 9:00 from 9am - 11am from 9:00:00 to 11:00 from 9:00 for 2h 2h after 9am 2h before 11:00 2h ago for 2hUnderstand the Timewarrior DOM structure
developThe Timewarrior DOM (Document Object Model) provides a hierarchical way to access data from the Timewarrior database. All DOM references must start with the
domprefix. The structure is divided into four primary sub-references:dom.tracked: Accesses all intervals returned by a database query. This reference supports filtering by range and tags.dom.active: Accesses the currently active time tracking interval. This is invalid if no time is being tracked.dom.tags: Accesses all tags present in the database.dom.rc: Accesses Timewarrior configuration settings.
Use the :fill: hint to start an interval immediately
developThe:fillhint allows you to create a new time interval that begins exactly when the previous interval ended. This is useful for continuous tracking where you want to avoid gaps between tasks without manually calculating or typing a start time.Handle range boundaries with named dates
developBecause named dates (like
today,yesterday, etc.) are defined with the time0:00:00, using them as the upper bound of a range will exclude the day they represent.If you want to include the current day in a relative sum, use
nowortomorrowinstead oftoday.Example: Summing the last 2 days
To exclude the current day:
$ timew sum 2d before todayTo include the current day:
$ timew sum 2d before now $ timew sum 2d before tomorrow$ timew sum 2d before today $ timew sum 2d before now $ timew sum 2d before tomorrowStart, stop, or cancel time tracking
developUse basic commands to manage active time intervals.
start: Creates a new open interval. If an interval is already active, it closes the current one and starts a new one only if the provided tags differ from the current ones.stop: Closes the current open interval at the specified date. If tags are provided, it creates a new open interval containing only the tags from the current interval that were not in the provided list.cancel: Deletes the current open interval entirely.
timew start timew stop 17:00 timew cancelUse the timew-chart report to visualize time
developThe
timew-chartcommand displays a visual summary of tracked and untracked time using colored blocks on a timeline. It provides three distinct views based on the time granularity requested:day,week, andmonth.Available Commands
timew day: Shows a chart for a single day (defaults to today).timew week: Shows a chart for a single week (defaults to the current week).timew month: Shows a chart for a single month (defaults to the current month).
Filtering and Selection
You can filter the chart output using:
- Date Ranges: Specify a range (e.g.,
1st - today). - Tags: Filter by one or more tags (e.g.,
FOO BAR). - IDs: Filter by specific interval IDs (e.g.,
@3 @4).
Chart Hints
Use these hints to modify the visual output:
:blank: Displays only excluded (untracked) time, hiding all tracked time blocks. Useful for visualizing gaps.:ids: Displays the unique IDs alongside the time intervals.
timew month 1st - today timew week FOO BAR timew day @3 @4