i3-blocks-go/README.md

231 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2022-08-29 10:57:28 +02:00
# I3 Blocks
Blocks compatible with [i3blocks](https://github.com/vivien/i3blocks).
## Requirements
2022-08-30 13:33:58 +02:00
* `go` for compilation
2022-08-30 16:29:53 +02:00
* `sudo` and `wg-quick` for `wireguard` block
2022-08-29 10:57:28 +02:00
* `tmux` for `app` and `date` blocks
* `df` for `du` block
* `xdg-open` for `du` block
2022-08-29 19:57:44 +02:00
* `playerctl` for `spotify` block
2022-08-29 10:57:28 +02:00
## Installation
### From binaries
2022-08-29 20:13:00 +02:00
Get binaries from [releases](https://gitnet.fr/deblan/i3-blocks-go/releases).
2022-08-29 10:57:28 +02:00
### From sources
```
git clone https://gitnet.fr/deblan/i3-blocks-go.git
cd i3-blocks-go
make
```
## Usage
2022-08-30 16:29:53 +02:00
Each binary has a help, eg `./app -h`.
### App
2022-08-29 10:57:28 +02:00
Add the shortcut `<name>` and run `<command>` when clicked.
```
2022-08-30 19:47:54 +02:00
[app_otp]
command=/path/to/app -block=app_otp -name=🔐 -bg-color='#363636' -fg-color='#ffc337' -cmd=otpclient
format=json
markup=pango
interval=1000
[app_flameshot]
command=/path/to/app -block=app_flameshot -name=F -bg-color='#bf007e' -fg-color='#fff' -cmd="flameshot gui --delay 500"
format=json
markup=pango
interval=1000
[app_ksnip]
command=/path/to/app -block=app_youtube -name=Y -bg-color='#c74a42' -fg-color='#fff' -cmd="xdg-open https://www.youtube.com/"
format=json
markup=pango
interval=1000
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### Date
2022-09-02 16:31:25 +02:00
Show the time using the given format.
2022-08-29 10:57:28 +02:00
```
2022-08-30 19:47:54 +02:00
[time]
command=/home/simon/www/repo/i3-blocks-go/build/date -format="%H:%M:%S %d/%m/%Y"
format=json
markup=pango
interval=persist
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### Disk usage
2022-08-29 10:57:28 +02:00
Show mount point usage and warns with limits and colors.
```
2022-08-30 19:47:54 +02:00
[du_root]
command=/path/to/du -block=du_root -mount-point=/ -name=root -limit-warning=70 -limit-danger=90
format=json
markup=pango
interval=30
[du_home]
command=/path/to/du -block=du_home -mount-point=/home -name=home -limit-warning=90 -limit-danger=95
format=json
markup=pango
interval=30
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### IP
2022-08-29 10:57:28 +02:00
Show the IP of the given iface.
```
2022-08-30 19:47:54 +02:00
[ip_wg0_ip4]
command=/path/to/ip -iface=wg0 -version=ip4 -name=VPN
format=json
markup=pango
interval=3
[ip_eth0_ip4]
command=/path/to/ip -iface=eth0 -version=ip4 -name=Foo
format=json
markup=pango
interval=3
[ip_eth0_ip6]
command=/path/to/ip -iface=eth0 -version=ip4 -name=Bar
format=json
markup=pango
interval=3
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### IP (wan)
2022-08-29 10:57:28 +02:00
Show the public IP.
```
2022-08-30 19:47:54 +02:00
[ip_wan]
2022-08-30 16:29:53 +02:00
command=/path/to/ip_wan
2022-08-30 19:47:54 +02:00
format=json
markup=pango
interval=100
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### Prusa telemetry
2022-08-29 10:57:28 +02:00
Show the telemetry using Prusa Printer API.
```
2022-08-30 19:47:54 +02:00
[prusa]
2022-08-30 16:29:53 +02:00
command=/path/to/prusa_telemetry -api=http://1.2.3.4/api/telemetry
2022-08-30 19:47:54 +02:00
format=json
markup=pango
interval=60
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### Process
2022-08-30 13:33:58 +02:00
Show a message when the given process is running (use `preg -f`).
```
2022-08-30 19:47:54 +02:00
[ps]
command=/path/to/ps -process=foo -message="Foo is running"
format=json
markup=pango
interval=3
2022-08-30 13:33:58 +02:00
```
2022-08-30 16:29:53 +02:00
### Feed indicator
2022-08-29 10:57:28 +02:00
Show indicator of RSS.
```
2022-08-30 19:47:54 +02:00
[rss_foo]
command=/path/to/rss -block=rss_foo -feed="https://foo.example.com/feed.xml" -website="https://foo.example.com/" -empty-color="#CCCCCC" -non-empty-color="#B3FF6C"
align=left
interval=30
format=json
markup=pango
[rss_bar]
command=/path/to/rss -block=rss_bar -feed="https://bar.example.com/atom.xml" -website="https://bar.example.com/" -empty-color="#aabfc1" -non-empty-color="#00d8f0"
align=left
interval=30
format=json
markup=pango
2022-08-29 10:57:28 +02:00
```
2022-08-30 16:29:53 +02:00
### Spotify status
2022-08-29 19:57:44 +02:00
Show current song played (spotify).
```
2022-08-30 19:47:54 +02:00
[spotify]
2022-08-30 16:29:53 +02:00
command=/path/to/spotify
2022-08-30 19:47:54 +02:00
format=json
markup=pango
interval=3
2022-08-29 19:57:44 +02:00
```
2022-08-30 16:29:53 +02:00
### Volume
2022-08-29 13:44:34 +02:00
Show volume.
```
2022-08-30 19:47:54 +02:00
[volume]
command=/path/to/volume -channel=Master
format=json
markup=pango
interval=1
2022-08-29 13:44:34 +02:00
```
2022-09-02 16:58:51 +02:00
### Weather
Show the weather of the given location ([https://fr.wttr.in/](https://fr.wttr.in/)).
```
[weather]
command=/path/to/weather -loc=Paris -lang=fr
format=json
markup=pango
interval=1800
```
2022-08-30 16:29:53 +02:00
### Wireguard toggler
2022-08-29 10:57:28 +02:00
Toggler for wireguard.
```
2022-08-30 19:47:54 +02:00
[wireguard_wg0]
command=/path/to/wireguard -iface=wg0 -name=Foo
format=json
markup=pango
interval=2
[wireguard_wg1]
command=/path/to/wireguard -iface=wg1 -name=Bar
format=json
markup=pango
interval=2
2022-08-29 10:57:28 +02:00
```
2022-08-29 16:06:13 +02:00
2022-09-02 16:58:51 +02:00
### Workspace Apps (task bar)
2022-08-30 16:29:53 +02:00
Add blocks that represent opened apps and create a task bar.
2022-08-29 16:06:13 +02:00
```
[workspace_apps]
command=/path/to/workspace_apps -x=$relative_x
2022-08-30 16:29:53 +02:00
format=json
markup=pango
interval=1
2022-08-29 16:06:13 +02:00
```