Skip to content

Commit 4f4c6bd

Browse files
committed
DOCS: Zellij-Example
1 parent 5954384 commit 4f4c6bd

File tree

2 files changed

+66
-20
lines changed

2 files changed

+66
-20
lines changed

README.md

+66-20
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22
[<img alt="crates.io" src="https://img.shields.io/crates/v/zentime-rs.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/zentime-rs)
33
[<img alt="docs.rs" src="https://img.shields.io/docsrs/zentime-rs/latest?style=for-the-badge&logo=docs.rs" height="20">](https://docs.rs/zentime-rs/latest/zentime_rs/)
44

5-
6-
75
# TOC
86

9-
- [TOC](#toc)
10-
- [Features](#features)
11-
- [Example with multiple clients + display inside the left status bar of tmux](#example-with-multiple-clients--display-inside-the-left-status-bar-of-tmux)
12-
- [Installation](#installation)
13-
- [Homebrew](#homebrew)
14-
- [Cargo](#cargo)
15-
- [Nix](#nix)
16-
- [Configuration](#configuration)
17-
- [Logs](#logs)
18-
- [Tmux integration example](#tmux-integration-example)
19-
- [Usage as library](#usage-as-library)
7+
- [TOC](#toc)
8+
- [Features](#features)
9+
- [Example with multiple clients + display inside the left status bar of tmux](#example-with-multiple-clients--display-inside-the-left-status-bar-of-tmux)
10+
- [Installation](#installation)
11+
- [Homebrew](#homebrew)
12+
- [Cargo](#cargo)
13+
- [Nix](#nix)
14+
- [Configuration](#configuration)
15+
- [Logs](#logs)
16+
- [Zellij integration example](#zellij-integration-example)
17+
- [Tmux integration example](#tmux-integration-example)
18+
- [Usage as library](#usage-as-library)
2019

2120
A simple terminal based pomodoro/productivity timer written in Rust.
2221

2322
## Features
2423

25-
* Timer suited for the pomodoro technique
26-
* Socket-based Client/Server-Architecture, where multiple clients can attach to a single timer server
27-
* Server is terminal independent and runs as a daemon
28-
* TUI-interface with keymaps + and a minimal TUI-interface
29-
* CLI commands to interact with the timer without attaching a client (e.g. for integration into tools such as tmux)
24+
- Timer suited for the pomodoro technique
25+
- Socket-based Client/Server-Architecture, where multiple clients can attach to a single timer server
26+
- Server is terminal independent and runs as a daemon
27+
- TUI-interface with keymaps + and a minimal TUI-interface
28+
- CLI commands to interact with the timer without attaching a client (e.g. for integration into tools such as tmux)
3029

3130
### Example with multiple clients + display inside the left status bar of tmux
3231

@@ -66,13 +65,60 @@ clicking on the type inside the docs shows you the available configuration field
6665

6766
Logs are being written to:
6867

69-
* `/tmp/zentime.d.err` - this captures any panics
70-
* `/tmp/zentime.d.out` - this captures error/warn/info etc. logs
68+
- `/tmp/zentime.d.err` - this captures any panics
69+
- `/tmp/zentime.d.out` - this captures error/warn/info etc. logs
7170

7271
The default log level is `warn`.
7372
You can configure the log level by running zentime with `RUST_LOG=<level> zentime`.
7473
Here's an overview of [available log levels](https://docs.rs/log/0.4.17/log/enum.Level.html).
7574

75+
## Zellij integration example
76+
77+
I've found that currently the easiest way to get some integration with zentime into zellij, is to create a custom layout and also create some shell aliases.
78+
79+
For example you could use the following layout as base for a 'zellij-zentime'-layout:
80+
81+
```kdl
82+
layout {
83+
pane split_direction="vertical" size=1 {
84+
pane {
85+
size 30
86+
borderless true
87+
name "zentime"
88+
command "zentime"
89+
}
90+
pane borderless=true {
91+
plugin location="zellij:tab-bar"
92+
}
93+
}
94+
}
95+
```
96+
97+
![](./assets/zellij-layout-screenshot.png)
98+
99+
You might need to adjust the size of the zentime pane depending on the terminal font you are using.
100+
101+
> WARNING:
102+
> There currently is no way to isolate regular panes in zellij from the tab-sync mechanism.
103+
> (Only plugin panes are currently isolated)
104+
> This means that you might accidentally change your timer, when you use tab-sync mode.
105+
> I already created a [feature request](https://github.com/zellij-org/zellij/issues/2285) to create isolated panes and am planning to contribute and create a PR if the maintainer is fine with that.
106+
107+
> NOTE: I actually wanted to write a plugin for zellij. However unfortunately this is currently not that easy for
108+
> two reasons:
109+
>
110+
> 1. The zellij plugin system is currently being rebuilt and it doesn't really make sense to built a "legacy"-plugin right now
111+
> 2. Our zentime client library code makes use of a lot of async code, which does not yet compile to WASI
112+
113+
Because zellij also does not yet allow arbitary commands to be configured with keyboard shortcuts,
114+
you basically have three options to interact with zentime:
115+
116+
1. Just manually switch to the pane and use our regular zentime shortcuts
117+
2. Manually run commands/trigger another zentime client inside the pane you are working in anyway right now
118+
3. **Recommnded**: (This is basically just an alteration of 2. -> Create bash/zsh/<your-shell> aliases for commands like `zentime skip`, `zentime toggle-timer` etc.
119+
120+
If you go the third route I would recommend to prefix each command with `-s` (`--silent`) as you probably are not interested in the minor output zentime gives you under these circumstances.
121+
76122
## Tmux integration example
77123

78124
To display the current timer state inside the tmux status bar you could use `zentime once` which will be queried by tmux on each status bar update.

assets/zellij-layout-screenshot.png

21.5 KB
Loading

0 commit comments

Comments
 (0)