|
1 | 1 | # Status bar customisation |
2 | 2 |
|
3 | | -## Setting the status |
| 3 | +instantWM displays a status bar at the bottom of each monitor. The status text is configured via the TOML configuration file. |
4 | 4 |
|
5 | | -Setting the status in instantWM works the same as for dwm. |
| 5 | +## Configuration |
6 | 6 |
|
7 | | -```sh |
8 | | -xsetroot -name "status text" |
9 | | -``` |
10 | | - |
11 | | -instantOS ships with its own status text generator. If you want to set your own |
12 | | -status text you first need to disable the built in solution. This can be done |
13 | | -in Settings->instantOS->Status bar |
| 7 | +Configure the status bar by setting `status_command` in your config: |
14 | 8 |
|
15 | | -::: details Planned status bar program |
16 | | -It is planned to create a statusbar similar to dwmblocks that can run |
17 | | -different status scripts at different intervals and then generates a |
18 | | -complete status text that can be used by the window manager. It will |
19 | | -however not be based on dwmblocks and will have a lot more features. |
20 | | -dwmblocks is not used because it lacks some crucial features to make it |
21 | | -work with the featureset of instantWM |
22 | | - |
23 | | -### Runtime configuration |
| 9 | +```toml |
| 10 | +status_command = "i3status-rs" |
| 11 | +``` |
24 | 12 |
|
25 | | -Customizing the status bar will not require recompiling it. Instead it will have a config file using the toml format |
| 13 | +This spawns an external command that outputs status text. The command should write to stdout. |
26 | 14 |
|
27 | | -### Markup |
| 15 | +### Default Status |
28 | 16 |
|
29 | | -The status bar will automatically add markup to status widgets to separate |
30 | | -them from each other. Widgets can however also communicate with the bar to |
31 | | -for example change their color on runtime. |
| 17 | +If no `status_command` is configured, instantWM displays a default status showing the version and current time: |
32 | 18 |
|
33 | | -### Validation |
| 19 | +``` |
| 20 | +instantwm-VERSION HH:MM |
| 21 | +``` |
34 | 22 |
|
35 | | -The markup parser currently in use in instantWM will crash the entire window |
36 | | -manager if there is an error in the markup syntax. The planned status bar will |
37 | | -perform validation on all config and status text so it is impossible to |
38 | | -configure it in a way that will crash the window manager. |
| 23 | +The status updates every 30 seconds. |
39 | 24 |
|
40 | | -### Rust |
| 25 | +### Manual Status Updates |
41 | 26 |
|
42 | | -Following [imosid](https://github.com/instantOS/imosid) this will be the second instantOS project written in rust |
| 27 | +You can update the status bar programmatically using `instantwmctl`: |
43 | 28 |
|
44 | | -### Progress |
| 29 | +```bash |
| 30 | +instantwmctl update-status "My custom status" |
| 31 | +``` |
45 | 32 |
|
46 | | -At the moment this is **all just plans**, no code for the status bar has |
47 | | -been written yet as development is still focused on making the operating |
48 | | -system more stable before piling on even more features |
| 33 | +Or using the socket API directly. |
49 | 34 |
|
50 | | -::: |
| 35 | +## i3bar JSON Protocol |
51 | 36 |
|
52 | | -## Styling |
| 37 | +instantWM uses the i3bar JSON protocol for status text. This is compatible with i3status, i3status-rs, and other i3bar-compatible programs. |
53 | 38 |
|
| 39 | +The status command outputs JSON blocks: |
54 | 40 |
|
55 | | -The appearance of text in the status bar can be changed by using special markup |
56 | | -syntax. The markup parser of instantWM is based on the |
57 | | -[status-2d](https://dwm.suckless.org/patches/status2d/) patch for dwm. |
| 41 | +```json |
| 42 | +[{"full_text": "CPU: 12%", "color": "#ffffff"}, {"full_text": "Memory: 4.2GiB", "color": "#ffffff"}] |
| 43 | +``` |
58 | 44 |
|
59 | | -All Markup commands have the following format |
60 | | -```txt |
61 | | -^commandnamecommandargument^ |
| 45 | +Each block can include: |
| 46 | +- `full_text` - Main text to display |
| 47 | +- `short_text` - Short version for constrained spaces |
| 48 | +- `color` - Text color (hex format: "#RRGGBB") |
| 49 | +- `background` - Background color |
| 50 | +- `border` - Border color |
| 51 | +- `border_top`, `border_right`, `border_bottom`, `border_left` - Border widths |
| 52 | +- `min_width` - Minimum width (string or number) |
| 53 | +- `align` - Text alignment ("left", "center", "right") |
| 54 | +- `urgent` - Mark block as urgent (swaps colors) |
| 55 | +- `separator` - Show separator after block |
| 56 | +- `separator_block_width` - Width of separator |
| 57 | +- `name` - Block identifier for click events |
| 58 | +- `instance` - Block instance for click events |
| 59 | +- `markup` - Markup format ("pango") |
| 60 | + |
| 61 | +### Example i3status-rs Config |
| 62 | + |
| 63 | +```toml |
| 64 | +# ~/.config/i3status-rs/config.toml |
| 65 | +[[block]] |
| 66 | +block = "cpu" |
| 67 | +interval = 1 |
| 68 | + |
| 69 | +[[block]] |
| 70 | +block = "memory" |
| 71 | +interval = 10 |
| 72 | + |
| 73 | +[[block]] |
| 74 | +block = "time" |
| 75 | +format = "%H:%M" |
| 76 | +interval = 30 |
62 | 77 | ``` |
63 | 78 |
|
64 | | -They have a "\^" as suffix and prefix. The opening caret is immediately followed |
65 | | -by the command name which is then (without a separator) followed by the |
66 | | -argument. |
| 79 | +## Clickable Status Bar |
67 | 80 |
|
| 81 | +You can make status blocks interactive by enabling click events in your status command. |
68 | 82 |
|
69 | | -### Colors |
| 83 | +The status command should output this header first: |
70 | 84 |
|
71 | | -```txt |
72 | | -^c#ff0000^ this text have a red background ^d^ this text will have the default background color |
73 | | -^t#ff0000^ this text have a red foreground ^d^ this text will have the default background color |
| 85 | +```json |
| 86 | +{"version": 1, "click_events": true} |
74 | 87 | ``` |
75 | 88 |
|
76 | | -### Offsets |
77 | | - |
78 | | -```txt |
79 | | -^f11^there will be an 11px gap in front of this text |
80 | | -``` |
81 | | -### Reset |
| 89 | +instantWM will then send click events to the status command's stdin when blocks are clicked. |
82 | 90 |
|
83 | | -```txt |
84 | | -^d^text after this is reset to the default styling |
85 | | -``` |
| 91 | +## Styling |
86 | 92 |
|
87 | | -## Icons |
| 93 | +Configure status bar colors in your TOML config under `[colors.status]`: |
88 | 94 |
|
89 | | -// TODO |
| 95 | +```toml |
| 96 | +[colors.status] |
| 97 | +fg = "#DFDFDF" |
| 98 | +bg = "#121212" |
| 99 | +detail = "#3E485B" |
| 100 | +``` |
90 | 101 |
|
91 | | -## Clickable applets |
| 102 | +## Troubleshooting |
92 | 103 |
|
93 | | -// TODO |
| 104 | +If the status bar is not working: |
94 | 105 |
|
95 | | -::: info |
96 | | -This feature is not just lacking documentation |
97 | | -There is just a very early implementation of this in the window manager that at the moment is not remotely ready for use |
98 | | -::: |
| 106 | +1. Check that `status_command` is set in your config |
| 107 | +2. Verify the command runs standalone |
| 108 | +3. Check instantWM logs for errors |
| 109 | +4. Try `instantwmctl update-status "test"` to verify basic functionality |
0 commit comments