# The &ktimetracker; Handbook

## Introduction

&ktimetracker; tracks time spent on various tasks. It is useful for tracking billable hours and can report the hours logged by task and day.

This time history can be exported to a comma-delimited text file for import into other billing and/or project management tools.

&ktimetracker; detects when your keyboard and mouse are idle and can associate different tasks with different desktops, two tools that can help keep the timer running on the correct task.

&ktimetracker; was originally written by &Sirtaj.Singh.Kang;. Its home page is https://userbase.kde.org/KTimeTracker.

## Using &ktimetracker;

### Starting &ktimetracker;

Type `ktimetracker` at a command prompt or select Personal Time Tracker from the Applications Utilities group in the Plasma Application Launcher. The generic &Qt; and &kf5-full; command options are available, see man pages qt5options and kf5options.

&ktimetracker; provides an additional command option that allows you to enter the name of the iCalendar file that is used to store your labor history. You enter a remote iCalendar file by using &HTTP; or &FTP; as part of the file name; for example, https://www.mysite.com/mydata/mylabor.ics.

### Tasks

Problem: You are a freelance software consultant with many clients. Some clients have multiple projects. During the course of a day, you switch back and forth between different projects. You need to track your time to generate monthly invoices.

Solution: Create one top-level task for each client and a subtask for each client project. For projects that require more detailed tracking, create a list of project subtasks. Track time by double-clicking on the task you are currently working on.

&ktimetracker; provides great flexibility in tracking your time, allowing unlimited tasks and task depth. Time may be logged to any task, and more than one task can be active at any given time.

&ktimetracker; allows you to edit your task's history and to put a comment for every event that you have stopped.

To create a top-level task, select &Ctrl;T Task New Task... . To create a subtask, highlight the parent task and select &Ctrl;B Task New Subtask... .

When &ktimetracker; exits, the task list is saved to a file on your disk. When it next opens, it reloads the task list from the same file.

&ktimetracker; can import and export tasks to minimize your work. See interfaces.

### Timers

Problem: To remain solvent, you must bill an average of five hours a day. To stay on track, you watch your daily and weekly totals.

Solution: Reset the session timer at the beginning of each work day and reset all timers at the beginning of each week.

&ktimetracker; makes tracking time simple. To start logging time against a task, double-click on the task. To stop logging time, double-click the task again. Active tasks display a small clock in the Session Time column.

Another visual clue of logging activity is the &ktimetracker; system tray icon. When a task is active, the second hand in the icon moves. If you rest the mouse pointer over this icon, the name of the active task will display in a tooltip. If more than one task is active, the task names in the tooltip are separated by commas.

&ktimetracker; maintains two timers for each task: one for the session time and one for the total time. In the default configuration, &ktimetracker; displays two columns for each timer, resulting in a total of four columns for each task:

Session Time

- The time spent on the task since the session began.

Time

- The time spent on the task since all times were reset.

Total Session Time

- The time spent on the task and all its subtasks since the session began.

Total Time

- The time spent on the task and all its subtasks since all times were reset.

To start a new session, select File Start New Session

To reset all times, select File Reset All Times

#### Desktop Tracking

Problem: You have two main projects that you switch between each day. To help organize your work, you keep your project 1 files on Desktop 1 and your project 2 files on Desktop 2.

Solution: Associate project 1 task with Desktop 1 and the project 2 task with Desktop 2. When you switch from Desktop 2 to Desktop 1 active, &ktimetracker; automatically stops the project 2 task and starts the project 1 task.

To associate a task with one or more desktops, select &Ctrl;E Task Properties . Turn on Auto Tracking and select the desktop or desktops to associate with this task. When any of the selected desktops becomes active, after a short delay &ktimetracker; will be automatically start logging time against that task.

#### Idle Detection

Problem: You leave work early on Friday to run an errand and forget to stop the timer. When you return on Monday, the timer is still running.

Solution: Turn on idle detection on the Behavior page of the settings dialog.

&ktimetracker; can be configured to detect when the mouse and keyboard become idle. If the mouse and keyboard are idle for longer than the specified number of minutes, &ktimetracker; displays the following dialog:

&ktimetracker; Idle Detection &ktimetracker; Idle Detection Dialog

Continue Timing

- Apply the idle time to all active timers and keep them running.

  You were working on the task(s) while your computer was idle and still are.

Revert Timing

- Subtract the amount of idle time from all active timers and stop them.

  You were not working on the task(s) while your computer was idle and you are still not.

### Other Systems

#### &korganizer;

