A minimalistic calendar. It prints the most recent event in your list joined with the time difference from now (e.g. "Event in 20 min"). Intended for use in a bar.
- You need cargo. If you don't have it installed already you can do so by following the steps from The Cargo Book
- Run
cargo install --git https://github.com/DEVensiv/bar_calendar --branch main
to build the crate in a temporary target directory before installing the binaries in your cargo installation'sbin
folder. For more information check out the cargo install Book entry - Alternatively to 2. you can clone the repository move into
bar_calendar/
in order to runcargo install --path .
. This has the same effect as 2. but you are not building in a temporary target directory
You can update your installation by re running the cargo install command. (or pulling changes before if you went with 3.)
- Create a config file in your systems config directory
<your_config_dir>/bar_calendar/config.conf
(you can use different file locations by giving the path as command line argument to the program) - Start listing your events in the config file from step 1.
- Set up your bar to periodically run
bar_calendar
to update its block
Add following block to your config.toml
[[block]]
block = "custom"
command = "bar_calendar"
json = true
interval = 60
Platform | Value | Example |
---|---|---|
Linux | $XDG_CONFIG_HOME or $HOME/.config | /home/alice/.config |
macOS | $HOME/Library/Application Support | /Users/Alice/Library/Application Support |
Windows | {FOLDERID_RoamingAppData} | C:\Users\Alice\AppData\Roaming |
In the config file every line represents an event. The lines have to be formatted as one of the following:
%:z %Y "m" %b %d %R <Label> [<Duration>]
or (e.g.+02:00 2021 m Jun 27 12:00 Example1 m10
)%:z %Y "w" %W %a %R <Label> [<Duration>]
(e.g.+02:00 2021 w 05 Mon 21:00 Example2 h1
)- Lines starting with
#
as well as empty lines are ignored in the parsing of events.
% specifier |
Example | Description | Wildcard options |
---|---|---|---|
%:z |
+02+00 , +00:00 |
Time zone offset from UTC (+00:00 is UTC) | Wildcards are not allowed for the timezone |
%Y |
2020 , 2021 , * |
The full proleptic Gregorian year, zero-padded to 4 digits | Can be * -> every year |
%b |
Jan , Dec , * |
Abbreviated month name. 3 letters. | Can be * -> every month |
%d |
01 , 24 , * |
Day number (01--31), zero-padded to 2 digits. | Can be * -> every day of the month |
%W |
01 , 15 , * |
Calendar week (week starting with Monday) | Can be * -> every week of the year |
%a |
Mon , Fri , * |
Abbreviated weekday name. 3 letters. | Can be * -> every day of the week |
%R |
03:00 , 17:30 , *:30 , 12:* |
24 hour-minute format | Hour part can be * -> every hour of the day at given minute,Minute part can be * -> every minute of the hour,Both can be * (*:* ) -> every minute of the day |
Duration info is provided as follows: <Fmt><Num>
(e.g. s10 -> 10 seconds) where is one of s, m, h, d
and num any positive integer (32 bit uint)
Fmt | Meaning |
---|---|
s | Seconds |
m | Minutes |
h | Hours |
d | Days |
All parts are separated by any amount/type of whitespace you want to use -> you can format your config file to look organized using tabs and spaces.
You decide whether the date you put in is parsed in 1. "month_mode" or 2. "week_mode" by setting the 3rd parameter either to 1.m
or 2.w
which changes the parsing pattern as shown above.
You may combine any number of wildcard options with each other.
+02:00 2021 m Jun * 19:00 daily
-> every day of June at 19:00 in 2021 (no duration defaults to 0 seconds)+02:00 * m Jun * 19:00 daily m10
-> every day of June at 19:00 each year (for 10 minutes)+02:00 * m * * 19:00 daily h3
-> every day at 19:00 of every month each year (for 3h)
Usage: bar_calendar [path] [options]
--version
Prints the current version of the program and a link to this repo. Using --version bypasses the normal functionality of the program and the version info will be the only output generated.
--json
Provides output in json format (default) (e.g. {"icon": "calendar", "state": "Idle", "text": "Eventname in 20 min"})
)
--no-json
Outputs only the event text part (e.g. Eventname in 20 min
)
<path>
Path to an alternative config file
bar_calendar ~/.config/bar_calendar/alternative_config.conf --no-json
usesalternative.conf
and outputs only the text partbar_calendar --json
outputs the most recent event in json format (this is the default)bar_calendar --no-json
outputs only the text part, uses the default config
In case you want to uninstall the bar_calendar you can
- Run
cargo uninstall bar_calendar
to remove the program - In case you installed
cargo
(with rustup) just for this program and want to uninstall it too you can do so by runningrustup self uninstall
which will uninstallrustup
and all its components.