Caldav Calendar
2026-03-24
新闻来源:网淘吧
围观:63
电脑广告
手机广告
购买adidas上京东官方旗舰店。
CalDAV日历 (vdirsyncer + khal)
vdirsyncer将CalDAV日历同步至本地.ics文件khal负责读取和写入这些文件
同步优先
查询前或修改后务必先执行同步:
上网淘巴领天猫淘宝优惠券,一年省好几千。vdirsyncer sync
查看日程
khal list # 今日
khal list today 7d # 未来7天
khal list tomorrow # 明日
khal list 2026-01-15 2026-01-20 # 日期范围
khal list -a Work today # 指定日历
搜索
khal search "会议"
khal search "牙医" --format "{start-date} {title}"
创建日程
khal new 2026-01-15 10:00 11:00 "会议标题"
khal new 2026-01-15 "全天事项"
khal new tomorrow 14:00 15:30 "通话" -a Work
khal new 2026-01-15 10:00 11:00 "含备注" :: 此处填写描述内容
创建后需同步以推送变更:
vdirsyncer sync
编辑日程(交互模式)
khal edit为交互式命令——需在TTY终端运行。自动化操作建议搭配tmux:
khal edit "搜索词"
khal edit -a 日历名称 "搜索词"
khal edit --show-past "历史日程"
菜单选项:
s→ 编辑摘要d→ 编辑描述t→ 编辑日期时间范围l→ 编辑地点D→ 删除事件n→ 跳过(保存更改,下一个匹配项)q→ 退出
编辑后,同步:
vdirsyncer sync
删除事件
使用khal edit,然后按D以删除。
输出格式
用于脚本:
khal list --format "{start-date} {start-time}-{end-time} {title}" today 7d
khal list --format "{uid} | {title} | {calendar}" today
占位符:{标题},{描述},{开始},{结束},{开始日期},{开始时间},{结束日期},{结束时间},{地点},{日历},{唯一标识符}
缓存
khal 在~/.local/share/khal/khal.db如果同步后数据看起来陈旧:
rm ~/.local/share/khal/khal.db
初始设置
1. 配置 vdirsyncer (~/.config/vdirsyncer/config)
iCloud 示例:
[general]
status_path = "~/.local/share/vdirsyncer/status/"
[pair icloud_calendar]
a = "icloud_remote"
b = "icloud_local"
collections = ["from a", "from b"]
conflict_resolution = "a wins"
[storage icloud_remote]
type = "caldav"
url = "https://caldav.icloud.com/"
username = "your@icloud.com"
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]
[storage icloud_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"
服务提供商 URL:
- iCloud:
https://caldav.icloud.com/ - Google:使用
google_calendar存储类型 - Fastmail:
https://caldav.fastmail.com/dav/calendars/user/EMAIL/ - Nextcloud:
https://YOUR.CLOUD/remote.php/dav/calendars/USERNAME/
2. 配置 khal (~/.config/khal/config)
[calendars]
[[my_calendars]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover
[default]
default_calendar = Home
highlight_event_days = True
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
3. 发现与同步
vdirsyncer discover # 仅首次需要
vdirsyncer sync文章底部电脑广告
手机广告位-内容正文底部
上一篇:Docker Essentials
下一篇:Session-logs


微信扫一扫,打赏作者吧~