&ktimetracker;, like &korganizer; and Apple's iCal, uses the industry standard iCalendar format for its data. &ktimetracker; can read and write the to-do lists created by these two applications.

You can even work synchronously on one file with &korganizer; and &ktimetracker;. If one program changes the file, the updates will be propagated to the other application automatically.

#### Planner

As a typical usecase, you might want to plan a project with the project management tool &Planner; and import its tasks to &ktimetracker; with File Import Import Tasks From Planner... , to have them in the industry standard iCalendar format. Having done so, you are able to schedule the tasks in &korganizer;, and account your time to them in &ktimetracker;. That's one way to help ensure your project stays on time and under budget.

#### &DBus;

&ktimetracker; does support numerous methods that can be used with &DBus;.

There are two ways to use the &DBus; interface: &Qt;'s &GUI; qdbusviewer and the command line qdbus.

##### Bash script that echoes &ktimetracker;'s version

    qdbus org.kde.ktimetracker /KTimeTracker version 2>/dev/null || echo "ktimetracker not running"

&ktimetracker;'s current &DBus; interface is currently used mainly for automated testing, so it is very limited. For the full interface definition, see the dbusappendix.

To see the full &DBus; interface of the &ktimetracker; version installed on your system, run the following Bash script:

##### List &ktimetracker;'s &DBus; interface to console

    qdbus org.kde.ktimetracker /KTimeTracker 2>/dev/null || echo "ktimetracker not running"

#### Export Totals to CSV

&ktimetracker; can export both totals and history to a comma-delimited file format. To export totals, select File Export... and &ktimetracker; displays the export dialog.

Select option Times as CSV in group Report Type. The dialog is going to look as follows:

Export Times as CSV Export Times as CSV

Modify the dialog defaults if necessary. You can preview the CSV output on the right side of the dialog. Click Save As... and &ktimetracker; exports the totals for all tasks to the file you enter in a file dialog.

Use the Copy to Clipboard button to export the times to the clipboard.

Here is another example of the output format:

    "kde",,,,,0.00,0.00,6.88,9.83
    ,"ktimetracker",,,,6.88,8.70,6.88,9.83
    ,,"3.2 feature plan",,,0.00,0.00,0.00,0.00
    ,,"bugs",,,0.00,1.13,0.00,1.13
    ,,"checkin changes - translation strings",,,0.00,0.00,0.00,0.00
    ,,"time card report",,,0.00,0.00,0.00,0.00
    ,"kopete",,,,0.00,0.00,0.00,0.00
    ,"promo",,,,0.00,0.00,0.00,0.00
    ,"web stuff",,,,0.00,0.00,0.00,0.00

Top-level tasks are output in the first column, sub-tasks in the second, and so on. The time data is output after the maximum task depth (five in this example). The first time column is Session Time, the second is Time, the third is Total Session Time and the fourth is the Total Time.

#### Export History to CSV

To export task history, select File Export Export... and &ktimetracker; displays the same export dialog as shown above. Select option History as CSV in group Report Type.

Select a date range that you want the task history to cover. Modify the dialog defaults if necessary. You can preview the CSV output on the right side of the dialog. Click Save As... and &ktimetracker; exports the totals for all tasks to the file you enter in a file dialog.

Use the Copy to Clipboard button to export the times to the clipboard.

Here is an example of the output format:

    Task History
    From Tuesday 06 July 2004 to Tuesday 13 July 2004
    Printed on: 2004-07-13 18:10
    2004-07-06,2004-07-07,2004-07-08,2004-07-09,2004-07-10,2004-07-11,2004-07-12,2004-07-13,
    ,,,,,,,,0.00,"kde"
    ,,1.77,3.23,1.73,,1.37,0.82,8.95,,"ktimetracker"
    ,,,,,,,,0.00,,,"3.2 feature plan"
    ,1.13,,,,,,,1.13,,,"bugs"
    ,,,,,,,,0.00,,,"checkin changes - translation strings"
    ,,,,,,,,0.00,,,"time card report"
    ,,,,,,,,0.00,,"kopete"
    ,,,,,,,,0.00,,"promo"
    ,,,,,,,,0.00,,"web stuff"

The first three lines identify when the report was generated and for which date range. The fourth row is a comma-delimited list of the dates in the date range, in ISO 8601 format (YYYY-MM-DD). All subsequent rows list the time logged against each task. The last numeric column is the row total across all days. The task name prints after the total column, and is indented to indicate the task/sub-task relationship. Top level task names appear in the first column after the total.

## The &ktimetracker; interface

The main &ktimetracker; window has the following components: menubar, toolbar, searchbar, task/time window and status bar.

