index.md - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
index.md (1653B)
---
1 SGR in status text
2 ==================
3
4 Description
5 -----------
6 Allows the use of CSI SGR escape sequences in the status bar text to change
7 text rendition. Currently supported are:
8
9 * color changes (either 16 or 256, depending on chosen patch)
10 * alternate font (ones listed in fonts[] array)
11 * reverse, underline, strikethrough, overline
12
13 Configuration
14 -------------
15 Download the patch and apply it according to the [general instructions](../).
16
17 Modify the barcolors definition in 'config.h' to suit your needs. For the 16
18 color version, you should have at least 16 colors defined.
19
20 Usage
21 -----
22 Add code to your status script to output CSI SGR codes. They take the form
23 ESC[1;2;3;4m.
24
25 * 0 resets all formatting
26 * 1 makes text bright (_not_ bold)
27 * 4 underlines
28 * 7 reverses
29 * 9 strike-through's
30 * 10-19 alternate font
31 * 53 overlines
32 * 30-37 sets foreground color
33 * 40-47 sets background color
34
35 In addition the 256 color version allows the use of: `ESC[38;5;123m` to set
36 foreground to color 123 (48 changes background).
37
38 ### Example
39
40 With slstatus, you can have your date in bright red using:
41
42 { datetime, "\033[1;31m%s\e[0m", "%F %T" },
43
44 For a more pointless example, you could combine slstatus -s with
45 [nyancat](https://inzg.it/nyancat/):
46
47 slstatus -s | nyancat -2 | while read l; do xsetroot -name "$l"; done
48
49 And you'll get something like .
50
51 Download
52 --------
53 * [dwm-sgrstatus-20220223-6.3.diff](dwm-sgrstatus-20220223-6.3.diff)
54
55 For 256 color support, apply the following on top:
56
57 * [dwm-sgrstatus256-20220223-6.3.diff](dwm-sgrstatus256-20220223-6.3.diff)
58
59 Authors
60 -------
61 * Santtu Lakkala - <inz@inz.fi>