aboutsummaryrefslogtreecommitdiff

qm plugin protocol with example. A "file manager" plugin example is written in shell script, python and zig

Protocol

Input

Plugins get inputs as environment variables.
The environment variable ACTION is set to get to get data.
The environment variable URL is set to url relevant to the page, so for example for a file manager URL is set to the directory to display files of.

Output

Plugins output data by writing lines to stdout.
Data is first written to stdout and then a command is written to stdout.
First add_tab command is expected, followed by multiple add_body_item. The body items are put in the tab that is output before the body items.
In plugins you may need to output newlines (\n) or carriage return (\r), in those cases replace newline with ascii 1 (\x01) and carriage return with ascii 2 (\x02).
Text color/font bold, etc can be set by using ANSI escape codes, see ANSI escape code wikipedia and this practical example.

add_tab

The add_tab command expects title data, for example:

echo "title Files"
echo "add_tab"

add_body_item

The add_body_item command expects title and url data and optionally thumbnail_url and thumbnail_size, for example:

echo "title file.png"
echo "url img1.png"
echo "thumbnail_url img1.png"
echo "thumbnail_size 1920x1080"
echo "add_body_item"

echo "title img2.png"
echo "url img2.png"
echo "thumbnail_url img2.png"
echo "thumbnail_size 1280x720"
echo "add_body_item"