The searchbar is a combined field. As long as you do not press &Enter;, it acts as a filter. Then, only tasks that match your input are shown. As soon as you press &Enter;, your input is used as a name to create a new task.

Choose Configuration for PDA in the Appearance page of the settings dialog if you have a touchscreen and your screen real estate is precious. It will disable the search bar and every click will pop up a context menu.

&ktimetracker; Screen &ktimetracker; Screen

### The Task/Time window

The various tasks are displayed in this window, along with the time accumulated for each in the current session and in total. Tasks being timed have a small clock icon next to the session time.

Subtasks can be created for each task. Clicking the plus sign and minus sign in front of the main task toggles the view of its associated subtasks. The total time accrued for a task includes the times for its subtasks, as well as its own accumulated time.

### The Toolbar and Statusbar

The toolbar contains icons for the following commands:

All behave identically to the menu command.

- New Task

- New Subtask

- Start

- Stop

- Delete

- Edit

- Open

- Save

The statusbar reports the name of the file where the data was saved.

## Credits and License

&ktimetracker;

Program copyright:

- 1997-2000 &Sirtaj.Singh.Kang; &Sirtaj.Singh.Kang.mail;

- 2001-2002 Tomas Pospisek tpo_deb@sourcepole.ch

- 2003-2004 Mark Bucciarelli mark@hubcapconsulting.com

- 2004-2011 Thorsten Stärk dev@staerk.de

- 2019 Alexander Potashev aspotashev@gmail.com

Contributors (in alphabetical order)

- Alexander Potashev aspotashev@gmail.com

- Allen Winter winter@kde.org

- &David.Faure; &David.Faure.mail;

- &Espen.Sand; espen@kde.org

- Gioele Barabucci gioele@gioelebarabucci.com

- Jan Schaumann jschauma@netmeister.org

- &Jesper.Pedersen; blackie@ifad.dk

- Kalle Dalheimer &Matthias.Kalle.Dalheimer.mail;

- Klarälvdalens Datakonsult AB

- Mark Bucciarelli mark@hubcapconsulting.com

- Thorsten Stärk dev@staerk.de

- Tomas Pospisek tpo_deb@sourcepole.ch

- Willi Richert w.richert@cox.net

&ktimetracker; was inspired by Harald Tveit Alvestrand's very useful utility called titrax, the only failing of which is that it is based on the Xt toolkit.

Documentation copyright 2000-2004 &Jonathan.Singer; &Jonathan.Singer.mail; and &Sirtaj.Singh.Kang; &Sirtaj.Singh.Kang.mail;.

&underFDL; &underGPL;

## Glossary

## A

active task

A task which has a timer running.

## D

&DBus;

An interprocess communication protocol. Short for Desktop Bus.

desktop

&GNU;/&Linux;, FreeBSD and other systems that run X.Org Server have multiple desktops. You can typically have four different desktops installed by default. Each desktop can display its own set of programs and files. When &kde; &plasma; first starts up, the desktop you see is Desktop 1. If you press &Ctrl;F2, you will see Desktop 2. Pressing &Ctrl;F1 will bring back Desktop 1.

## H

history

If &ktimetracker; is configured to log history, it will record every start/stop timer event. This history is not cleared when times are reset and remains on file until the task is deleted.

## S

session

A user-defined starting point for the session timers. A new session begins when you select File Start New Session . Session data is not saved when you create a new session.

Session Time

The time spent on the task since the session began.

system tray

The system tray is in the bar that (by default in &kde; &plasma;) appears at the bottom of the screen. In this system tray the &ktimetracker; icon is on the far right.

## T

top level task

A task with no parent tasks.

Total Session Time

The time spent on the task and all its subtasks since the session began.

Time

The time spent on the task since all times were reset.

Total Time

The time spent on the task and all its subtasks since all times were reset.

## &DBus; Interface

version

version

Return &ktimetracker;'s version.

    QString version()

#### Description

`version()` is a &DBus; call that returns &ktimetracker;'s version number; for example 4.3.1. The version number is returned as a string in the typical &GNU; format of major.minor.bugfix.

quit

quit

Quit &ktimetracker;'.

    QString quit()

#### Description

`quit()` is a &DBus; call that provides a way that an external program can gracefully shutdown &ktimetracker;.

addTask

addTask

Add new task.

    QString addTask(QString taskname)

#### Parameters

`taskname`

- The name of new task.

#### Description

`addTask(QString taskname)` is a &DBus; call that adds a new top-level to-do to the current storage. The UID of the new task is returned.

&documentation.index;