...to enable configuration of the action prompt command.
Also set some better defaults for labnag.
The new default command is:
labnag \
--message '%m' \
--button-dismiss '%n' \
--button-dismiss '%y' \
--background '%b' \
--text '%t' \
--border '%t' \
--border-bottom '%t' \
--button-background '%b' \
--button-text '%t' \
--border-bottom-size 1 \
--button-border-size 3 \
--timeout 0
...where the conversion specifiers are defined as follows:
%m: the `<prompt>` message option
%n: _("No")
%y: _("Yes")
%b: osd.bg.color
%t: osd.label.text.color
This config options also enables the use of a different dialog client, for
example like this:
<core>
<promptCommand>zenity --question --text="%m"</promptCommand>
</core>
Add a BUF_INIT macro, which makes it easier to initialize a struct buf
to an empty string (without a heap allocation).
Add buf_move() to move the contents of one struct buf to another (the
source is reset to BUF_INIT, analogous to C++ move-assignment).
Use buf_reset() instead of directly calling `free(s->buf)` since the
internal buf may not always be allocated by malloc() now.
There is at least one user of the buffer API that reuse a single
buffer by just resetting `buf.len` to `0`. This works as long as
the new user of the buffer actually adds something to the buffer.
However, if we don't add anything but still provide `buf.buf` to
a consumer, the old content will be re-used.
This patch thus adds two new clearing variants to the buffer API:
- `buf_clear()` which doesn't reset the internal allocations
- `buf_reset()` which does free the internal allocations
Additionally, this patch makes `buffer_add_char()` public which
allows adding single characters to an existing buffer. This will
be used in a future PR which implements custom format strings for
the OSD.
...<command> argument (but still resolve tilde).
This makes it easier to write sh -c '' constructs without turning labwc
into a shell parser in order to expand environment variables, whilst
respecting single quotes and escaped characters as well as ignoring
subshells syntax like $(foo) and backticks.
Also, fix bug where buffer length+alloc get out-of-sync
Made all header files to have LABWC_ prefix in include guard identifers.
Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.
The double underscores were removed since according to C standard
those "are always reserved for any use".
Expanding shell variables, including tilde, enables the following type
of keybind:
<keyboard>
<keybind key="XF86AudioMute">
<action name="Execute">
<command>bash ~/mute-script.sh</command>
</action>
</keybind>
</keyboard>
Fixes issue #32