-
Notifications
You must be signed in to change notification settings - Fork 0
/
dwmblocks2.1
145 lines (130 loc) · 4.11 KB
/
dwmblocks2.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
.TH dwmblocks2 1 "2023"
.SH NAME
dwmblocks2 \- Lightweight status bar for dwm, a fork of dwmblocks (not a drop-in replacement)
.SH SYNOPSIS
.B dwmblocks2
.SH DESCRIPTION
.I dwmblocks2
is a lightweight status bar for the
.I dwm
window manager. It is a fork of the original dwmblocks, designed to provide an efficient and customizable status bar.
.I dwmblocks2
allows you to display various information in your dwm status bar, such as system statistics, the time, and more. This man page provides an overview of how to use and configure
.I dwmblocks2.
.SH USAGE
To run
.I dwmblocks2,
add the following line to your
.I xinitrc
or startup script:
.PP
.B dwmblocks2 &
.PP
This command will start
.I dwmblocks2
in the background.
.SH CONFIGURATION
Configuration for
.I dwmblocks2
is done by editing the
.I blocks.h
file. By default,
.I dwmblocks2
uses all blocks defined in the
.I blocks/
directory, in addition to the built-in clock block. You can customize the blocks to display external programs or C functions.
.TP
.B Block Configuration
Blocks are defined in the
.I blocks.h
file. Each block is represented as a command, but it is not interpreted by the shell. Instead, it is likely a script or program. The overhead and loss of readability due to shell interpretation are avoided for efficiency.
.TP
.B Signal Numbers
A signal number, specified through an environmental variable, is mandatory for each block. These signals allow
.I dwmblocks2
to update specific blocks. Signal numbers must be unique and fall within the range of 1 to SIGRTMAX - SIGRTMIN. You can set the same signal for multiple blocks if needed.
.TP
.B Block Updates
Blocks whose interval is set to 0 will only be updated through signals, including those sent by
.I dwm
through clicks. This allows for efficient and independent updates of blocks.
.SH CLICKS
For mouse clicks to work with
.I dwmblocks2,
you need to apply the
.I dwm-statuscmd.diff
patch to your
.I dwm
installation. The button number clicked is passed as the first argument to the block, and
.I dwmblocks2
will update the block accordingly.
.PP
The following click events are supported:
.TP
.B 0
No click (other signal/interval)
.TP
.B 1
Left button click
.TP
.B 2
Middle button click
.TP
.B 3
Right button click
.TP
.B 4
Scroll up
.TP
.B 5
Scroll down
.TP
.B 6
Shift + left button click
.TP
.B 7
Control + left button click
.PP
You can customize the action taken in response to these click events by modifying your block scripts.
.SH NOTE
After installation, make sure to add the block scripts to your
.I PATH
and set the environmental variables according to your block configuration in the
.I blocks.h
file. Note that some default blocks may call programs that need to be installed on your system.
.SH DIFFERENCES FROM ORIGINAL DWMBLOCKS
.I dwmblocks2
offers several improvements and differences compared to the original dwmblocks:
.TP
.B \- It's much lighter, since the shell is avoided on every command spawned.
.TP
.B \- A hard-to-reproduce bug in which
.I dwmblocks
would freeze has been fixed.
.TP
.B \- Blocks are updated independently (a slow block will not block others).
.TP
.B \- Clicks are passed through the first argument, not the BLOCK_BUTTON environment variable, which makes it easier to debug scripts.
.TP
.B \- Signals are mandatory and set through environmental variables, so one can more easily keep dwmblocks signals in sync with scripts which update the contents of the bar.
.TP
.B \- There is the possibility of using C functions as blocks, which is useful for the included clock block, which runs every second, avoiding the overhead of forking and executing a new process.
.SH Why poll and not epoll?
The file descriptors watched in
.I dwmblocks2
change all the time, so if
.I epoll
was used, there would be lots of system calls to update them. Using
.I poll,
it's only a matter of assigning to the poll events array.
.I epoll
is meant to be used for handling a huge number of ideally fixed connections, not a simple program reading from some pipes. Besides,
.I poll
is more portable.
.SH LICENSE
.I dwmblocks2
is licensed under GPLv2, and the block scripts in the
.I blocks/
directory are licensed under AGPL.
.SH SEE ALSO
.BR dwm (1)