KHAL(1)

πŸŽ€ KHAL(1) β€” khal πŸŽ€

✨ NAME ✨

khal β€” khal Documentation

Okay bestie, khal is a calendar program for the terminal for viewing, adding and editing events and calendars. It’s built on the iCalendar and vdir standards (so yes, you can use vdirsyncer(1) for CalDAV compatibility). πŸ’–

🌸 USAGE 🌸

Khal offers a set of commands, most importantly list, calendar, interactive, new, printcalendars, printformats, and search. See below for a description of what every command does.

One thing to know: khal does currently not support any default command, i.e., run a command, even though none has been specified. This is intentional. No cap.

✨ Options ✨

khal (without any commands) has some options to print some information about khal:

  • --version β€” Prints khal’s version number and exits.
  • -h, --help β€” Prints a summary of khal’s options and commands and then exits.

Several options are common to almost all of khal’s commands (exceptions are described below):

  • -v, --verbosity LVL β€” Configure verbosity (e.g. print debugging information). LVL needs to be one of CRITICAL, ERROR, WARNING, INFO, or DEBUG.
  • -l, --logfile LOFILE β€” Use logfile LOGFILE for logging, default is logging to stdout.
  • -c CONFIGFILE β€” Use an alternate configuration file.
  • -a CALENDAR β€” Specify a calendar to use (which must be configured in the configuration file), can be used several times. Calendars not specified will be disregarded for this run.
  • -d CALENDAR β€” Specify a calendar which will be disregarded for this run, can be used several times.
  • --color/--no-color β€” khal will detect if standard output is not a tty, e.g., you redirect khal’s output into a file, and if so remove all highlighting/coloring from its output. Use --color if you want to force highlighting/coloring and --no-color if you want coloring always removed.
  • --format FORMAT β€” For all of khal’s commands that print events, the formatting of that event can be specified with this option. FORMAT is a template string, in which identifiers delimited by curly braces ({}) will be expanded to an event’s properties. FORMAT supports all formatting options offered by python’s str.format() (docs: https://docs.python.org/3/library/string.html#formatstrings) (as it is used internally). The available template options are:
    • title β€” The title of the event.
    • description β€” The description of the event.
    • description-separator β€” A separator: " :: " that appears when there is a description.
    • uid β€” The UID of the event.
    • start β€” The start datetime in datetimeformat.
    • start-long β€” The start datetime in longdatetimeformat.
    • start-date β€” The start date in dateformat.
    • start-date-long β€” The start date in longdateformat.
    • start-time β€” The start time in timeformat.
    • end β€” The end datetime in datetimeformat.
    • end-long β€” The end datetime in longdatetimeformat.
    • end-date β€” The end date in dateformat.
    • end-date-long β€” The end date in longdateformat.
    • end-time β€” The end time in timeformat.
    • repeat-symbol β€” A repeating symbol (loop arrow) if the event is repeating.
    • alarm-symbol β€” An alarm symbol (alarm clock) if the event has at least one alarm.
    • alarms-list β€” A comma-separated list of alarms for the event (e.g., alarm1@-15m, getready@-1h).
    • location β€” The event location.
    • calendar β€” The calendar name.
    • calendar-color β€” Changes the output color to the calendar’s color.
    • start-style β€” The start time in timeformat OR an appropriate symbol.
    • to-style β€” A hyphen "-" or nothing such that it appropriately fits between start-style and end-style.
    • end-style β€” The end time in timeformat OR an appropriate symbol.
    • start-end-time-style β€” A concatenation of start-style, to-style, and end-style OR an appropriate symbol.
    • end-necessary β€” For an allday event this is an empty string unless the end date and start date are different. For a non-allday event this will show the time or the datetime if the event start and end date are different.
    • end-necessary-long β€” Same as end-necessary but uses datelong and datetimelong.
    • status β€” The status of the event (if this event has one), something like CONFIRMED or CANCELLED.
      • status-symbol β€” The status of the event as a symbol, βœ“ or βœ— or ?.
      • partstat-symbol β€” The participation status of the event as a symbol, βœ“ or βœ— or ?.
    • cancelled β€” The string CANCELLED (plus one blank) if the event’s status is cancelled, otherwise nothing.
    • organizer β€” The organizer of the event. If the format has CN then it returns "CN (email)" if CN does not exist it returns just the email string. Example: ORGANIZER;CN=Name Surname:mailto:name@mail.com returns Name Surname (name@mail.com) and if it has no CN attribute it returns the last element after the colon: ORGANIZER;SENT-BY="mailto:toemail@mail.com":mailto:name@mail.com returns name@mail.com
    • url β€” The URL embedded in the event, otherwise nothing.
    • url-separator β€” A separator: " :: " that appears when there is a url.
    • duration β€” The duration of the event in terms of days, hours, months, and seconds (abbreviated to d, h, m, and s respectively).
    • repeat-pattern β€” The raw iCal recurrence rule if the event is repeating.
    • all-day β€” A boolean indicating whether it is an all-day event or not.
    • categories β€” The categories of the event.

By default, all-day events have no times. To see a start and end time anyway simply add -full to the end of any template with start/end or duration, for instance start-time becomes start-time-full and will always show start and end times (instead of being empty for all-day events).

In addition, there are colors: black, red, green, yellow, blue, magenta, cyan, white (and their bold versions: red-bold, etc.). There is also reset, which clears the styling, and bold, which is the normal bold.

A few control codes are exposed. You can access newline (nl), tab, and bell. Control codes, such as nl, are best used with --list mode.

Below is an example command which prints the title and description of all events today.

khal list --format "{title} {description}"
  • --json FIELD ... β€” Works similar to --format, but instead of defining a format string a JSON object is created for each specified field. The matching events are collected into a JSON array. This option accepts the following subset of --format template options:
title, description, uid, start, start-long, start-date,
start-date-long, start-time, end, end-long, end-date,
end-date-long, end-time, start-full, start-long-full,
start-date-full, start-date-long-full, start-time-full,
end-full, end-long-full, end-date-full, end-date-long-full,
end-time-full, repeat-symbol, alarms-list, location, calendar,
calendar-color, start-style, to-style, end-style,
start-end-time-style, end-necessary, end-necessary-long,
status, cancelled, organizer, url, duration, duration-full,
repeat-pattern, all-day, categories

Note that calendar-color will be the actual color name rather than the ANSI color code, and the repeat-symbol, status, and cancelled values will have leading/trailing whitespace stripped. Additionally, if only the special value all is specified then all fields will be enabled.

Below is an example command which prints a JSON list of objects containing the title and description of all events today.

khal list --json title --json description
  • --day-format DAYFORMAT β€” works similar to --format, but for day headings. It only has a few options (in addition to all the color options):
    • date β€” The date in dateformat.
    • date-long β€” The date in longdateformat.
    • name β€” The date’s name (Monday, Tuesday,…) or today or tomorrow.

If the --day-format is passed an empty string then it will not print the day headers (for an empty line pass in a whitespace character).

πŸ¦‹ dates πŸ¦‹

Almost everywhere khal accepts dates, khal should recognize relative date names like today, tomorrow and the names of the days of the week (also in three letters abbreviated form). Week day names get interpreted as the date of the next occurrence of a day with that name. The name of the current day gets interpreted as that date next week (i.e. seven days from now).

If a short datetime format is used (no year is given), khal will interpret the date to be in the future. The inferred it might be in the next year if the given date has already passed in the current year.

πŸ‘‘ Commands πŸ‘‘

🌈 list 🌈

shows all events scheduled for a given date (or datetime) range, with custom formatting:

khal list [-a CALENDAR ... | -d CALENDAR ...]
[--format FORMAT] [--json FIELD ...] [--day-format DAYFORMAT]
[--once] [--notstarted] [START [END | DELTA] ]

Okay so, back to the deets on START and END β€” both can be given as dates, datetimes, or times (and if you only give a time, it’s assumed you mean today, bestie) in the formats configured in the configuration file. If END is not given, midnight of the start date is assumed. Today is used for START if it’s not explicitly given. If DELTA β€” a (date)time range in the format I{m,h,d}, where I is an integer and m means minutes, h means hours, and d means days β€” is given, END is assumed to be START + DELTA. A value of eod is also accepted as DELTA and means the end of day of the start date. In addition, the DELTA week may be used to specify that the daterange should actually be the week containing the START.

The --once option only allows events to appear once even if they are on multiple days. With the --notstarted option only events are shown that start after START.

✨ Some examples ✨

Including or excluding specific calendars:

  • khal list -d soccer will display events, in list form, from every calendar except "soccer."
  • khal list -a soccer will display events, in list form, from only the "soccer" calendar.

Working with date ranges:

  • khal list -a soccer today 30d will show all events in next 30 days (from the "soccer" calendar).
  • khal list 2019-12-01 31d will show all all events for the 31 days following Dec 1, 2019.

πŸ•°οΈ at πŸ•°οΈ

Shows all events scheduled for a given datetime. khal at should be supplied with a date and time, a time (the date is then assumed to be today), or the string now. at defaults to now. The at command works just like the list command, except it has an implicit end time of zero minutes after the start.

khal at [-a CALENDAR ... | -d CALENDAR ...]
[--format FORMAT] [--json FIELD ...]
[--notstarted] [[START DATE] TIME | now]

🌈 calendar 🌈

Shows a calendar (similar to cal(1)) and list. khal calendar should understand the following syntax:

khal calendar [-a CALENDAR ... | -d CALENDAR ...] [START DATETIME]
[END DATETIME]

Date selection works exactly as for khal list. The displayed calendar contains three consecutive months, where the first month is the month containing the first given date. If today is included, it is highlighted. Have a look at khal list for a description of the options.

πŸŽ€ configure πŸŽ€

Will help users creating an initial configuration file. configure will refuse to run if there already is a configuration file.

πŸ¦‹ import πŸ¦‹

Lets the user import .ics files with the following syntax:

khal import [-a CALENDAR] [--batch] [--random-uid|-r] ICSFILE

If an event with the same UID is already present in the (implicitly) selected calendar khal import will ask before updating (i.e. overwriting) that old event with the imported one, unless --batch is given, than it will always update. If this behaviour is not desired, use the --random-uid flag to generate a new, random UID. If no calendar is specified (and not --batch), you will be asked to choose a calendar. You can either enter the number printed behind each calendar's name or any unique prefix of a calendar's name.

πŸ’… interactive πŸ’…

Invokes the interactive version of khal, can also be invoked by calling ikhal. While ikhal can be used entirely with the keyboard, some elements respond if clicked on with a mouse (mostly by being selected).

When the calendar on the left is in focus, you can:

  • move through the calendar (default keybindings are the arrow keys, space and backspace, those keybindings are configurable in the config file)
  • focus on the right column by pressing tab or enter
  • re-focus on the current date, default keybinding t as in today
  • marking a date range, default keybinding v, as in visual, think visual mode in Vim, pressing esc escapes this visual mode
  • if in visual mode, you can select the other end of the currently marked range, default keybinding o as in other (again as in Vim)
  • create a new event on the currently focused day (or date range if a range is selected), default keybinding n as in new
  • search for events, default keybinding /, a pop-up will ask for your search term

When an event list is in focus, you can:

  • view an event's details with pressing enter (or tab) and edit it with pressing enter (or tab) again (if [default] event_view_always_visible is set to True, the event in focus will always be shown in detail)
  • toggle an event's deletion status, default keybinding d as in delete, events marked for deletion will appear with a D in front and will be deleted when khal exits.
  • duplicate the selected event, default keybinding p as in duplicate (d was already taken)
  • export the selected event, default keybinding e

In the event editor, you can:

  • jump to the next (previous) selectable element with pressing tab (shift+tab)
  • quick save, default keybinding meta+enter (meta will probably be alt)
  • use some common editing short cuts in most text fields (ctrl+w deletes word before cursor, ctrl+u (ctrl+k) deletes till the beginning (end) of the line, ctrl+a (ctrl+e) will jump to the beginning (end) of the line
  • in the date and time fields you can increment and decrement the number under the cursor with ctrl+a and ctrl+x (time in 15 minute steps)
  • in the date fields you can access a miniature calendar by pressing enter
  • activate actions by pressing enter on text enclosed by angled brackets, e.g. < Save > (sometimes this might open a pop up)

Pressing esc will cancel the current action and/or take you back to the previously shown pane (i.e. what you see when you open ikhal), if you are at the start pane, ikhal will quit on pressing esc again.

🌸 new 🌸

Allows for adding new events. khal new should understand the following syntax:

khal new [-a CALENDAR] [OPTIONS] [START [END | DELTA] [TIMEZONE] SUMMARY
[:: DESCRIPTION]]

Where start- and enddatetime are either datetimes, times, or keywords and times in the formats defined in the config file. If no calendar is given via -a, the default calendar is used. new does not support -d and also -a may only be used once.

new accepts these combinations for start and endtimes (specifying the end is always optional):

  • datetime [datetime|time] [timezone]
  • time [time] [timezone]
  • date [date]

Where the formats for datetime and time are as follows:

  • datetime = (longdatetimeformat|datetimeformat|keyword-date timeformat)
  • time = timeformat
  • date = (longdateformat|dateformat)

And timezone, which describes the timezone the events start and end time are in, should be a valid Olson DB identifier (like Europe/Berlin or America/New_York. If no timezone is given, the defaulttimezone as configured in the configuration file is used instead.

The exact format of longdatetimeformat, datetimeformat, timeformat, longdateformat and dateformat can be configured in the configuration file. Valid keywords for dates are today, tomorrow, the English name of all seven weekdays and their three letter abbreviations (their next occurrence is used).

If no end is given, the default length of one hour or one day (for all-day events) is used. If only a start time is given the new event is assumed to be starting today. If only a time is given for the event to end on, the event ends on the same day it starts on, unless that would make the event end before it has started, then the next day is used as end date.

If a 24:00 time is configured (timeformat = %H:%M) an end time of 24:00 is accepted as the end of a given date.

If the summary contains the string ::, everything after :: is taken as the description of the new event, i.e., the "body" of the event (and :: will be removed).

Passing the option --interactive (-i <https://docs.python.org/3/using/cmdline.html#cmdoption-i>) makes all arguments optional and interactively prompts for required fields, then the event may be edited, the same way as in the edit command.

✨ Options ✨

  • -l, --location=LOCATION β€” specify where this event will be held.
  • -g, --categories=CATEGORIES β€” specify which categories this event belongs to. Comma separated list of categories. Beware: some servers (e.g. SOGo) do not support multiple categories.
  • -r, --repeat=RRULE β€” specify if and how this event should be recurring. Valid values for RRULE are daily, weekly, monthly and yearly
  • -u, --until=UNTIL β€” specify until when a recurring event should run
  • --url β€” specify the URL element of the event
  • --alarms DURATION,... β€” will add alarm times as DELTAs comma separated for this event, DURATION should look like 1day 10minutes or 1d3H10m, negative DURATIONs will set alarm after the start of the event.

🌸 Examples 🌸

These may need to be adapted for your configuration and/or locale (START and END need to match the format configured). See printformats.

khal new 18:00 Awesome Event

Adds a new event starting today at 18:00 with summary 'awesome event' (lasting for the default time of one hour) to the default calendar

khal new tomorrow 16:30 Coffee Break

Adds a new event tomorrow at 16:30

khal new 25.10. 18:00 24:00 Another Event :: with Alice and Bob

Adds a new event on 25th of October lasting from 18:00 to 24:00 with an additional description

khal new -a work 26.07. Great Event -g meeting -r weekly

Adds a new all day event on 26th of July to the calendar work in the meeting category, which recurs every week.

πŸŽ€ edit πŸŽ€

An interactive command for editing and deleting events using a search string

khal edit [--show-past] event_search_string

The command will loop through all events that match the search string, prompting the user to delete, or change attributes.

πŸ‘‘ printcalendars πŸ‘‘

Prints a list of all configured calendars.

⭐ printformats ⭐

Prints a fixed date (2013-12-21 21:45) in all configured date(time) formats. This is supposed to help check if those formats are configured as intended.

Search for events matching a search string and print them. Currently, search will print one line for every different event in a recurrence set, that is one line for the master event, and one line for every different overwritten event. No advanced search features are currently supported.

The command

khal search party

prints all events matching party.

βš™οΈ CONFIGURATION βš™οΈ

khal reads configuration files in the ini syntax, meaning it understands keys separated from values by a =, while section and subsection names are enclosed by single or double square brackets (like [sectionname] and [[subsectionname]]). Any line beginning with a # will be treated as a comment.

Help with initial configuration 🫢

If you don’t have a config file yet, bestie, running khal configure will launch a small interactive tool that should help you with the initial setup of khal. It’s giving guided-tour energy ✨


Location of configuration file πŸŽ€

khal looks for configuration files in these places, in this order:

  1. $XDG_CONFIG_HOME/khal/config β€” on most systems this is ~/.config/khal/config
  2. ~/.khal/khal.conf β€” deprecated
  3. a file called khal.conf in the current directory β€” deprecated

Alternatively, you can specify exactly which config file to use with -c path/to/config at runtime. Very main-character of you πŸ’…


The [calendars] section 🌈

The [calendars] section is mandatory and must contain at least one subsection. Every subsection needs a unique name, enclosed by two square brackets. Each subsection needs exactly one path setting β€” everything else is optional. Here’s a small example:

[calendars]

  [[home]]
    path = ~/.calendars/home/
    color = dark green
    priority = 20

  [[work]]
    path = ~/.calendars/work/
    readonly = True
    addresses = user@example.com

addresses

All email addresses associated with this account, separated by commas. For now it’s only used to check what participation status ("PARTSTAT") belongs to the user.

  • type β€” list
  • default β€” (blank)

color

khal will use this color for coloring this calendar’s event. These color names are supported: black, white, brown, yellow, dark gray, dark green, dark blue, light gray, light green, light blue, dark magenta, dark cyan, dark red, light magenta, light cyan, light red.

Depending on your terminal emulator’s settings, they might look different than what their name implies β€” no cap, terminal colors are little liars sometimes 😭

On top of the 16 named colors, you can use an index from the 256-color palette or a 24-bit color code, if your terminal supports it. The 256-color palette index is simply a number between 0 and 255. The 24-bit color must be given as #RRGGBB, where RR, GG, BB is the hexadecimal value of the red, green and blue component, respectively. When using a 24-bit color, make sure to enclose the color value in ' or "!

If color is set to auto (the default), khal looks for a color value in a color file in this calendar’s vdir. If the color file does not exist, the default_color (see below) is used. If color is set to '', the default_color is always used. Note that you can use vdirsyncer metasync to synchronize colors with your caldav server.

  • type β€” color
  • default β€” auto

path

The path to an existing directory where this calendar is saved as a vdir. The directory is searched for events or birthdays (see type). The path also accepts glob expansion via * or ? when type is set to discover. ** means arbitrary depths of directories. This allows for paths such as ~/accounts/*/calendars/*, where the calendars directory contains vdir directories. In addition, ~/calendars/* and ~/calendars/default are valid paths if there exists a vdir in the default directory. (The previous behavior of recursively searching directories has been replaced with globbing).

  • type β€” string
  • default β€” None

priority

When coloring days, the color will be determined based on the calendar with the highest priority. If the priorities are equal, then the "multiple" color will be used.

  • type β€” integer
  • default β€” 10

readonly

Setting this to True will keep khal from making any changes to this calendar. Hands off, bestie 🫢

  • type β€” boolean
  • default β€” False

type

Setting the type of this collection (default calendar).

  • If set to calendar (the default), this collection will be used as a standard calendar β€” that is, only files with the .ics extension will be considered, all other files are ignored (except for a possible color file).
  • If set to birthdays, khal will expect a VCARD collection and extract birthdays from those VCARDS β€” that is, only files with .vcf extension will be considered, all other files will be ignored. birthdays also implies readonly=True.
  • If set to discover, khal will use globbing <https://en.wikipedia.org/wiki/Glob_(programming)> to expand this calendar’s path to (possibly) several paths and use those as individual calendars (this cannot be used with birthday collections`). See Exemplary discover usage for an example.
  • If an individual calendar vdir has a color file, the calendar’s color will be set to the one specified in the color file, otherwise the color from the calendars subsection will be used.
  • type β€” option, allowed values are calendar, birthdays and discover
  • default β€” calendar

The [default] section πŸ’–

Some default values and behaviors are set here. This is where the lowkey defaults live πŸŽ€

default_calendar

The calendar to use if none is specified for some operation (e.g. if adding a new event). If this is not set, such operations require an explicit value.

  • type β€” string
  • default β€” None

default_dayevent_alarm

Define the default alarm for new all dayevents, e.g. '12h'.

  • type β€” timedelta
  • default β€” (blank)

default_dayevent_duration

Define the default duration for a day-long event ('khal new' only).

  • type β€” timedelta
  • default β€” 1d

default_event_alarm

Define the default alarm for new events, e.g. '15m'.

  • type β€” timedelta
  • default β€” (blank)

default_event_duration

Define the default duration for an event ('khal new' only).

  • type β€” timedelta
  • default β€” 1h

enable_mouse

Whether the mouse should be enabled in interactive mode ('khal interactive' and 'ikhal' only).

  • type β€” boolean
  • default β€” True

highlight_event_days

If true, khal will highlight days with events. Options for highlighting are in the [highlight_days] section.

  • type β€” boolean
  • default β€” False

After adding a new event, what should be printed to standard out? The whole event in text form, the path to where the event is now saved, or nothing?

  • type β€” option, allowed values are event, path and False
  • default β€” False

show_all_days

By default, khal displays only dates with events in list or calendar view. Setting this to True will show all days, even when there is no event scheduled on that day.

  • type β€” boolean
  • default β€” False

timedelta

Controls for how many days into the future we show events (for example, in khal list) by default.

  • type β€” timedelta
  • default β€” 2d

The [highlight_days] section ✨

When highlight_event_days is enabled, this section specifies how the highlighting/coloring of days is handled.

color

What color to use when highlighting β€” explicit color, or use calendar color when set to ''.

  • type β€” color
  • default β€” (blank)

default_color

Default color for calendars without color β€” when set to '' it actually disables highlighting for events that should use the default color.

  • type β€” color
  • default β€” (blank)

method

Highlighting method to use β€” foreground or background.

  • type β€” option, allowed values are foreground, fg, background and bg
  • default β€” fg

multiple

How to color days with events from multiple calendars β€” either explicit color, or use calendars’ colors when set to ''.

  • type β€” color
  • default β€” (blank)

multiple_on_overflow

When multiple is set to a specific color, setting this to True will cause khal to use that color only for days with events from 3 or more calendars (hence preserving the two-color-highlight for days where all calendar colors can be displayed).

  • type β€” boolean
  • default β€” False

The [keybindings] section πŸ¦‹

Keybindings for ikhal are set here. You can bind more than one key (combination) to a command by supplying a comma-separated list of keys. For binding key combinations, concatenate the keys (with a space in between), e.g. ctrl n.

delete

Delete the currently selected event.

  • type β€” list
  • default β€” d

down

Move the cursor down (in the calendar browser).

  • type β€” list
  • default β€” down, j

duplicate

Duplicate the currently selected event.

  • type β€” list
  • default β€” p

export

Export event as a .ics file.

  • type β€” list
  • default β€” e

external_edit

Edit the currently selected events’ raw .ics file with $EDITOR. Only use this if you know what you are doing β€” the icalendar library we use doesn’t do a lot of validation, it silently disregards most invalid data. Seriously, bestie, this one is not a casual little tap. πŸ’€

  • type β€” list
  • default β€” meta E

left

Move the cursor left (in the calendar browser).

  • type β€” list
  • default β€” left, h, backspace

log

Show logged messages.

  • type β€” list
  • default β€” L

mark

Go into highlight (visual) mode to choose a date range.

  • type β€” list
  • default β€” v

new

Create a new event on the selected date.

  • type β€” list
  • default β€” n

other

In highlight mode, go to the other end of the highlighted date range.

  • type β€” list
  • default β€” o

quit

Quit.

  • type β€” list
  • default β€” q, Q

Move the cursor right (in the calendar browser).

  • type β€” list
  • default β€” right, l, space

save

Save the currently edited event and leave the event editor.

  • type β€” list
  • (the one that was just finishing up above) β€” default: meta enter (yep, that's the trigger, keep it πŸ’«)
  • search β€” pops open a text field so you can go hunt for events. type: list, default: /
  • today β€” yeets the calendar browser's focus straight to today. type: list, default: t
  • up β€” moves the cursor up, but only inside the calendar browser. type: list, default: up, k
  • view β€” shows the details of whatever event is selected right now… or, if the details are already open, lets you edit it. type: list, default: enter

πŸ¦‹ The [locale] section πŸ¦‹

Okay bestie, listen β€” this one has ✨requirements✨. You must set the (long)date-, time-, and datetimeformat options. Everything else in [locale] is optional and comes with sensible defaults already baked in πŸŽ€.

  • dateformat β€” khal will both display and understand all dates in this format. For the format itself, go peek at timeformat.
    • type: string
    • default: %x
  • datetimeformat β€” same deal but for datetimes: khal displays and understands them in this format. Format spec lives under timeformat.
    • type: string
    • default: %c
  • default_timezone β€” this is the timezone that gets used for new events when no timezone is specified, and also when khal just cannot parse the timezone written in the icalendar file 😭. If you don't set a timezone at all, it falls back to whatever timezone your computer is set to.
    • type: timezone
    • default: None
  • firstweekday β€” the first day of your week, where Monday is 0 and Sunday is 6.
    • type: integer, allowed values are between 0 and 6
    • default: 0
  • local_timezone β€” khal shows all times in this timezone. If no timezone is set, the timezone your computer is set to is used instead.
    • type: timezone
    • default: None
  • longdateformat β€” khal displays and understands all dates in this format, and it should contain a year (like %Y). See timeformat for the format deets.
    • type: string
    • default: %x
  • longdatetimeformat β€” khal displays and understands all datetimes in this format, and it should contain a year (like %Y). Again, timeformat has the format info.
    • type: string
    • default: %c
  • timeformat β€” khal displays and understands all times in this format πŸ’….

The formatting string is interpreted exactly as defined by Python's strftime (https://docs.python.org/3/library/time.html#time.strftime), which is similar to the format specified in man strftime.

Heads up: in the config file you might need to wrap the format in quotation marks to force it to be loaded as a string πŸ‘€.

  • type: string
  • default: %X
  • unicode_symbols β€” by default khal uses some unicode symbols (as in 'non-ascii') as indicators for things like repeating events. If your font, encoding, etc. doesn't support those symbols, set this to False and you'll get ascii-based replacements instead 🫢.
    • type: boolean
    • default: True
  • weeknumbers β€” turn on weeknumbers in calendar and interactive (ikhal) mode by saying whether they show up on the 'left' or the 'right'. These are iso weeknumbers, so they'll only work properly if firstweekday is set to 0.
    • type: weeknumbers
    • default: off

🎨 The [palette] section 🎨

This is where you override ikhal's color theme with a custom palette, so you can style individual elements of ikhal exactly how you want them. Iconic behaviour honestly.

Palette entries take the form of key = foreground, background, mono, foreground_high, background_high, where foreground and background are used in "low color mode", foreground_high and background_high are used in "high color mode", and mono is for when only monocolor is supported. If you don't want to set a value for a certain color, use an empty string (''). Valid entries for low color mode are listed on the urwid website (http://urwid.org/manual/displayattributes.html#standard-foreground-colors). For high color mode you can use any valid 24-bit color value, e.g. '#ff0000' 🌈.

⚠️ Note: 24-bit colors must be enclosed in single quotes to be parsed correctly β€” otherwise the # gets interpreted as a comment. Do not skip this, bestie, or your whole vibe gets eaten πŸ’€

Most modern terminals should support high color mode, no cap.

Example entry (particular ugly):

[palette]
header = light red, default, default, '#ff0000', default
edit = '', '', 'bold', '#FF00FF', '#12FF14'
footer = '', '', '', '#121233', '#656599'

See the default palettes in khal/ui/colors.py for all the available keys. And if you literally can't theme an element in ikhal, please open an issue on github (https://github.com/pimutils/khal/issues/new/choose) πŸ™ˆ.


πŸ’Ύ The [sqlite] section πŸ’Ύ

  • path β€” this is where khal stores its internal caching database. By default it lives at $XDG_CACHE_HOME/khal/khal.db (which will most likely be ~/.cache/khal/khal.db).
    • type: string
    • default: None

πŸ‘‘ The [view] section πŸ‘‘

The [view] section holds the config options that affect the visual appearance when you're using khal and ikhal. Main character energy, purely aesthetic ✨.

  • agenda_day_format β€” specifies how each day header is formatted.
    • type: string
    • default: {bold}{name}, {date-long}{reset}
  • agenda_event_format β€” the default formatting for events, used when the user asks for all events in a given time range, and used for list, calendar, and in interactive (ikhal). Please note that any color styling gets ignored in ikhal, where events are always shown in the color of the calendar they belong to. The syntax is the same as for --format.
    • type: string
    • default: {calendar-color}{cancelled}{start-end-time-style}{title}{repeat-symbol}{alarm-symbol}{description-separator}{description}{reset}
  • blank_line_before_day β€” adds a blank line before the name of the day (khal only).
    • type: boolean
    • default: False
  • bold_for_light_color β€” whether to use bold text for light colors or not. Non-bold light colors may not work on all terminals, but they do allow using light background colors.
    • type: boolean
    • default: True
  • dynamic_days β€” defines the behaviour of ikhal's right column. If True, the right column shows events for as many days as fit, and moving the cursor through the list will also select the appropriate day in the calendar column on the left. If False, only a fixed ([default] timedelta) amount of days' events are shown, and moving through events will not change the focus in the left column.
    • type: boolean
    • default: True
  • event_format β€” the default formatting for events used when the start- and end-date aren't clear through context, e.g. for search, and used almost everywhere except list and calendar. So it's probably a sensible choice to include the start- and end-date. The syntax is the same as for --format.
    • type: string
    • default: {calendar-color}{cancelled}{start}-{end} {title}{repeat-symbol}{alarm-symbol}{description-separator}{description}{reset}
  • event_view_always_visible β€” set to true to always show the event view window when you're looking at the event list.
    • type: boolean
    • default: False
  • event_view_weighting β€” the weighting that gets applied to the event view window.
    • type: integer
    • default: 1
  • frame β€” whether to show a visible frame (with box drawing characters) around some (groups of) elements or not. There are currently several different frame options available, and they should visually differentiate whether an element is in focus or not. Some of them will probably get removed in future releases of khal, so please try them out and give feedback on which style you prefer (the color of all variants can be defined in the color themes) 🧚.
    • type: option, allowed values are False, width, color and top
    • default: False
  • min_calendar_display β€” minimum number of months displayed by the calendar command. Default is 3 months.
    • type: integer
    • default: 3
  • monthdisplay β€” display the month name on the row when the week contains the first day of the month ('firstday'), or when the first day of the week is in the month ('firstfullweek').
    • type: monthdisplay
    • default: firstday
  • theme β€” choose a color theme for khal.

Khal ships with two color themes, dark and light. Additionally, plugins might supply different color schemes. You can also define your own color theme in the [palette] section πŸŽ€.

  • type: string
  • default: dark

A minimal sample configuration could look like this:

πŸ“ Example

[calendars]
[[home]]
path = ~/.calendars/home/

[[work]]
path = ~/.calendars/work/

[locale]
local_timezone= Europe/Berlin
default_timezone= Europe/Berlin
timeformat= %H:%M
dateformat= %d.%m.
longdateformat= %d.%m.%Y
datetimeformat= %d.%m. %H:%M
longdatetimeformat= %d.%m.%Y %H:%M

πŸ” Exemplary discover usage

If you have the following directory layout:

~/calendars
β”œ- work/
β”œ- home/
└─ family/

where work, home and family are all different vdirs, each containing one calendar, then a matching calendar section could look like this:

[[calendars]]
path = ~/calendars/*
type = discover
color = dark green

πŸ”„ Syncing

To get khal working with CalDAV you'll first need to set up vdirsyncer (https://github.com/pimutils/vdirsyncer). After each start, khal will automatically check if anything has changed and automatically update its caching db β€” and yes, this may take some time after the initial sync, especially for large calendar collections 😭. Because of that, you might want to execute khal automatically after syncing with vdirsyncer (e.g. via cron).

πŸ¦‹ RDATE;VALUE=PERIOD πŸ¦‹

Okay so RDATEs that come with PERIOD values? Not supported rn, bestie 😭 and it's not even khal's fault β€” it's because icalendar (https://github.com/collective/icalendar) doesn't support it yet. So if you have any real-world examples of events with RDATE;VALUE=PERIOD lying around, please submit them! khal will literally print warnings at you if you've got any of those hanging out in your calendars, so you'll know. πŸ’…


🚫 RANGE=THISANDPRIOR 🚫

Recurrent events with RANGE=THISANDPRIOR are not supported by khal, and will not be [1] supported, because apps that follow the latest standard (http://tools.ietf.org/html/rfc5546) MUST NOT create those in the first place. If khal bumps into an event containing RANGE=THISANDPRIOR, it'll print a warning at you. ⚠️

[1] unless a lot of users request this feature β€” like, a LOT lot. 🫢


🌸 Events with neither END nor DURATION 🌸

So the RFC is out here saying:

A calendar entry with a "DTSTART" property but no "DTEND" property does not take up any time. It is intended to represent an event that is associated with a given calendar date and time of day, such as an anniversary. Since the event does not take up any time, it MUST NOT be used to record busy time no matter what the value for the "TRANSP" property.

…and khal is like "cute, anyway" and transforms those events into all-day events lasting for one day (the start date). As long as those events don't get edited, these changes will not be written to the vdir (and with that, not to the CalDAV server). Any timezone information that was associated with the start date gets discarded. πŸ—‘οΈ

Note: the main rationale for this behaviour was laziness on the part of khal's main author 😭 but honestly other calendar software does the exact same thing (e.g. Google Calendar and Evolution), so it's giving "we all agreed to be like this." πŸ’€

🌈 Timezones 🌈

Getting localized time right seems to be the most difficult part about calendaring (and messing it up ends in missing the one important meeting of the week β€” the horror 😭). So I'll briefly describe here how khal tries to handle timezone information, which information it can handle, and which it can't.

In general there are two different types of events:

  • Localized events β€” with localized start and end datetimes, which have timezone information attached to their start and end datetimes.
  • Floating events β€” with floating start and end datetimes, which have no timezone information attached (all-day events, and events that last for complete days, are floating as well).

Localized events are always observed at the same UTC (https://en.wikipedia.org/wiki/Coordinated_Universal_Time) β€” no matter what time zone the observer is in β€” but at different local times. On the other hand, floating events are always observed at the same local time, which might be different in UTC. Make it make sense, I know. πŸŒ€

In khal, all localized datetimes are saved to the local database as UTC. Datetimes that are already UTC, e.g. 19980119T070000Z, are saved as such, and others are converted to UTC (but don't worry, the timezone information does not get lost πŸ’–). Floating events get saved in floating time, independently of the localized events.

If you want to look up which events take place at a specified datetime, khal always expects that you want to know what events take place at that local datetime. So the (local) datetime you asked for gets converted to UTC, the appropriate localized events get selected, and they're presented with their start and end datetimes converted to your local datetime. For floating events, no conversion is necessary. ✨

Khal (i.e. icalendar β€” https://github.com/collective/icalendar) can understand all timezone identifiers as used in the Olson DB (https://en.wikipedia.org/wiki/Tz_database) and custom timezone definitions β€” if those VTIMEZONE components are placed before the VEVENTS that make use of them (as most calendar programs seem to do). In case an unknown (or unsupported) timezone is found, khal will assume you want that event to be placed in the default timezone (which can be configured in the configuration file as well πŸ‘€).

khal expects you always want all start and end datetimes displayed in local time (which can be set in the configuration file as well β€” otherwise your computer's timezone is used). πŸ•°οΈ


πŸ’– FAQ πŸ’–

Frequently asked questions, bestie:

  • Installation stops with an error: source/str_util.c:25:20: fatal error: Python.h: No such file or directory
    • You do not have the Python development headers installed. On Debian based Distributions you can install them via aptitude install python-dev. Slay, fixed. πŸŽ€
  • unknown key "default_command"

πŸ‘‘ LICENSE πŸ‘‘

khal is released under the Expat/MIT License:

Copyright (c) 2013-2022 khal contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

🌟 Author 🌟

Christan Geier et al. β€” icons, the lot of them. πŸ‘‘

Copyright (c) 2013-2022 khal contributors


Okay that's the whole page, you made it to the end!! πŸŽ‰ This beauty is khal 0.14.1, dated Aug 21, 2026 β€” go forth and never miss a meeting again, fr fr. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from