index.md (2198B)
1 script_tags 2 =========== 3 4 Description 5 ----------- 6 This patch does two things: 7 1) It removes the code that generates the bar, but still leaves a "toggleable" area. 8 9 2) On X events, it writes all the tag and layout information to a user defined fifo. 10 11 This allows any bar that reads stdin to be used in conjuction with dwm. 12 13 The patch introduces 3 variables: 14 15 barheight: sets the size of the top gap in pixels(this gap remains toggleable with the togglebar function). 16 17 sepchar: sets the character used to delimitate different workspaces(see below). 18 19 tagfile: sets the path of the file to wich the tag and layout information is written to. 20 21 The tagfile uses an easy syntax. 22 23 Each tagname is prefixed with a character describing the state of that tag. 24 25 There are 4 different states: 26 27 state '%e': tag is empty and not focused 28 29 state '%E': tag is empty and focused 30 31 state '%o': tag is occupied and not focused 32 33 state '%O': tag is occupied and focused 34 35 Each tag name is also suffixed with %f, this makes scripting the output a bit easier. 36 37 All of these predefined strings are easily modified in dwm.c. 38 39 The different tags with respective tag information are separated by the sepchar variable defined in config.h. 40 41 A simple example would be: 42 43 Attention 44 ----------- 45 46 Because of how named pipes work, dwm will stall if no process is reading from the fifo. 47 If one does not want to use any bar, one can call 48 ``` 49 tail -f /tmp/dwm_tags & 50 ``` 51 from .xinitrc or in another tty. 52 53 54 Example 55 ----------- 56 The script I currently use in conjunction with lemonbar is: 57 ``` 58 tail -f /tmp/dwm_tags 2>/dev/null | while IFS= read -r line; do 59 sed\ 60 -e "s/%O/%{F#FFFFFF}%{B#292c2e}/g"\ 61 -e "s/%o/%{F#FFFFFF}%{B#5F819D}/g"\ 62 -e "s/%O/%{F#292c2e}%{B#FFFFFF}/g"\ 63 -e "s/%E/%{F#292c2e}%{B#FFFFFF}/g"\ 64 -e 's/%f/%{F}%{B}/g' <<< $line 65 done | lemonbar -d -B "#292c2e" -F "#FFFFFF" -g x25 66 67 ``` 68 69 70 Download 71 ----------- 72 * [dwm-script_tags-6.2.diff](dwm-script_tags-6.2.diff) (2020-08-30) 73 * Old version without fifo, wouldn't recommend it:[dwm-script_tags-without_fifo.diff](dwm-script_tags-without_fifo.diff) 74 75 Authors 76 ----------- 77 * David Wiedemann <david.wiedemann2 [at] gmail.com> 78 79 80 81