calcurse Documentation

repository·pu·Indexed 23 days ago

https://github.com/lfos/calcurse

A text-based calendar and task manager. Documentation covers installation from source and package managers, non-interactive mode for shell scripting, and synchronization tools including calcurse-caldav for CalDAV servers (supporting OAuth2 and Basic authentication) and calcurse-vdir for vdir storage format integration with vdirsyncer.

Tokens
3.9K
Snippets
5
Records
28
Agent score
74%

What's inside calcurse

  1. Use calcurse hooks to trigger actions

    pu

    You can automate tasks by placing executable scripts in the <confdir>/hooks/ directory. The following hooks are supported:

    • pre-load: Executed before data files are loaded.
    • post-load: Executed after data files are loaded.
    • pre-save: Executed before data files are saved.
    • post-save: Executed after data files are saved.
  2. How calcurse-caldav synchronization works

    pu

    The script maintains a synchronization database at $XDG_DATA_HOME/calcurse/caldav/sync.db (or ~/.calcurse/caldav/sync.db). This database stores a snapshot of the last execution.

    During a run, the script compares the server state and the local state against this snapshot to:

    1. Download and import new server objects.
    2. Delete local objects that no longer exist on the server.
    3. Upload local objects added to the server.
    4. Delete objects from the server that were deleted locally.
    5. Update the synchronization database snapshot.

    Note: Because calcurse lacks unique identifiers for items, modifications are treated as a deletion of the old item followed by the creation of a new one.

  3. Use filters to restrict non-interactive output

    pu

    When running calcurse in non-interactive mode, you can use filters to narrow down the results.

    Supported filters include:

    • --filter-type <type>: Use event, apt, recur-event, recur-apt, todo, or shorthands recur and cal.
    • --filter-pattern <pattern>: Use an extended regular expression to match descriptions.
    • --filter-priority <priority>: Only include items with a specific priority.
    • --filter-completed / --filter-uncompleted: Filter TODO items by status.
    • Date-based filters: --filter-start-from, --filter-start-to, --filter-start-after, --filter-start-before, --filter-start-range, --filter-end-from, --filter-end-to, --filter-end-after, --filter-end-before, --filter-end-range.
    • --filter-hash <pattern>: Only include items with a hash starting with the pattern (use ! to invert).
  4. Use Hooks to trigger actions during sync

    pu

    You can automate tasks by placing executable scripts in the following directory:

    • $XDG_CONFIG_HOME/calcurse/caldav/hooks/
    • Or ~/.calcurse/caldav/hooks

    Supported hook names:

    • pre-sync: Executed before data files are synchronized.
    • post-sync: Executed after data files are synchronized.
  5. Source tree overview

    pu

    The calcurse repository is organized into the following directories:

    • build-aux: Auxiliary files for the build process.
    • contrib: Useful tools, including hooks and the CalDAV synchronization script.
    • doc: Detailed documentation in plain text and HTML formats.
    • po: Translations and internationalization (i18n) files.
    • scripts: Official scripts, such as calcurse-upgrade.
    • src: The core calcurse source code.
    • test: The test suite and test cases.
  6. Understand calcurse file structure and directories

    pu

    calcurse uses a data directory and a configuration directory. By default, these are located at:

    • Data: $XDG_DATA_HOME/calcurse (or $HOME/.local/share/calcurse)
    • Config: $XDG_CONFIG_HOME/calcurse (or $HOME/.config/calcurse)
    • If $HOME/.calcurse exists, it is used for both.

    You can override these using -D <dir> (data) and -C <dir> (config).

    Directory Structure

    • apts: Contains all events and appointments.
    • todo: Contains the todo list.
    • notes/: Contains SHA1-hashed note files attached to items.
    • conf: User configuration.
    • keys: User-defined key bindings.
    • hooks/: Scripts for event-based triggers.
    • daemon.log: (Optional) Logs for background daemon activity.
  7. Configure calcurse via the Configuration menu

    pu

    All calcurse parameters can be configured through the Configuration menu. Press C to open the menu, which provides the following submenus:

    • C: Color scheme configuration
    • L: Layout configuration (position of the three panels)
    • G: General options
    • K: Key bindings configuration
    • N: Notify-bar settings
  8. Install and Setup calcurse-caldav

    pu

    calcurse-caldav is a Python script used to synchronize calcurse with a CalDAV server.

    Prerequisites

    1. An up-to-date version of calcurse.
    2. Python 3 with the httplib2 package installed:
      pip3 install --user httplib2
    3. A configuration file located at:
      • $XDG_CONFIG_HOME/calcurse/caldav/config (typically ~/.config/calcurse/caldav/config)
      • Or ~/.calcurse/caldav/config if ~/.calcurse exists.

    An example configuration is available at contrib/caldav/config.sample in the source tree.

    Initializing Synchronization

    On the first run, you must provide the --init argument to define the synchronization mode:

    • --init=keep-remote: Remove all local calcurse items and import remote objects.
    • --init=keep-local: Remove all remote objects and push local calcurse items.
    • --init=two-way: Copy local objects to the CalDAV server and vice versa.

    Subsequent runs do not require additional parameters.

    pip3 install --user httplib2
  9. Configure layout and sidebar width

    pu

    The layout determines the position of the calendar, todo, and appointment panels. Use the L submenu in the Configuration menu to choose from eight different layouts.

    To adjust the width of the sidebar (which contains the calendar and either the todo or appointment list), use the following option:

    • appearance.sidebarwidth (default: 0): Width in percentage (0 is minimum).
  10. Integrate calcurse with vdirsyncer

    pu

    To automate the process of exporting events, synchronizing with remotes via vdirsyncer, and importing the results, use the calcurse-vdirsyncer wrapper script located in the contrib directory.

    Run calcurse-vdirsyncer -h to view available options and detailed usage instructions.

  11. Customize key bindings

    pu

    Key bindings can be redefined in the Keys configuration menu. The default keys follow a vim-like pattern, especially for displacement.

    To define a new binding:

    1. Highlight the action you wish to rebind.
    2. Delete the existing binding if necessary.
    3. Add the new binding by pressing the desired key.

    Supported keys include:

    • Lower-case and upper-case letters/numbers (e.g., a, Z, 0)
    • CONTROL-key combinations
    • escape, horizontal tab, and space
    • Arrow keys (up, down, left, right)
    • HOME and END keys

    Note: Since version 3.0.0, displacement commands can be preceded by a number to repeat the command (e.g., 10k moves the cursor ten weeks forward using default bindings).

  12. Use calcurse in non-interactive mode

    pu

    calcurse can be used in non-interactive mode to print specific information to the terminal and then exit. This is useful for shell scripts or displaying information at login.

    Common non-interactive commands:

    • -a, --appointment: Print appointments and events for the current day.
    • -t, --todo: Print the TODO list. Use -t <priority> (1-9) for specific priorities, or -t 0 for completed tasks.
    • -n, --next: Print the next appointment within the upcoming 24 hours.
    • -r, --range <num>: Print events and appointments for the next num days.
    • -Q, --query: Print all appointments and TODO items within a specified range (use --from and --to to define the range).