Add FIFO documentation, add more funcs
This commit is contained in:
parent
0abc31cd76
commit
62038cbb3d
23
docs/docs.md
23
docs/docs.md
|
@ -740,6 +740,29 @@ background color.
|
|||
|
||||
**Note: Background colors will used until a reset sequence is found.**
|
||||
|
||||
## FIFO
|
||||
|
||||
spmenu has support for FIFO. This means you can tell spmenu to perform certain
|
||||
actions while it is running. spmenu checks the FIFO every 0.1 seconds. To use it,
|
||||
simply append a valid name to the FIFO file, which by default is /tmp/spmenu.fifo.
|
||||
|
||||
You must append **without** a newline. Otherwise it will be considered invalid.
|
||||
It is recommended that you sleep for 0.1 seconds after appending to the file
|
||||
for performance reasons.
|
||||
|
||||
| Name | Description |
|
||||
| :----------------- | :-------------------------------------------------------------------------------- |
|
||||
| drawmenu | Draw the menu |
|
||||
| match | Match entries again, useful if you're loading items from file |
|
||||
| update | Match and then draw the menu. Both drawmenu and match one after another |
|
||||
| output | Output selected item text |
|
||||
| output_index | Output selected item index
|
||||
| loadconfig | Reload config |
|
||||
| test | Print out 'Test print' to standard output |
|
||||
| die | Print out 'FIFO told me to die.' using the die() function |
|
||||
| exit_0 | Exit with exit code 0 |
|
||||
| exit_1 | Exit with exit code 1 |
|
||||
|
||||
## Pango markup and text formatting
|
||||
|
||||
Because spmenu uses Pango and Cairo for text drawing, Pango markup can be used
|
||||
|
|
16
libs/fifo.c
16
libs/fifo.c
|
@ -35,6 +35,22 @@ void execute_fifo_cmd(void) {
|
|||
} else if (!strcmp(fifot, "die")) {
|
||||
close(fd);
|
||||
die("FIFO told me to die.");
|
||||
} else if (!strcmp(fifot, "loadconfig")) {
|
||||
#if CONFIG
|
||||
conf_init();
|
||||
#endif
|
||||
} else if (!strcmp(fifot, "output")) {
|
||||
if (selecteditem) {
|
||||
for (int i = 0; i < sel_size; i++) {
|
||||
if (sel_index[i] != -1 && (!selecteditem || selecteditem->index != sel_index[i])) {
|
||||
puts(items[sel_index[i]].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(fifot, "output_index")) {
|
||||
if (printindex && selecteditem) {
|
||||
fprintf(stdout, "%d\n", selecteditem->index);
|
||||
}
|
||||
} else if (!strcmp(fifot, "exit_0")) {
|
||||
exit(0);
|
||||
} else if (!strcmp(fifot, "exit_1")) {
|
||||
|
|
75
spmenu.1
75
spmenu.1
|
@ -860,6 +860,81 @@ foreground and background color.
|
|||
.PP
|
||||
\f[B]Note: Background colors will used until a reset sequence is
|
||||
found.\f[R]
|
||||
.SS FIFO
|
||||
.PP
|
||||
spmenu has support for FIFO.
|
||||
This means you can tell spmenu to perform certain actions while it is
|
||||
running.
|
||||
spmenu checks the FIFO every 0.1 seconds.
|
||||
To use it, simply append a valid name to the FIFO file, which by default
|
||||
is /tmp/spmenu.fifo.
|
||||
.PP
|
||||
You must append \f[B]without\f[R] a newline.
|
||||
Otherwise it will be considered invalid.
|
||||
It is recommended that you sleep for 0.1 seconds after appending to the
|
||||
file for performance reasons.
|
||||
.PP
|
||||
.TS
|
||||
tab(@);
|
||||
lw(12.7n) lw(57.3n).
|
||||
T{
|
||||
Name
|
||||
T}@T{
|
||||
Description
|
||||
T}
|
||||
_
|
||||
T{
|
||||
drawmenu
|
||||
T}@T{
|
||||
Draw the menu
|
||||
T}
|
||||
T{
|
||||
match
|
||||
T}@T{
|
||||
Match entries again, useful if you\[cq]re loading items from file
|
||||
T}
|
||||
T{
|
||||
update
|
||||
T}@T{
|
||||
Match and then draw the menu.
|
||||
Both drawmenu and match one after another
|
||||
T}
|
||||
T{
|
||||
output
|
||||
T}@T{
|
||||
Output selected item text
|
||||
T}
|
||||
T{
|
||||
output_index
|
||||
T}@T{
|
||||
Output selected item index
|
||||
T}
|
||||
T{
|
||||
loadconfig
|
||||
T}@T{
|
||||
Reload config
|
||||
T}
|
||||
T{
|
||||
test
|
||||
T}@T{
|
||||
Print out `Test print' to standard output
|
||||
T}
|
||||
T{
|
||||
die
|
||||
T}@T{
|
||||
Print out `FIFO told me to die.' using the die() function
|
||||
T}
|
||||
T{
|
||||
exit_0
|
||||
T}@T{
|
||||
Exit with exit code 0
|
||||
T}
|
||||
T{
|
||||
exit_1
|
||||
T}@T{
|
||||
Exit with exit code 1
|
||||
T}
|
||||
.TE
|
||||
.SS Pango markup and text formatting
|
||||
.PP
|
||||
Because spmenu uses Pango and Cairo for text drawing, Pango markup can
|
||||
|
|
Loading…
Reference in a new issue