Showing preview only (1,432K chars total). Download the full file or copy to clipboard to get everything.
Repository: shdown/luastatus
Branch: master
Commit: dda015e2f979
Files: 805
Total size: 1.2 MB
Directory structure:
gitextract_ja3_jqjt/
├── .circleci/
│ ├── config.yml
│ └── run-pt.sh
├── .gitignore
├── .luacheckrc
├── CMakeLists.txt
├── COPYING.LESSER.txt
├── COPYING.txt
├── DEPENDS.txt
├── DOCS/
│ ├── CUSTOM_DATA_SRC_WIDGET.md
│ ├── MIGRATION_GUIDE.md
│ ├── WRITING_BARLIB_OR_PLUGIN.md
│ ├── c_notes/
│ │ ├── eintr-policy.md
│ │ └── empty-ranges-and-c-stdlib.md
│ └── design/
│ ├── locking-patterns.md
│ └── map_get.md
├── README.md
├── barlibs/
│ ├── dwm/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── dwm.c
│ ├── i3/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── escape_json_str.c
│ │ ├── escape_json_str.h
│ │ ├── event_watcher.c
│ │ ├── event_watcher.h
│ │ ├── fuzz_esc_json/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_esc_pango/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── i3.c
│ │ ├── luastatus-i3-wrapper
│ │ ├── pango_escape.c
│ │ ├── pango_escape.h
│ │ └── priv.h
│ ├── lemonbar/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── fuzz_esc/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_sanitize/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── X_testcase_000
│ │ │ ├── X_testcase_001
│ │ │ ├── X_testcase_002
│ │ │ ├── X_testcase_003
│ │ │ ├── X_testcase_004
│ │ │ ├── X_testcase_005
│ │ │ ├── X_testcase_fps
│ │ │ ├── Y_testcase_000
│ │ │ ├── Y_testcase_001
│ │ │ ├── Y_testcase_002
│ │ │ ├── Y_testcase_003
│ │ │ ├── Z_testcase_000
│ │ │ ├── Z_testcase_001
│ │ │ ├── Z_testcase_002
│ │ │ ├── Z_testcase_003
│ │ │ └── Z_testcase_004
│ │ ├── lemonbar.c
│ │ ├── luastatus-lemonbar-launcher
│ │ ├── markup_utils.c
│ │ └── markup_utils.h
│ └── stdout/
│ ├── CMakeLists.txt
│ ├── README.rst
│ ├── fuzz/
│ │ ├── .gitignore
│ │ ├── build.sh
│ │ ├── clear.sh
│ │ ├── fuzz.sh
│ │ ├── gen_testcases.sh
│ │ ├── harness.c
│ │ └── testcases/
│ │ ├── testcase_000
│ │ ├── testcase_001
│ │ ├── testcase_002
│ │ ├── testcase_003
│ │ ├── testcase_004
│ │ ├── testcase_005
│ │ ├── testcase_006
│ │ ├── testcase_007
│ │ ├── testcase_008
│ │ └── testcase_009
│ ├── luastatus-dvtm
│ ├── luastatus-stdout-wrapper
│ ├── open_stdio_file.c
│ ├── open_stdio_file.h
│ ├── sanitize.c
│ ├── sanitize.h
│ └── stdout.c
├── check_final_newline.py
├── check_includes.sh
├── check_style.sh
├── contrib/
│ ├── luastatus-9999.ebuild
│ └── luastatus.spec
├── debian/
│ ├── changelog
│ ├── compat
│ ├── control
│ ├── copyright
│ └── rules
├── examples/
│ ├── dwm/
│ │ ├── alsa-gauge.lua
│ │ ├── alsa.lua
│ │ ├── backlight.lua
│ │ ├── battery.lua
│ │ ├── bluetooth.lua
│ │ ├── btc-price.lua
│ │ ├── cpu-freq.lua
│ │ ├── cpu-temperature.lua
│ │ ├── cpu-usage.lua
│ │ ├── disk-io.lua
│ │ ├── file-contents.lua
│ │ ├── fs.lua
│ │ ├── gmail.lua
│ │ ├── ip.lua
│ │ ├── loadavg-linux.lua
│ │ ├── media-player-mpris.lua
│ │ ├── mem-usage.lua
│ │ ├── mpd.lua
│ │ ├── network-rate.lua
│ │ ├── pulse-gauge.lua
│ │ ├── pulse.lua
│ │ ├── systemd-unit.lua
│ │ ├── time-battery-combined.lua
│ │ ├── time-date.lua
│ │ ├── tor.lua
│ │ ├── uptime-linux.lua
│ │ ├── weather-rus.lua
│ │ ├── weather.lua
│ │ ├── wireless.lua
│ │ └── xkb.lua
│ ├── i3/
│ │ ├── alsa-gauge.lua
│ │ ├── alsa-interactive-gauge.lua
│ │ ├── alsa.lua
│ │ ├── backlight.lua
│ │ ├── battery.lua
│ │ ├── bluetooth.lua
│ │ ├── btc-price.lua
│ │ ├── cpu-freq.lua
│ │ ├── cpu-temperature.lua
│ │ ├── cpu-usage.lua
│ │ ├── disk-io.lua
│ │ ├── file-contents.lua
│ │ ├── fs.lua
│ │ ├── gmail.lua
│ │ ├── ip.lua
│ │ ├── loadavg-linux.lua
│ │ ├── media-player-mpris.lua
│ │ ├── mem-usage.lua
│ │ ├── mpd-progressbar.lua
│ │ ├── network-rate.lua
│ │ ├── pulse-gauge.lua
│ │ ├── pulse-interactive-gauge.lua
│ │ ├── pulse.lua
│ │ ├── systemd-unit.lua
│ │ ├── time-battery-combined.lua
│ │ ├── time-date.lua
│ │ ├── tor.lua
│ │ ├── update-on-click.lua
│ │ ├── uptime-linux.lua
│ │ ├── weather-rus.lua
│ │ ├── weather.lua
│ │ ├── wireless.lua
│ │ └── xkb.lua
│ └── lemonbar/
│ ├── alsa-gauge.lua
│ ├── alsa.lua
│ ├── backlight.lua
│ ├── battery.lua
│ ├── bluetooth.lua
│ ├── btc-price.lua
│ ├── cpu-freq.lua
│ ├── cpu-temperature.lua
│ ├── cpu-usage.lua
│ ├── disk-io.lua
│ ├── file-contents.lua
│ ├── fs.lua
│ ├── gmail.lua
│ ├── ip.lua
│ ├── loadavg-linux.lua
│ ├── media-player-mpris.lua
│ ├── mem-usage.lua
│ ├── mpd-progressbar.lua
│ ├── network-rate.lua
│ ├── pulse-gauge.lua
│ ├── pulse.lua
│ ├── systemd-unit.lua
│ ├── time-battery-combined.lua
│ ├── time-date.lua
│ ├── tor.lua
│ ├── uptime-linux.lua
│ ├── weather-rus.lua
│ ├── weather.lua
│ ├── wireless.lua
│ └── xkb.lua
├── fuzz_utils/
│ ├── do_fuzz_everything.sh
│ ├── find_interesting.sh
│ ├── fuzz_utils.h
│ └── gen_testcases/
│ ├── .gitignore
│ ├── __init__.py
│ ├── gen_testcases.py
│ ├── mod_generator.py
│ ├── mod_mutator.py
│ └── mod_mutators.py
├── generate-man.sh
├── include/
│ ├── barlib_data.h
│ ├── barlib_data_v1.h
│ ├── barlib_v1.h
│ ├── common.h
│ ├── plugin_data.h
│ ├── plugin_data_v1.h
│ ├── plugin_v1.h
│ └── sayf_macros.h
├── libhackyfix/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── fatal.c
│ ├── fatal.h
│ ├── get_rtld_next_handle.c
│ ├── get_rtld_next_handle.h
│ └── libhackyfix.c
├── libls/
│ ├── CMakeLists.txt
│ ├── ls_algo.h
│ ├── ls_alloc_utils.c
│ ├── ls_alloc_utils.h
│ ├── ls_compdep.h
│ ├── ls_cstring_utils.c
│ ├── ls_cstring_utils.h
│ ├── ls_evloop_lfuncs.h
│ ├── ls_fifo_device.h
│ ├── ls_freemem.h
│ ├── ls_getenv_r.c
│ ├── ls_getenv_r.h
│ ├── ls_io_utils.c
│ ├── ls_io_utils.h
│ ├── ls_lua_compat.h
│ ├── ls_osdep.c
│ ├── ls_osdep.h
│ ├── ls_panic.c
│ ├── ls_panic.h
│ ├── ls_parse_int.c
│ ├── ls_parse_int.h
│ ├── ls_probes.in.h
│ ├── ls_strarr.h
│ ├── ls_string.c
│ ├── ls_string.h
│ ├── ls_time_utils.h
│ ├── ls_tls_ebuf.c
│ ├── ls_tls_ebuf.h
│ ├── ls_xallocf.c
│ └── ls_xallocf.h
├── libmoonvisit/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── moonvisit.c
│ └── moonvisit.h
├── libprocalive/
│ ├── CMakeLists.txt
│ ├── procalive_lfuncs.c
│ └── procalive_lfuncs.h
├── librunshell/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── runshell.c
│ └── runshell.h
├── libsafe/
│ ├── CMakeLists.txt
│ ├── mut_safev.h
│ ├── safe_common.c
│ ├── safe_common.h
│ └── safev.h
├── libwidechar/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── config.in.h
│ ├── libwidechar.c
│ ├── libwidechar.h
│ ├── libwidechar_compdep.h
│ └── libwidechar_xspan.h
├── plugins/
│ ├── alsa/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── alsa.c
│ ├── backlight-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── backlight-linux.lua
│ ├── battery-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── battery-linux.lua
│ ├── cpu-freq-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── cpu-freq-linux.lua
│ ├── cpu-usage-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── cpu-usage-linux.lua
│ ├── dbus/
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── README_FN_CALL_METHOD.rst
│ │ ├── README_FN_MKVAL.rst
│ │ ├── README_FN_PROP.rst
│ │ ├── bustype2idx.h
│ │ ├── cstringify.sh
│ │ ├── cvt.c
│ │ ├── cvt.h
│ │ ├── dbus.c
│ │ ├── load_lualib.c
│ │ ├── load_lualib.h
│ │ ├── lualib.lua
│ │ └── zoo/
│ │ ├── README.txt
│ │ ├── zoo.c
│ │ ├── zoo.h
│ │ ├── zoo_call_params.c
│ │ ├── zoo_call_params.h
│ │ ├── zoo_call_prot.c
│ │ ├── zoo_call_prot.h
│ │ ├── zoo_checkudata.c
│ │ ├── zoo_checkudata.h
│ │ ├── zoo_mt.c
│ │ ├── zoo_mt.h
│ │ ├── zoo_uncvt_type.c
│ │ ├── zoo_uncvt_type.h
│ │ ├── zoo_uncvt_val.c
│ │ └── zoo_uncvt_val.h
│ ├── disk-io-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── disk-io-linux.lua
│ ├── file-contents-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── file-contents-linux.lua
│ ├── fs/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── fs.c
│ │ ├── strlist.c
│ │ └── strlist.h
│ ├── imap/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── imap.lua
│ ├── inotify/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── inotify.c
│ │ ├── inotify_compat.h
│ │ └── probes.in.h
│ ├── is-program-running/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── is-program-running.lua
│ ├── mem-usage-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── mem-usage-linux.lua
│ ├── mpd/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── connect.c
│ │ ├── connect.h
│ │ ├── fuzz/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── fuzz_all.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness
│ │ │ ├── harness.c
│ │ │ ├── testcases_append_kv/
│ │ │ │ ├── testcase_000
│ │ │ │ ├── testcase_001
│ │ │ │ ├── testcase_002
│ │ │ │ ├── testcase_003
│ │ │ │ ├── testcase_004
│ │ │ │ ├── testcase_005
│ │ │ │ ├── testcase_006
│ │ │ │ ├── testcase_007
│ │ │ │ ├── testcase_008
│ │ │ │ └── testcase_009
│ │ │ ├── testcases_check_greeting/
│ │ │ │ ├── testcase_000
│ │ │ │ ├── testcase_001
│ │ │ │ ├── testcase_002
│ │ │ │ ├── testcase_003
│ │ │ │ ├── testcase_004
│ │ │ │ ├── testcase_005
│ │ │ │ ├── testcase_006
│ │ │ │ ├── testcase_007
│ │ │ │ ├── testcase_008
│ │ │ │ ├── testcase_009
│ │ │ │ └── testcase_pfx_only
│ │ │ ├── testcases_get_resp_type/
│ │ │ │ ├── ack_testcase_000
│ │ │ │ ├── ack_testcase_001
│ │ │ │ ├── ack_testcase_002
│ │ │ │ ├── ack_testcase_003
│ │ │ │ ├── ack_testcase_004
│ │ │ │ ├── ok_testcase_000
│ │ │ │ ├── ok_testcase_001
│ │ │ │ ├── ok_testcase_002
│ │ │ │ ├── ok_testcase_003
│ │ │ │ ├── ok_testcase_004
│ │ │ │ ├── ok_testcase_pfx_only
│ │ │ │ ├── other_testcase_000
│ │ │ │ ├── other_testcase_001
│ │ │ │ ├── other_testcase_002
│ │ │ │ ├── other_testcase_003
│ │ │ │ └── other_testcase_004
│ │ │ └── testcases_write_quoted/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── line_reader.c
│ │ ├── line_reader.h
│ │ ├── mpd.c
│ │ ├── safe_haven.c
│ │ └── safe_haven.h
│ ├── mpris/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── mpris.lua
│ ├── multiplex/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── config.in.h
│ │ ├── conq.c
│ │ ├── conq.h
│ │ ├── external_context.h
│ │ ├── map_ref.c
│ │ ├── map_ref.h
│ │ ├── multiplex.c
│ │ ├── priv.h
│ │ ├── runner.c
│ │ ├── runner.h
│ │ ├── runtime_data.c
│ │ ├── runtime_data.h
│ │ ├── wspec_list.c
│ │ └── wspec_list.h
│ ├── network-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── ethernet_info.c
│ │ ├── ethernet_info.h
│ │ ├── iface_type.c
│ │ ├── iface_type.h
│ │ ├── network.c
│ │ ├── string_set.c
│ │ ├── string_set.h
│ │ ├── wireless_info.c
│ │ └── wireless_info.h
│ ├── network-rate-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── network-rate-linux.lua
│ ├── pipe/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── pipe.lua
│ ├── pipev2/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── launch.c
│ │ ├── launch.h
│ │ ├── pipev2.c
│ │ ├── sigdb.c
│ │ ├── sigdb.h
│ │ ├── utils.c
│ │ └── utils.h
│ ├── pulse/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── pulse.c
│ ├── systemd-unit/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── systemd-unit.lua
│ ├── temperature-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── temperature-linux.lua
│ ├── timer/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── timer.c
│ ├── udev/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── udev.c
│ ├── unixsock/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── cloexec_accept.c
│ │ ├── cloexec_accept.h
│ │ ├── probes.in.h
│ │ ├── server.c
│ │ ├── server.h
│ │ └── unixsock.c
│ ├── web/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── compat_lua_resume.c
│ │ ├── compat_lua_resume.h
│ │ ├── fuzz_esc_json/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_urldecode/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ ├── testcase_009
│ │ │ ├── testcase_extra1
│ │ │ ├── testcase_extra2
│ │ │ └── testcase_extra3
│ │ ├── fuzz_urlencode/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── fuzz_all.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── get_min_curl_ver.sh
│ │ ├── json_config.in.h
│ │ ├── make_request.c
│ │ ├── make_request.h
│ │ ├── mod_json/
│ │ │ ├── json_decode.c
│ │ │ ├── json_decode.h
│ │ │ ├── json_encode_num.c
│ │ │ ├── json_encode_num.h
│ │ │ ├── json_encode_str.c
│ │ │ ├── json_encode_str.h
│ │ │ ├── mod_json.c
│ │ │ └── mod_json.h
│ │ ├── mod_urlencode/
│ │ │ ├── mod_urlencode.c
│ │ │ ├── mod_urlencode.h
│ │ │ ├── urldecode.c
│ │ │ ├── urldecode.h
│ │ │ ├── urlencode.c
│ │ │ └── urlencode.h
│ │ ├── next_request_params.h
│ │ ├── opts.c
│ │ ├── opts.h
│ │ ├── parse_opts.c
│ │ ├── parse_opts.h
│ │ ├── set_error.c
│ │ ├── set_error.h
│ │ └── web.c
│ ├── xkb/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── somehow.c
│ │ ├── somehow.h
│ │ ├── wrongly.c
│ │ ├── wrongly.h
│ │ └── xkb.c
│ └── xtitle/
│ ├── CMakeLists.txt
│ ├── README.rst
│ └── xtitle.c
├── release.sh
├── run_literally_all_tests.sh
├── run_luacheck.sh
└── tests/
├── .gitignore
├── CMakeLists.txt
├── README.txt
├── barlib-runners/
│ └── runner-redirect-34
├── dlopen.supp
├── glib.supp
├── httpserv/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── argparser.c
│ ├── argparser.h
│ ├── buffer.c
│ ├── buffer.h
│ ├── common.c
│ ├── common.h
│ ├── main.c
│ ├── server.c
│ ├── server.h
│ ├── sleep_millis.c
│ └── sleep_millis.h
├── kcov_wrapper.c
├── listnets.c
├── minstd.h
├── mock_barlib.c
├── mock_plugin.c
├── optional/
│ └── dbus_srv.py
├── parrot.c
├── pt.sh
├── pt_dbus_daemon.lib.bash
├── pt_pulseaudio_daemon.lib.bash
├── pt_stopwatch.lib.bash
├── pt_tests/
│ ├── _misc/
│ │ └── 01-simul.lib.bash
│ ├── add_test.sh
│ ├── barlib-i3/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 02-input.lib.bash
│ │ └── 03-lfunc-pango-escape.lib.bash
│ ├── barlib-lemonbar/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 02-input.lib.bash
│ │ └── 03-lfunc-pango-escape.lib.bash
│ ├── barlib-stdout/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 03-input-filename.lib.bash
│ │ └── 04-input-fd.lib.bash
│ ├── luastatus/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-misc.lib.bash
│ │ ├── 02-getenv.lib.bash
│ │ ├── 03-exit.lib.bash
│ │ ├── 04-setlocale.lib.bash
│ │ ├── 05-libwidechar.lib.bash
│ │ └── 06-execute.lib.bash
│ ├── plugin-battery-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-full-status-full.lib.bash
│ │ ├── 02-full-status-not-charging.lib.bash
│ │ ├── 03-dischaging.lib.bash
│ │ ├── 04-charging.lib.bash
│ │ └── 05-nofile.lib.bash
│ ├── plugin-cpu-freq-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-please-reload.lib.bash
│ ├── plugin-cpu-usage-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-total.lib.bash
│ │ ├── 02-cpu1.lib.bash
│ │ ├── 03-cpu2.lib.bash
│ │ ├── 04-cpu3.lib.bash
│ │ └── 05-cpu4.lib.bash
│ ├── plugin-dbus/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-timeout.lib.bash
│ │ ├── 03-greet.lib.bash
│ │ ├── 04-get-prop.lib.bash
│ │ ├── 05-get-all-prop.lib.bash
│ │ ├── 06-OPTIONAL-getset-prop.lib.bash
│ │ ├── 07-OPTIONAL-getall-prop.lib.bash
│ │ ├── 08-OPTIONAL-call-method-str.lib.bash
│ │ ├── 09-OPTIONAL-call-method-DTLL.lib.bash
│ │ ├── 10-OPTIONAL-call-method-arr.lib.bash
│ │ ├── 11-OPTIONAL-call-method-dict.lib.bash
│ │ ├── 12-OPTIONAL-call-method-tuple.lib.bash
│ │ ├── 13-OPTIONAL-call-method-misc.lib.bash
│ │ ├── 14-OPTIONAL-call-method-handle.lib.bash
│ │ ├── 15-report-when-ready.lib.bash
│ │ └── skip-me-if.lib.bash
│ ├── plugin-disk-io-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-file-contents-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-fs/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-default.lib.bash
│ │ ├── 02-root.lib.bash
│ │ ├── 03-glob-yesmatch.lib.bash
│ │ ├── 04-glob-nomatch.lib.bash
│ │ ├── 05-bad-path.lib.bash
│ │ ├── 06-wakeup-fifo.lib.bash
│ │ └── 07-dyn-paths.lib.bash
│ ├── plugin-imap/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-retry-timeout.lib.bash
│ │ └── 03-idle-timeout.lib.bash
│ ├── plugin-inotify/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-lfunc-get-initial-wds.lib.bash
│ │ ├── 03-lfunc-add-watch.lib.bash
│ │ ├── 04-lfunuc-rm-watch.lib.bash
│ │ ├── 05-timeout.lib.bash
│ │ ├── 06-dir.lib.bash
│ │ ├── 07-lfunc-push-timeout.lib.bash
│ │ ├── 08-lfunc-get-supported-events.lib.bash
│ │ └── 09-access.lib.bash
│ ├── plugin-is-program-running/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-pidfile-devnull.lib.bash
│ │ ├── 02-pidfile.lib.bash
│ │ ├── 03-pidfile-fileerr.lib.bash
│ │ ├── 04-fileexists.lib.bash
│ │ ├── 05-dirnonempty-root.lib.bash
│ │ ├── 06-dirnonempty-normal-files.lib.bash
│ │ ├── 07-dirnonempty-nonexisting.lib.bash
│ │ └── 08-dirnonempty-with-hidden.lib.bash
│ ├── plugin-mem-usage-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-mpd/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-bad-answer.lib.bash
│ │ ├── 02-simple-template.lib.bash
│ │ ├── 03-simple.lib.bash
│ │ ├── 04-simple-bind.lib.bash
│ │ ├── 05-simple-bind-invalid.lib.bash
│ │ ├── 06-simple-bind-invalid-ipv6.lib.bash
│ │ ├── 07-keepalive.lib.bash
│ │ ├── 08-retry-in.lib.bash
│ │ ├── 09-retry-fifo.lib.bash
│ │ ├── 10-timeout.lib.bash
│ │ ├── 11-password-and-events.lib.bash
│ │ ├── 12-connect-via-unix-socket.lib.bash
│ │ ├── 13-bad-password.lib.bash
│ │ └── 14-bad-hostname.lib.bash
│ ├── plugin-multiplex/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-two-data-sources.lib.bash
│ │ └── 03-call-event.lib.bash
│ ├── plugin-network-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-simple-newfmt.lib.bash
│ ├── plugin-network-rate-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-in-array-form.lib.bash
│ │ └── 03-iface-filter.lib.bash
│ ├── plugin-pipe/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-func-shell-escape.lib.bash
│ ├── plugin-pipev2/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-greet.lib.bash
│ │ ├── 03-bye.lib.bash
│ │ ├── 04-write-to-stdin.lib.bash
│ │ ├── 05-kill-default.lib.bash
│ │ ├── 06-kill-by-spelling.lib.bash
│ │ ├── 07-kill-by-signo.lib.bash
│ │ └── 08-sigrt-bounds.lib.bash
│ ├── plugin-pulse/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-lfuncs.lib.bash
│ ├── plugin-temperature-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-common-carcass.lib.bash
│ │ ├── 02-simple.lib.bash
│ │ ├── 03-filter-by-kind.lib.bash
│ │ └── 04-filter-by-name.lib.bash
│ ├── plugin-timer/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-default.lib.bash
│ │ ├── 02-period.lib.bash
│ │ ├── 03-wakeup-fifo.lib.bash
│ │ ├── 04-lfuncs.lib.bash
│ │ ├── 05-procalive-lfuncs.lib.bash
│ │ └── 06-self-pipe.lib.bash
│ ├── plugin-unixsock/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-greet.lib.bash
│ │ ├── 03-do-not-try-unlink-failure.lib.bash
│ │ ├── 04-do-try-unlink-success.lib.bash
│ │ ├── 05-timeout.lib.bash
│ │ └── 06-lfuncs.lib.bash
│ └── plugin-web/
│ ├── 00-common.lib.bash
│ ├── 01-simple.lib.bash
│ ├── 02-post.lib.bash
│ ├── 03-call-cb.lib.bash
│ ├── 04-with-headers.lib.bash
│ ├── 05-json-encode.lib.bash
│ ├── 06-urlencode.lib.bash
│ ├── 07-urldecode.lib.bash
│ ├── 08-json-decode.lib.bash
│ ├── 09-json-decode-null.lib.bash
│ ├── 10-error.lib.bash
│ ├── 11-timeout.lib.bash
│ ├── 12-not-avail.lib.bash
│ ├── 13-time-now.lib.bash
│ └── 14-get-supported-opts.lib.bash
├── pulsetalker.sh
├── stopwatch.c
├── torture.sh
└── utils.lib.bash
================================================
FILE CONTENTS
================================================
================================================
FILE: .circleci/config.yml
================================================
version: 2.1
workflows:
nanodesu:
jobs:
- subetedesu:
matrix:
parameters:
luaver: ["lua5.1/liblua5.1-dev", "luajit/libluajit-5.1-dev", "lua5.2/liblua5.2-dev", "lua5.3/liblua5.3-dev"]
jobs:
subetedesu:
docker:
- image: cimg/base:2021.01-20.04
parameters:
luaver:
type: string
steps:
- checkout
- run: ./check_style.sh
- run: sudo apt-get update
- run: v=<< parameters.luaver >>; sudo apt-get install -y ${v#*/} lua-socket lua-sec python3-docutils python3-dbus cmake valgrind pulseaudio pulseaudio-utils dbus dbus-x11 jq libxcb1-dev libyajl-dev libasound2-dev libglib2.0-dev libpulse-dev libudev-dev libnl-3-dev libnl-genl-3-dev libx11-dev libxcb1-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-util0-dev libwebsockets-dev libcurl4-gnutls-dev libcjson-dev
- run: v=<< parameters.luaver >>; cmake -DWITH_LUA_LIBRARY=${v%/*} -DBUILD_PLUGIN_PULSE=ON -DBUILD_PLUGIN_UNIXSOCK=ON -DBUILD_PLUGIN_WEB=ON -DBUILD_TESTS=ON .
- run: make -j
- run: ./tests/torture.sh .
- run: v=<< parameters.luaver >>; LUAVER=$v PLUGIN_DBUS_OPTIONAL=1 ./.circleci/run-pt.sh
================================================
FILE: .circleci/run-pt.sh
================================================
#!/usr/bin/env bash
set -e
atexit=()
trap '
# We need to run finalizers in reversed order.
for (( i = ${#atexit[@]} - 1; i >= 0; --i )); do
func=${atexit[$i]}
$func
done
' EXIT
pa_start() {
atexit+=(pa_end)
pulseaudio --daemonize=no --disallow-exit=yes --exit-idle-time=-1 &
while ! pactl info; do
echo >&2 "Waiting for PulseAudio daemon..."
sleep 1
done
}
pa_end() {
pulseaudio --kill || true
}
dbus_start() {
DBUS_DAEMON_PID=
atexit+=(dbus_end)
local addr_file=/tmp/dbus-session-addr.txt
true > "$addr_file" || return $?
dbus-daemon --session --nofork --print-address=3 3>"$addr_file" &
DBUS_DAEMON_PID=$!
local x
while ! IFS= read -r x < "$addr_file"; do
echo >&2 "Waiting for D-Bus daemon..."
sleep 1 || return $?
done
rm -f "$addr_file" || return $?
export DBUS_SESSION_BUS_ADDRESS="$x"
}
dbus_end() {
if [[ -n "$DBUS_DAEMON_PID" ]]; then
kill "$DBUS_DAEMON_PID" || true
fi
}
dbus_start
sleep 1
pa_start
#PT_TOOL=valgrind PT_MAX_LAG=250 ./tests/pt.sh .
PT_MAX_LAG=300 ./tests/pt.sh .
================================================
FILE: .gitignore
================================================
*.o
*.so
/_gitignored/
# CMake
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
build/
# generated headers
*.generated.[ch]
# generated man pages
luastatus*.[1-8]
================================================
FILE: .luacheckrc
================================================
new_globals = {'widget'}
new_read_globals = {'luastatus'}
ignore = {
'631', -- "Line is too long"
}
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required (VERSION 3.1.3...3.10)
project (luastatus C)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif ()
set (CMAKE_C_STANDARD 99)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
#------------------------------------------------------------------------------
option (WITH_UBSAN "build with UBSAN (undefined behavior sanitizer)" OFF)
if (${WITH_UBSAN})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fsanitize-trap=all -fno-sanitize-recover=all")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=local-bounds")
endif ()
endif ()
option (WITH_ASAN "build with ASAN (address sanitizer)" OFF)
if (${WITH_ASAN})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-trap=all -fno-sanitize-recover=all")
endif ()
option (WITH_TSAN "build with TSAN (thread sanitizer)" OFF)
if (${WITH_TSAN})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fsanitize-trap=all -fno-sanitize-recover=all")
endif ()
option (WITH_LSAN "build with LSAN (memory leak sanitizer)" OFF)
if (${WITH_LSAN})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak -fsanitize-trap=all -fno-sanitize-recover=all")
endif ()
#------------------------------------------------------------------------------
find_package (PkgConfig REQUIRED)
set (WITH_LUA_LIBRARY "-" CACHE STRING "Lua library name")
if (NOT "${WITH_LUA_LIBRARY}" STREQUAL "-")
pkg_search_module (LUA REQUIRED "${WITH_LUA_LIBRARY}")
else ()
pkg_search_module (LUA REQUIRED
lua54 lua-5.4 lua5.4
lua53 lua-5.3 lua5.3
lua52 lua-5.2 lua5.2
lua51 lua-5.1 lua5.1
luajit
lua)
endif ()
function (luastatus_target_compile_with target var)
target_include_directories (${target} SYSTEM PUBLIC
${${var}_INCLUDE_DIRS})
target_compile_options (${target} PUBLIC
${${var}_CFLAGS_OTHER})
endfunction ()
function (luastatus_target_build_with target var)
luastatus_target_compile_with ("${target}" "${var}")
target_link_libraries (${target} PUBLIC ${${var}_LIBRARIES})
endfunction ()
#------------------------------------------------------------------------------
include (GNUInstallDirs)
set (BARLIBS_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/luastatus/barlibs")
set (PLUGINS_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/luastatus/plugins")
set (LUA_PLUGINS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/luastatus/plugins")
function (luastatus_add_barlib_or_plugin destdir name)
set (sources ${ARGV})
list (REMOVE_AT sources 0 1)
add_library ("${name}" MODULE ${sources})
set_target_properties ("${name}" PROPERTIES PREFIX "")
if (NOT "${destdir}" STREQUAL "-")
install (TARGETS "${name}" DESTINATION "${destdir}")
endif ()
endfunction ()
function (luastatus_add_barlib)
luastatus_add_barlib_or_plugin ("${BARLIBS_DIR}" ${ARGV})
endfunction ()
function (luastatus_add_plugin)
luastatus_add_barlib_or_plugin ("${PLUGINS_DIR}" ${ARGV})
endfunction ()
function (luastatus_add_barlib_noinstall)
luastatus_add_barlib_or_plugin ("-" ${ARGV})
endfunction ()
function (luastatus_add_plugin_noinstall)
luastatus_add_barlib_or_plugin ("-" ${ARGV})
endfunction ()
option (BUILD_DOCS "build man pages" ON)
function (luastatus_add_man_page src basename section)
if (NOT BUILD_DOCS)
return ()
endif ()
set (dest "${basename}.${section}")
add_custom_command (
OUTPUT "${dest}"
COMMAND "${PROJECT_SOURCE_DIR}/generate-man.sh" ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${dest}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
MAIN_DEPENDENCY "${src}"
VERBATIM)
add_custom_target ("man${section}-${basename}" ALL DEPENDS "${dest}")
install (
FILES "${CMAKE_CURRENT_BINARY_DIR}/${dest}"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man${section}")
endfunction ()
#------------------------------------------------------------------------------
add_subdirectory (libls)
add_subdirectory (libsafe)
add_subdirectory (libhackyfix)
add_subdirectory (librunshell)
add_subdirectory (libmoonvisit)
add_subdirectory (libwidechar)
add_subdirectory (libprocalive)
add_subdirectory (luastatus)
#------------------------------------------------------------------------------
macro (DEF_OPT optname subdir defvalue)
option (${optname} "build ${subdir}" ${defvalue})
if (${optname})
add_subdirectory (${subdir})
endif ()
endmacro ()
DEF_OPT (BUILD_BARLIB_DWM "barlibs/dwm" ON)
DEF_OPT (BUILD_BARLIB_I3 "barlibs/i3" ON)
DEF_OPT (BUILD_BARLIB_LEMONBAR "barlibs/lemonbar" ON)
DEF_OPT (BUILD_BARLIB_STDOUT "barlibs/stdout" ON)
DEF_OPT (BUILD_PLUGIN_ALSA "plugins/alsa" ON)
DEF_OPT (BUILD_PLUGIN_BACKLIGHT_LINUX "plugins/backlight-linux" ON)
DEF_OPT (BUILD_PLUGIN_BATTERY_LINUX "plugins/battery-linux" ON)
DEF_OPT (BUILD_PLUGIN_CPU_FREQ_LINUX "plugins/cpu-freq-linux" ON)
DEF_OPT (BUILD_PLUGIN_CPU_USAGE_LINUX "plugins/cpu-usage-linux" ON)
DEF_OPT (BUILD_PLUGIN_DBUS "plugins/dbus" ON)
DEF_OPT (BUILD_PLUGIN_DISK_IO_LINUX "plugins/disk-io-linux" ON)
DEF_OPT (BUILD_PLUGIN_FILE_CONTENTS_LINUX "plugins/file-contents-linux" ON)
DEF_OPT (BUILD_PLUGIN_FS "plugins/fs" ON)
DEF_OPT (BUILD_PLUGIN_IMAP "plugins/imap" ON)
DEF_OPT (BUILD_PLUGIN_INOTIFY "plugins/inotify" ON)
DEF_OPT (BUILD_PLUGIN_IS_PROGRAM_RUNNING "plugins/is-program-running" ON)
DEF_OPT (BUILD_PLUGIN_MEM_USAGE_LINUX "plugins/mem-usage-linux" ON)
DEF_OPT (BUILD_PLUGIN_MPD "plugins/mpd" ON)
DEF_OPT (BUILD_PLUGIN_MPRIS "plugins/mpris" ON)
DEF_OPT (BUILD_PLUGIN_MULTIPLEX "plugins/multiplex" ON)
DEF_OPT (BUILD_PLUGIN_NETWORK_LINUX "plugins/network-linux" ON)
DEF_OPT (BUILD_PLUGIN_NETWORK_RATE_LINUX "plugins/network-rate-linux" ON)
DEF_OPT (BUILD_PLUGIN_PIPE "plugins/pipe" OFF)
DEF_OPT (BUILD_PLUGIN_PIPEV2 "plugins/pipev2" ON)
DEF_OPT (BUILD_PLUGIN_PULSE "plugins/pulse" OFF)
DEF_OPT (BUILD_PLUGIN_SYSTEMD_UNIT "plugins/systemd-unit" OFF)
DEF_OPT (BUILD_PLUGIN_TEMPERATURE_LINUX "plugins/temperature-linux" ON)
DEF_OPT (BUILD_PLUGIN_TIMER "plugins/timer" ON)
DEF_OPT (BUILD_PLUGIN_UDEV "plugins/udev" ON)
DEF_OPT (BUILD_PLUGIN_UNIXSOCK "plugins/unixsock" OFF)
DEF_OPT (BUILD_PLUGIN_WEB "plugins/web" OFF)
DEF_OPT (BUILD_PLUGIN_XKB "plugins/xkb" ON)
DEF_OPT (BUILD_PLUGIN_XTITLE "plugins/xtitle" ON)
DEF_OPT (BUILD_TESTS "tests" OFF)
================================================
FILE: COPYING.LESSER.txt
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
================================================
FILE: COPYING.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: DEPENDS.txt
================================================
luastatus itself, without any barlibs and/or plugins, has the following dependencies:
* docutils >=0.11 (rst2man program)
* CMake >=3.1.3
* pkg-config >=0.25
* either Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, or LuaJIT >=2.0.0
For running tests, you will also need:
* valgrind (some older versions don't like LuaJIT; >=3.11.0 are known to be OK)
* For 'i3' barlib tests: 'jq' binary
* For 'dbus' plugin tests: a D-Bus daemon running in session mode; 'dbus-send' binary
* For 'pulse' plugin tests: a running PulseAudio daemon; 'pactl' and 'pacmd' binaries
* For 'web' plugin tests: 'libwebsockets' library (to build 'httpserv' program)
Barlib 'dwm' has the following dependencies:
* xcb >=1.10
Barlib 'i3' has the following dependencies:
* yajl >=2.0.4
Plugin 'alsa' has the following dependencies:
* alsa >=1.0.27.2
Plugin 'backlight-linux' has the following dependencies:
* plugin 'udev'
Plugin 'battery-linux' has the following dependencies:
* plugin 'udev'
Plugin 'cpu-freq-linux' has the following dependencies:
* plugin 'timer'
Plugin 'cpu-usage-linux' has the following dependencies:
* plugin 'timer'
Plugin 'dbus' has the following dependencies:
* glib-2.0 >=2.40.2
* gio-2.0 >=2.40.2
Plugin 'disk-io-linux' has the following dependencies:
* plugin 'timer'
Plugin 'file-contents-linux' has the following dependencies:
* plugin 'inotify'
Plugin 'imap' has the following dependencies:
* LuaSocket library for the Lua version that luastatus was built with
* LuaSec library for the Lua version that luastatus was built with
Plugin 'is-program-running' has the following dependencies:
* plugin 'timer'
Plugin 'inotify' has the following dependencies:
* a Linux system with a libc that provides <sys/inotify.h> (preferably glibc)
Plugin 'mem-usage-linux' has the following dependencies:
* plugin 'timer'
Plugin 'mpris' has the following dependencies:
* plugin 'dbus'
Plugin 'network-linux' has the following dependencies:
* a Linux system with Linux kernel headers
* libnl >=3.0
* libnl-genl >=3.0
Plugin 'network-rate-linux' has the following dependencies:
* plugin 'timer'
Plugin 'pipe' has the following dependencies:
* plugin 'timer'
Plugin 'pulse' has the following dependencies:
* libpulse >=4.0
Plugin 'systemd-unit' has the following dependencies:
* plugin 'dbus'
Plugin 'temperature-linux' has the following dependencies:
* plugin 'timer'
Plugin 'udev' has the following dependencies:
* libudev >=204
Plugin 'web' has the following dependencies:
* cJSON >=1.7.10
* libcurl >=7.8
Plugin 'xkb' has the following dependencies:
* x11 >=1.6.2
Plugin 'xtitle' has the following dependencies:
* xcb >=1.10
* xcb-ewmh >=0.4.1
* xcb-icccm >=0.4.1
* xcb-event >=0.3.8
================================================
FILE: DOCS/CUSTOM_DATA_SRC_WIDGET.md
================================================
Writing a widget that uses custom data source
===
A “custom data source” widget is a fancy way to refer to a widget that wants to wait for events
and/or receive data using some blocking Lua operation (most commonly using some external Lua
module), rather than using some luastatus plugin.
The luastatus project explicitly supports this flow; in fact, the “separate state” thing is there
exactly to help such widgets react to events timely.
The basic mechanism is (details may vary for different widgets):
* Specify `timer` as a plugin, with `period = 0` in plugin options (`opts`).
* Do the following in the callback function (`cb`):
+ wait for next event (unless this is the first time `cb` is called);
+ generate data for barlib and return it.
* If need to handle events, use separate-state event handler.
Tricks to know about
---
* Use `luastatus.plugin.push_period(seconds)` function of the `timer` plugin to force it to sleep
for a specified number of seconds after barlib receives your data. Note that this is a
“*push* timeout” operation, not “*set* timeout”, meaning that it will only be respected for a single
iteration, and then “popped” (forgotten).
* Use the argument to `cb` provided by the `timer` plugin to tell if this is the first time `cb`
is called: the argument is a string, and it is `"hello"` if and only if this is the first time.
* The `timer` plugin supports wakeup FIFO. This might be useful if `push_period` is used in case of
error, as a way to force an earlier re-try. The FIFO may be touched from inside the event handler,
or from anywhere else.
List of derived plugins using custom data sources
---
* imap;
* pipe.
List of widget examples using custom data sources
---
* btc-price;
* gmail;
* update-on-click;
* weather.
================================================
FILE: DOCS/MIGRATION_GUIDE.md
================================================
0.2.0 to 0.3.0
===
* Semantics of the `greet` option of `inotify` plugin has changed;
see `plugins/inotify/README.md` for details.
0.1.0 to 0.2.0
===
* `luastatus.spawn`, `luastatus.rc` and `luastatus.dollar` functions have been removed.
Use `os.execute` and/or `io.popen` instead — and please don’t forget to properly escape the arguments:
````lua
function shell_escape(s)
return "'" .. s:gsub("'", "'\\''") .. "'"
end
````
* `pipe` plugin has been removed. Use the `timer` plugin and `io.open` instead:
````lua
f = io.popen('your command', 'r')
wdiget = {
plugin = 'timer',
cb = function()
local line = f:read('*line')
-- ...
end,
}
````
================================================
FILE: DOCS/WRITING_BARLIB_OR_PLUGIN.md
================================================
Thread-safety
===
Each non-thread-safe thing must be synchronized with other entities by means of the `map_get`
function (see `DOCS/design/map_get.md`).
Environment variables
===
Your plugin or barlib must not modify environment variables (this includes `unsetenv()`, `setenv()`,
`putenv()`, and modifying `environ`).
Signals
===
Your plugin or barlib can install signal handlers, but:
1. this must be done with `sigaction()`, and `sa_mask` field of `struct sigaction` must include
`SA_RESTART`;
2. use the `map_get` facility to ensure there are no conflicting handlers installed; use, for
example, the key of `"flag:signal_handled:SIGUSR1"` for signal `SIGUSR1`; the value behind the
key should be checked to be null and then set to some non-null pointer. For POSIX real-time
signals, use `"SIGRTMIN+%d"` nomenclature, where `%d` is a non-negative offset in decimal.
Your plugin or barlib can call `pthread_sigmask()` (and, consequently, `pselect()`).
Writing a plugin
===
Copy `include/plugin_data.h`, `include/plugin_data_v1.h`, `include/plugin_v1.h` and `include/common.h`;
include `include/plugin_v1.h` and start reading `include/plugin_data.h`.
Then, declare a global `const LuastatusIfacePlugin luastatus_iface_plugin_v1` variable.
Writing a barlib
===
Copy `include/barlib_data.h`, `include/barlib_data_v1.h`, `include/barlib_v1.h` and `include/common.h`;
include `include/barlib_v1.h` and start reading `include/barlib_data.h`.
Then, declare a global `const LuastatusIfaceBarlib luastatus_iface_barlib_v1` variable.
================================================
FILE: DOCS/c_notes/eintr-policy.md
================================================
The main problem is that all the stdio functions may, according to POSIX, fail with `EINTR`, and there is no way to restart some of them, e.g. `fprintf`.
Our solution is to ensure that `SA_RESTART` is set for all the signals that could be raised (without terminating the program).
See also: http://man7.org/linux/man-pages/man7/signal.7.html, section "Interruption of system calls and library functions by signal handlers".
================================================
FILE: DOCS/c_notes/empty-ranges-and-c-stdlib.md
================================================
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
Subclause 7.1.4 Use of library functions, point 1:
> Each of the following statements applies unless explicitly stated otherwise in the
> detailed descriptions that follow: If an argument to a function has an invalid value (such
> as a value outside the domain of the function, or a pointer outside the address space of
> the program, or a null pointer, or a pointer to non-modifiable storage when the
> corresponding parameter is not const-qualified) or a type (after promotion) not expected
> by a function with variable number of arguments, the behavior is undefined. If a function
> argument is described as being an array, the pointer actually passed to the function shall
> have a value such that all address computations and accesses to objects (that would be
> valid if the pointer did point to the first element of such an array) are in fact valid.
It’s not OK to call any function defined in `<string.h>` with a pointer that can’t be dereferenced:
Subclause 7.21.1 String handling conventions, point 2:
> Where an argument declared as `size_t n` specifies the length of the array for a function, `n`
> can have the value zero on a call to that function. Unless explicitly stated otherwise in
> the description of a particular function in this subclause, pointer arguments on such a
> call shall still have valid values, as described in 7.1.4. On such a call, a function
> that locates a character finds no occurrence, a function that compares two character
> sequences returns zero, and a function that copies characters copies zero characters.
It’s not OK to call `qsort`/`bsearch` with a pointer that can’t be dereferenced:
Subclause 7.20.5 Searching and sorting utilites, point 1:
> These utilities make use of a comparison function to search or sort arrays of unspecified
> type. Where an argument declared as `size_t nmemb` specifies the length of the array for a
> function, `nmemb` can have the value zero on a call to that function; the comparison function
> is not called, a search finds no matching element, and sorting performs no rearrangement.
> Pointer arguments on such a call shall still have valid values, as described in 7.1.4.
However, it’s OK to call `snprintf`/`vsnprintf` with a pointer that can’t be dereferenced, as long as `n` is zero:
Subclause 7.19.6.5 The `snprintf` function, point 2:
> The `snprintf` function is equivalent to `fprintf`, except that the output is written into an
> array (specified by argument `s`) rather than to a stream. If `n` is zero, nothing is written, and
> `s` may be a null pointer. Otherwise, output characters beyond the `n-1`st are discarded rather
> than being written to the array, and a null character is written at the end of the characters
> actually written into the array. If copying takes place between objects that overlap, the behavior
> is undefined.
================================================
FILE: DOCS/design/locking-patterns.md
================================================
The list of locking patterns of the main luastatus binary; run
grep -Ew '(UN)?LOCK_[A-Z]' luastatus/luastatus.c
to verify it is up-to-date.
It can be said that our order is: E < L < B.
We also don't lock the same mutex twice in any of the “procedures”.
This suffices to say there are no deadlocks.
(We also have the `tests/torture.sh` test!)
cb-gets-called() {
lock L
lock B
unlock B
unlock L
}
plugin-begins-call-and-cancels() {
lock L
unlock L
}
#-----------------------------------------------
event-gets-called-and-raises-error-E() {
lock E
lock B
unlock B
unlock E
}
events-gets-called-and-succeeds-E() {
lock E
unlock E
}
barlib-ew-begins-call-and-cancels-E() {
lock E
unlock E
}
#-----------------------------------------------
event-gets-called-and-raises-error-L() {
lock L
lock B
unlock B
unlock L
}
events-gets-called-and-succeeds-L() {
lock L
unlock L
}
barlib-ew-begins-call-and-cancels-L() {
lock L
unlock L
}
#-----------------------------------------------
set-error-when-plugin-run-returned() {
lock B
unlock B
}
set-error-when-widget-init-failed() {
lock B
unlock B
}
================================================
FILE: DOCS/design/map_get.md
================================================
Overview
===
luastatus provides the following function to barlibs and plugins:
```c
void ** (*map_get)(void *userdata, const char *key);
```
This function is **not** thread-safe and should only be used in the `init` function.
luastatus maintains a global mapping from zero-terminated strings to pointers (`void *`).
`map_get` returns a pointer to the pointer corresponding to the given key; if a map entry with the given key does not exist, it creates one with a null pointer value.
You can read and/or write from/to this pointer-to-pointer; it is guaranteed to be persistent across other calls to `map_get` and other functions.
Its intended use is for synchronization.
================================================
FILE: README.md
================================================
[](https://circleci.com/gh/shdown/luastatus)

**luastatus** is a universal status bar content generator. It allows you to configure the way the
data from event sources is processed and shown, with Lua.
Its main feature is that the content can be updated immediately as some event occurs, be it a change
of keyboard layout, active window title, volume or a song in your favorite music player (provided
that there is a plugin for it) — a thing rather uncommon for tiling window managers.
Its motto is:
> No more heavy-forking, second-lagging shell-script status bar generators!
Screenshot
===

Above is i3bar with luastatus with Bitcoin price, time, volume, and keyboard layout widgets.
Key concepts
===

In short:
* plugin is a thing that decides when to call the callback function `widget.cb` and what to pass to it;
* barlib (**bar** **lib**rary) is a thing that decides what to with values that `widget.cb` function returns;
* there are also *derived plugins*, which are plugins written in Lua that use regular plugins.
Examples
===
ALSA volume widget:
```lua
widget = {
plugin = 'alsa',
opts = {
channel = 'PCM'
},
cb = function(t)
if t.mute then
return {full_text = '[mute]', color = '#e03838'}
else
local percent = (t.vol.cur - t.vol.min)
/ (t.vol.max - t.vol.min)
* 100
return {full_text = string.format('[%3d%%]', math.floor(0.5 + percent)),
color = '#718ba6'}
end
end,
event = function(t)
if t.button == 1 then -- left mouse button
os.execute('urxvt -e alsamixer &')
end
end
}
```
GMail widget (uses the derived plugin `imap`):
```lua
--[[
-- Expects 'credentials.lua' to be present in the current directory; it may contain, e.g.,
-- return {
-- gmail = {
-- login = 'john.smith',
-- password = 'qwerty'
-- }
-- }
--]]
credentials = require 'credentials'
widget = luastatus.require_plugin('imap').widget{
host = 'imap.gmail.com',
port = 993,
mailbox = 'Inbox',
use_ssl = true,
timeout = 2 * 60,
handshake_timeout = 10,
login = credentials.gmail.login,
password = credentials.gmail.password,
error_sleep_period = 60,
cb = function(unseen)
if unseen == nil then
return nil
elseif unseen == 0 then
return {full_text = '[-]', color = '#595959'}
else
return {full_text = string.format('[%d unseen]', unseen)}
end
end,
event = [[ -- separate-state event function
local t = ... -- obtain argument of this implicit function
if t.button == 1 then -- left mouse button
os.execute('xdg-open https://gmail.com &')
end
]]
}
```
See more examples [here](https://github.com/shdown/luastatus/tree/master/examples).
Installation
===
`cmake . && make && sudo make install`
You can specify a Lua library to build with: `cmake -DWITH_LUA_LIBRARY=luajit .`
You can disable building certain barlibs and plugins, e.g. `cmake -DBUILD_PLUGIN_XTITLE=OFF .`
You can disable building man pages: `cmake -DBUILD_DOCS=OFF .`
ArchLinux
---
ArchLinux users can use one of the following AUR packages:
* [luastatus](https://aur.archlinux.org/packages/luastatus)
* [luastatus-luajit](https://aur.archlinux.org/packages/luastatus-luajit)
* [luastatus-git](https://aur.archlinux.org/packages/luastatus-git)
* [luastatus-luajit-git](https://aur.archlinux.org/packages/luastatus-luajit-git)
There is also the [luastatus-meta](https://aur.archlinux.org/packages/luastatus-meta)
meta package which installs the dependencies of all of luastatus's plugins.
Getting started
===
It is recommended to first have a look at the
[luastatus' man page](https://github.com/shdown/luastatus/blob/master/luastatus/README.rst).
Then, read the barlib's and plugins' documentation, either via directly viewing
`barlibs/<name>/README.rst` and `plugins/<name>/README.rst` files, or via installing the man pages
and reading `luastatus-barlib-<name>(7)` and `luastatus-plugin-<name>(7)`.
Barlib-specific notes on usage follow.
i3 or sway
----------
`luastatus-i3-wrapper` should be specified as the i3bar's or sway-bar's status command in the config, e.g.:
```
bar {
status_command cd ~/.config/luastatus && exec luastatus-i3-wrapper -B no_separators time-battery-combined.lua alsa.lua xkb.lua
```
Since sway-bar is format-compatible with i3wm, the exact same configuration works for both.
See also [README for i3](https://github.com/shdown/luastatus/blob/master/barlibs/i3/README.rst) and
[examples for i3](https://github.com/shdown/luastatus/tree/master/examples/i3).
dwm
---
luastatus should simply be launched with `-b dwm`, e.g.:
```
luastatus -b dwm -B separator=' • ' alsa.lua time-battery-combined.lua
```
See also [README for dwm](https://github.com/shdown/luastatus/blob/master/barlibs/dwm/README.rst)
and [examples for dwm](https://github.com/shdown/luastatus/tree/master/examples/dwm).
lemonbar
--------
`lemonbar` should be launched with `luastatus-lemonbar-launcher`, e.g.:
```
luastatus-lemonbar-launcher -p -B#111111 -p -f'Droid Sans Mono for Powerline:pixelsize=12:weight=Bold' -- -Bseparator=' ' alsa.lua time-date.lua
```
See also
[README for lemonbar](https://github.com/shdown/luastatus/blob/master/barlibs/lemonbar/README.rst)
and [examples for lemonbar](https://github.com/shdown/luastatus/tree/master/examples/lemonbar).
stdout
------
luastatus should be launched with `luastatus-stdout-wrapper`; or write your own wrapper, see e.g.
the [wrapper for launching dvtm with luastatus](https://github.com/shdown/luastatus/blob/master/barlibs/stdout/luastatus-dvtm).
See also
[README for stdout](https://github.com/shdown/luastatus/blob/master/barlibs/stdout/README.rst) and
and [examples for stdout](https://github.com/shdown/luastatus/tree/master/examples/stdout).
Supported Lua versions
===
* 5.1
* LuaJIT, which is currently 5.1-compatible with "some language and library extensions from Lua 5.2"
* 5.2
* 5.3
* 5.4
* 5.5
Reporting bugs, requesting features, suggesting patches
===
Feel free to open an issue or a pull request.
Migrating from older versions
===
See the [Migration Guide](https://github.com/shdown/luastatus/blob/master/DOCS/MIGRATION_GUIDE.md).
Testing
===
Here, at luastatus, we take code correctness and safety very seriously.
We do the following things:
* We use best practices for C programming:
- All non-trivial string processing goes through libsafe
- We mark printf-like functions with appropriate attributes in order to get warnings on illegal format string or wrong argument types
- We handle every error possible (except for cases where we can't, and don't want to, do anything about an error)
- We pay attention to integer overflows/underflows, conversion of integers to/from floating-point types, and other possible cases of undefined behavior
- We use typedef'd enum types instead of "untyped" integers to represent enum's values so that we can get warnings when a switch does not account for some value
- We use macros for (re)allocations that make it impossible to get types wrong
* We compile with `-Wall -Wextra`
* We have a comprehensive test suite; it contains tests for luastatus, barlibs and plugins, and also includes "torture"-style tests (a.k.a. stress tests)
which bombard luastatus with a lot of events from a plugin and a barlib simultaneously:
* It passes under valgrind [memcheck tool]
* It passes under valgrind [helgrind tool]
* It passes under UBSAN (Undefined Behavior Sanitizer)
* It passes under ASAN (Address Sanitizer)
* It passes under LSAN (Leak Sanitizer)
* It passes under TSAN (Thread Sanitizer)
* Everything that theoretically can be an attack surface is fuzzed, under UBSAN, with both AFL and AFL++; we also have a sophisticated fuzz testcase generator (in `fuzz_utils/gen_testcases/`)
We tried to use additional compiler warnings, `-fanalyzer`, and external linters/static analyzers, but
these tools only gave false positives, except for PVS-Studio, which found one actual bug, but with a lot of false positives.
So we don't use any of these on a regular basis.
================================================
FILE: barlibs/dwm/CMakeLists.txt
================================================
file (GLOB sources "*.c")
luastatus_add_barlib (barlib-dwm $<TARGET_OBJECTS:ls> ${sources})
target_compile_definitions (barlib-dwm PUBLIC -D_POSIX_C_SOURCE=200809L)
luastatus_target_compile_with (barlib-dwm LUA)
target_include_directories (barlib-dwm PUBLIC "${PROJECT_SOURCE_DIR}")
find_package (PkgConfig REQUIRED)
pkg_check_modules (XCB REQUIRED xcb)
luastatus_target_build_with (barlib-dwm XCB)
luastatus_add_man_page (README.rst luastatus-barlib-dwm 7)
================================================
FILE: barlibs/dwm/README.rst
================================================
.. :X-man-page-only: luastatus-barlib-dwm
.. :X-man-page-only: #####################
.. :X-man-page-only:
.. :X-man-page-only: ##########################
.. :X-man-page-only: dwm barlib for luastatus
.. :X-man-page-only: ##########################
.. :X-man-page-only:
.. :X-man-page-only: :Copyright: LGPLv3
.. :X-man-page-only: :Manual section: 7
Overview
========
This barlib updates the name of the root window.
It joins all non-empty strings returned by widgets by a separator, which defaults to ``" | "``.
It does not provide functions and does not support events.
``cb`` return value
===================
Either of:
* a string
An empty string hides the widget.
* an array of strings
Equivalent to returning a string with all non-empty elements of the array joined by the separator.
* ``nil``
Hides the widget.
Options
=======
The following options are supported:
* ``display=<name>``
Set the name of a display to connect to. Default is to use ``DISPLAY`` environment variable.
* ``separator=<string>``
Set the separator.
================================================
FILE: barlibs/dwm/dwm.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "include/barlib_v1.h"
#include "include/sayf_macros.h"
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <stdlib.h>
#include <stdbool.h>
#include <lua.h>
#include <lauxlib.h>
#include "libls/ls_alloc_utils.h"
#include "libls/ls_cstring_utils.h"
#include "libls/ls_string.h"
#include "libls/ls_lua_compat.h"
typedef struct {
size_t nwidgets;
LS_String *bufs;
// Temporary buffer for secondary buffering, to avoid unneeded redraws.
LS_String tmpbuf;
// Buffer for the content of the widgets joined by /sep/.
LS_String joined;
char *sep;
xcb_connection_t *conn;
xcb_window_t root;
} Priv;
static void destroy(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
for (size_t i = 0; i < p->nwidgets; ++i)
ls_string_free(p->bufs[i]);
free(p->bufs);
ls_string_free(p->tmpbuf);
ls_string_free(p->joined);
free(p->sep);
if (p->conn)
xcb_disconnect(p->conn);
free(p);
}
// Returns zero on success, non-zero XCB error code on failure. In either case, /*out_conn/ is
// written to, and should be closed with /xcb_disconnect()/.
static int do_connect(
const char *dpyname,
xcb_connection_t **out_conn,
xcb_window_t *out_root)
{
int screenp;
*out_conn = xcb_connect(dpyname, &screenp);
int r = xcb_connection_has_error(*out_conn);
if (r != 0)
return r;
const xcb_setup_t *setup = xcb_get_setup(*out_conn);
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
for (int i = 0; i < screenp; ++i)
xcb_screen_next(&iter);
*out_root = iter.data->root;
return 0;
}
static bool redraw(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
LS_String *joined = &p->joined;
size_t n = p->nwidgets;
LS_String *bufs = p->bufs;
const char *sep = p->sep;
ls_string_clear(joined);
for (size_t i = 0; i < n; ++i) {
if (bufs[i].size) {
if (joined->size) {
ls_string_append_s(joined, sep);
}
ls_string_append_b(joined, bufs[i].data, bufs[i].size);
}
}
xcb_generic_error_t *err = xcb_request_check(
p->conn,
xcb_change_property_checked(
p->conn,
XCB_PROP_MODE_REPLACE,
p->root,
XCB_ATOM_WM_NAME,
XCB_ATOM_STRING,
8,
joined->size,
joined->data
)
);
if (err) {
LS_FATALF(bd, "XCB error %d occurred", err->error_code);
free(err);
return false;
}
return true;
}
static int init(LuastatusBarlibData *bd, const char *const *opts, size_t nwidgets)
{
Priv *p = bd->priv = LS_XNEW(Priv, 1);
*p = (Priv) {
.nwidgets = nwidgets,
.bufs = LS_XNEW(LS_String, nwidgets),
.tmpbuf = ls_string_new_reserve(512),
.joined = ls_string_new_reserve(1024),
.sep = NULL,
.conn = NULL,
};
for (size_t i = 0; i < nwidgets; ++i)
p->bufs[i] = ls_string_new_reserve(512);
// All the options may be passed multiple times!
const char *dpyname = NULL;
const char *sep = NULL;
for (const char *const *s = opts; *s; ++s) {
const char *v;
if ((v = ls_strfollow(*s, "display="))) {
dpyname = v;
} else if ((v = ls_strfollow(*s, "separator="))) {
sep = v;
} else {
LS_FATALF(bd, "unknown option '%s'", *s);
goto error;
}
}
p->sep = ls_xstrdup(sep ? sep : " | ");
int r = do_connect(dpyname, &p->conn, &p->root);
if (r != 0) {
LS_FATALF(bd, "can't connect to display: XCB error %d", r);
goto error;
}
// Clear the current name.
if (!redraw(bd))
goto error;
return LUASTATUS_OK;
error:
destroy(bd);
return LUASTATUS_ERR;
}
static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
{
Priv *p = bd->priv;
LS_String *buf = &p->tmpbuf;
ls_string_clear(buf);
// L: ? data
switch (lua_type(L, -1)) {
case LUA_TSTRING:
{
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
ls_string_assign_b(buf, s, ns);
}
break;
case LUA_TNIL:
break;
case LUA_TTABLE:
{
const char *sep = p->sep;
size_t len = ls_lua_array_len(L, -1);
for (size_t i = 1; i <= len; ++i) {
lua_rawgeti(L, -1, i); // L: ? data value
if (lua_isnil(L, -1)) {
goto next;
}
if (!lua_isstring(L, -1)) {
LS_ERRF(bd, "table value: expected string, found %s", luaL_typename(L, -1));
goto invalid_data;
}
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
if (buf->size && ns) {
ls_string_append_s(buf, sep);
}
ls_string_append_b(buf, s, ns);
next:
lua_pop(L, 1); // L: ? data
}
// L: ? data
}
break;
default:
LS_ERRF(bd, "expected table, string or nil, found %s", luaL_typename(L, -1));
goto invalid_data;
}
if (!ls_string_eq(*buf, p->bufs[widget_idx])) {
ls_string_swap(buf, &p->bufs[widget_idx]);
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
}
return LUASTATUS_OK;
invalid_data:
ls_string_clear(&p->bufs[widget_idx]);
return LUASTATUS_NONFATAL_ERR;
}
static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
{
Priv *p = bd->priv;
ls_string_assign_s(&p->bufs[widget_idx], "(Error)");
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
return LUASTATUS_OK;
}
LuastatusBarlibIface luastatus_barlib_iface_v1 = {
.init = init,
.set = set,
.set_error = set_error,
.destroy = destroy,
};
================================================
FILE: barlibs/i3/CMakeLists.txt
================================================
file (GLOB sources "*.c")
luastatus_add_barlib (
barlib-i3
$<TARGET_OBJECTS:ls>
$<TARGET_OBJECTS:safe>
${sources}
)
target_compile_definitions (barlib-i3 PUBLIC -D_POSIX_C_SOURCE=200809L)
luastatus_target_compile_with (barlib-i3 LUA)
target_include_directories (barlib-i3 PUBLIC "${PROJECT_SOURCE_DIR}")
find_package (PkgConfig REQUIRED)
pkg_check_modules (YAJL REQUIRED yajl>=2.0.4)
luastatus_target_build_with (barlib-i3 YAJL)
find_library (MATH_LIBRARY m)
if (MATH_LIBRARY)
target_link_libraries (barlib-i3 PUBLIC ${MATH_LIBRARY})
endif ()
include (GNUInstallDirs)
install (PROGRAMS luastatus-i3-wrapper DESTINATION ${CMAKE_INSTALL_BINDIR})
luastatus_add_man_page (README.rst luastatus-barlib-i3 7)
================================================
FILE: barlibs/i3/README.rst
================================================
.. :X-man-page-only: luastatus-barlib-i3
.. :X-man-page-only: ###################
.. :X-man-page-only:
.. :X-man-page-only: ############################
.. :X-man-page-only: i3/sway barlib for luastatus
.. :X-man-page-only: ############################
.. :X-man-page-only:
.. :X-man-page-only: :Copyright: LGPLv3
.. :X-man-page-only: :Manual section: 7
Overview
========
This barlib talks with i3bar (or sway-bar).
To use this barlib, you need to specify ``luastatus-i3-wrapper`` with appropriate arguments as the
``status_command`` parameter of a bar in the i3 (or sway) configuration file. For example::
bar {
status_command cd ~/.config/luastatus && exec luastatus-i3-wrapper -B no_separators time-battery-combined.lua alsa.lua xkb.lua
Redirections and ``luastatus-i3-wrapper``
=========================================
i3bar and sway-bar require all the data to be written to stdout and read from stdin.
This makes it very easy
to mess things up: Lua's ``print()`` prints to stdout, processes spawned by widgets/plugins inherit
our stdin and stdout, etc.
That's why this barlib requires that stdin and stdout file descriptors are manually redirected.
A shell wrapper, ``luastatus-i3-wrapper``, is shipped with it; it does all the redirections and
executes ``luastatus`` with ``-b i3``, all the required ``-B`` options, and additional arguments
passed by you.
``cb`` return value
===================
Either of:
* an empty table or ``nil``
Hide the widget.
* a table with strings keys
Is interpreted as a single segment (or a "block"). The keys *should not* include ``name``, as it
is set automatically to be able to tell which widget was clicked.
For more information, see http://i3wm.org/docs/i3bar-protocol.html#_blocks_in_detail.
* an array (table with numeric keys)
Is interpreted as an array of segments. To be able to tell which one was clicked, set the
``instance`` field of a segment.
``nil`` elements are ignored.
``event`` argument
==================
A table with all click properties i3bar (or sway-bar) provides.
For more information, see http://i3wm.org/docs/i3bar-protocol.html#_click_events.
Functions
=========
The following functions are provided:
* ``escaped_str = luastatus.barlib.pango_escape(str)``
Escapes text for the Pango markup.
Example
=======
An example that uses all possible features::
function get_user_name()
local f = io.popen('whoami', 'r')
local r = f:read('*line')
f:close()
return r
end
i = 0
widget = {
plugin = 'timer',
opts = {period = 2},
cb = function(t)
i = i + 1
if i == 1 then
return {} -- hides widget; alternatively, you can return nil.
elseif i == 2 then
-- no markup unless you specify markup='pango'
return {full_text = '<Hello!>', color = '#aaaa00'}
elseif i == 3 then
-- see https://developer.gnome.org/pygtk/stable/pango-markup-language.html
return {full_text = 'Hello, <span color="#aaaa00">'
.. luastatus.barlib.pango_escape(get_user_name())
.. '</span>!',
markup = 'pango'}
elseif i == 4 then
i = 0
return {
{full_text = 'Now,', instance = 'now-segment'},
nil, -- nils are ignored so that you can do
-- return {get_time(), get_battery(), get_smth_else()}
-- where, for example, get_battery() returns nil if the battery is full.
{full_text = 'click me!', instance = 'click-me-segment'},
}
end
end,
event = function(t)
local r = {'properties:'}
for k, v in pairs(t) do
table.insert(r, k .. '=' .. tostring(v))
end
os.execute(string.format(
"notify-send 'Click event' '%s'", table.concat(r, ' ')))
end,
}
Options
=======
The following options are supported:
* ``in_fd=<fd>``
File descriptor to read i3bar or sway-bar input from. Usually set by the wrapper.
* ``out_fd=<fd>``
File descriptor to write to. Usually set by the wrapper.
* ``no_click_events``
Tell i3bar (or sway-bar) we don't want to receive click events. This changes its behavior in that
it will interpret "clicks" on segments as if an empty space on the bar was clicked,
particularly, will switch workspaces if you scroll on a segment.
* ``no_separators``
Append ``"separator": false`` to a segment, unless it has a ``separator`` key. Also appends it
to an ``(Error)`` segment.
* ``allow_stopping``
Allow i3bar (or sway-bar) to send luastatus ``SIGSTOP`` when it thinks it becomes invisible, and ``SIGCONT``
when it thinks it becomes visible. Quite a questionable feature.
* ``extra_init_json=<string>``
Extra JSON to output in header, e.g. ``"key1":10,"key2":true``.
This could be of some use because Sway WM seems to be experimenting with additional header
fields (but not yet documenting them), e.g. ``float_event_coords``.
================================================
FILE: barlibs/i3/escape_json_str.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "escape_json_str.h"
#include <stddef.h>
#include "libsafe/safev.h"
#include "libsafe/mut_safev.h"
static const SAFEV HEX_CHARS = SAFEV_STATIC_INIT_FROM_LITERAL("0123456789ABCDEF");
static inline void append_sv(LS_String *dst, SAFEV v)
{
ls_string_append_b(dst, SAFEV_ptr_UNSAFE(v), SAFEV_len(v));
}
void append_json_escaped_str(LS_String *dst, SAFEV v)
{
ls_string_append_c(dst, '"');
char esc_arr[] = {'\\', 'u', '0', '0', '#', '#'};
MUT_SAFEV esc = MUT_SAFEV_new_UNSAFE(esc_arr, sizeof(esc_arr));
size_t n = SAFEV_len(v);
size_t prev = 0;
for (size_t i = 0; i < n; ++i) {
unsigned char c = SAFEV_at(v, i);
if (c < 32 || c == '\\' || c == '"' || c == '/') {
append_sv(dst, SAFEV_subspan(v, prev, i));
MUT_SAFEV_set_at(esc, 4, SAFEV_at(HEX_CHARS, c / 16));
MUT_SAFEV_set_at(esc, 5, SAFEV_at(HEX_CHARS, c % 16));
append_sv(dst, MUT_SAFEV_TO_SAFEV(esc));
prev = i + 1;
}
}
append_sv(dst, SAFEV_subspan(v, prev, n));
ls_string_append_c(dst, '"');
}
================================================
FILE: barlibs/i3/escape_json_str.h
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef escape_json_str_h_
#define escape_json_str_h_
#include "libls/ls_string.h"
#include "libsafe/safev.h"
// Append to /dst/ JSON-escaped C string /v/.
void append_json_escaped_str(LS_String *dst, SAFEV v);
#endif
================================================
FILE: barlibs/i3/event_watcher.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "event_watcher.h"
#include <stdlib.h>
#include <sys/types.h>
#include <stdbool.h>
#include <lua.h>
#include <yajl/yajl_parse.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "include/sayf_macros.h"
#include "libls/ls_tls_ebuf.h"
#include "libls/ls_parse_int.h"
#include "libls/ls_strarr.h"
#include "libls/ls_panic.h"
#include "libls/ls_lua_compat.h"
#include "libls/ls_alloc_utils.h"
#include "libls/ls_freemem.h"
#include "priv.h"
// If this is to be incremented, /lua_checkstack()/ must be called at appropriate times, and the
// depth of the recursion in /push_object()/ be potentially limited somehow.
enum { DEPTH_LIMIT = 10 };
typedef struct {
enum {
TYPE_ARRAY_START,
TYPE_ARRAY_END,
TYPE_MAP_START,
TYPE_MAP_END,
TYPE_STRING_KEY,
TYPE_STRING,
TYPE_NUMBER,
TYPE_BOOL,
TYPE_NULL,
} type;
union {
size_t str_idx;
double num;
bool flag;
} as;
} Token;
typedef struct {
Token *data;
size_t size;
size_t capacity;
} TokenList;
static inline TokenList token_list_new(void)
{
return (TokenList) {NULL, 0, 0};
}
static inline void token_list_push(TokenList *x, Token token)
{
if (x->size == x->capacity) {
x->data = LS_M_X2REALLOC(x->data, &x->capacity);
}
x->data[x->size++] = token;
}
static inline void token_list_clear(TokenList *x)
{
x->data = LS_M_FREEMEM(x->data, &x->size, &x->capacity);
}
static inline void token_list_free(TokenList *x)
{
free(x->data);
}
typedef struct {
// Current JSON nesting depth. Before the initial '[', depth == -1.
int depth;
// Whether the last key (at depth == 1) was "name".
bool last_key_is_name;
// An array in which all the JSON strings, including keys, are stored.
LS_StringArray strarr;
// A flat list of current event's tokens.
TokenList tokens;
// Current event's widget index, or a negative value if is not known yet or invalid.
int widget;
LuastatusBarlibData *bd;
LuastatusBarlibEWFuncs funcs;
} Context;
// Converts a JSON object that starts at the token with index /*idx/ in /ctx->tokens/, to a Lua
// object, and pushes it onto /L/'s stack.
// Advances /*idx/ so that it points to one token past the last token of the object.
static void push_object(lua_State *L, Context *ctx, size_t *idx)
{
Token t = ctx->tokens.data[*idx];
switch (t.type) {
case TYPE_ARRAY_START:
lua_newtable(L); // L: table
++*idx;
for (size_t n = 1; ctx->tokens.data[*idx].type != TYPE_ARRAY_END; ++n) {
push_object(L, ctx, idx); // L: table elem
LS_ASSERT(n <= (size_t) LS_LUA_MAXI);
lua_rawseti(L, -2, n); // L: table
}
break;
case TYPE_MAP_START:
lua_newtable(L); // L: table
++*idx;
while (ctx->tokens.data[*idx].type != TYPE_MAP_END) {
Token key = ctx->tokens.data[*idx];
LS_ASSERT(key.type == TYPE_STRING_KEY);
// To limit the maximum number of slots pushed onto /L/'s stack to /N + O(1)/, where /N/
// is the maximum /ctx->depth/ encountered, we have to push the value first.
// Unfortunately, /lua_settable()/ expects the key to be pushed first. So we simply swap
// them with /lua_insert()/.
++*idx;
push_object(L, ctx, idx); // L: table value
size_t ns;
const char *s = ls_strarr_at(ctx->strarr, key.as.str_idx, &ns);
lua_pushlstring(L, s, ns); // L: table value key
lua_insert(L, -2); // L: table key value
lua_settable(L, -3); // L: table
}
break;
case TYPE_STRING:
{
size_t ns;
const char *s = ls_strarr_at(ctx->strarr, t.as.str_idx, &ns);
lua_pushlstring(L, s, ns);
}
break;
case TYPE_NUMBER:
lua_pushnumber(L, t.as.num);
break;
case TYPE_BOOL:
lua_pushboolean(L, t.as.flag);
break;
case TYPE_NULL:
lua_pushnil(L);
break;
default:
LS_MUST_BE_UNREACHABLE();
}
// Now, /*idx/ points to the last token of the object; increment it by one.
++*idx;
}
static void flush(Context *ctx)
{
Priv *p = ctx->bd->priv;
if (ctx->widget >= 0 && (size_t) ctx->widget < p->nwidgets) {
lua_State *L = ctx->funcs.call_begin(ctx->bd->userdata, ctx->widget);
size_t idx = 0;
push_object(L, ctx, &idx);
LS_ASSERT(idx == ctx->tokens.size);
ctx->funcs.call_end(ctx->bd->userdata, ctx->widget);
}
// reset the context
ctx->last_key_is_name = false;
ls_strarr_clear(&ctx->strarr);
token_list_clear(&ctx->tokens);
ctx->widget = -1;
}
static int token_helper(Context *ctx, Token token)
{
if (ctx->depth == -1) {
if (token.type != TYPE_ARRAY_START) {
LS_ERRF(ctx->bd, "(event watcher) expected '['");
return 0;
}
++ctx->depth;
} else {
if (ctx->depth == 0 && token.type != TYPE_MAP_START) {
LS_ERRF(ctx->bd, "(event watcher) expected '{'");
return 0;
}
token_list_push(&ctx->tokens, token);
switch (token.type) {
case TYPE_ARRAY_START:
case TYPE_MAP_START:
if (++ctx->depth >= DEPTH_LIMIT) {
LS_ERRF(ctx->bd, "(event watcher) nesting depth limit exceeded");
return 0;
}
break;
case TYPE_ARRAY_END:
case TYPE_MAP_END:
if (--ctx->depth == 0) {
flush(ctx);
}
break;
default:
break;
}
}
return 1;
}
static inline size_t append_to_strarr(Context *ctx, const char *buf, size_t nbuf)
{
ls_strarr_append(&ctx->strarr, buf, nbuf);
return ls_strarr_size(ctx->strarr) - 1;
}
static int callback_null(void *vctx)
{
return token_helper(vctx, (Token) {TYPE_NULL, {0}});
}
static int callback_boolean(void *vctx, int value)
{
return token_helper(vctx, (Token) {TYPE_BOOL, {.flag = value}});
}
static int callback_integer(void *vctx, long long value)
{
return token_helper(vctx, (Token) {TYPE_NUMBER, {.num = value}});
}
static int callback_double(void *vctx, double value)
{
return token_helper(vctx, (Token) {TYPE_NUMBER, {.num = value}});
}
static int callback_string(void *vctx, const unsigned char *buf, size_t nbuf)
{
Context *ctx = vctx;
if (ctx->depth == 1 && ctx->last_key_is_name) {
// parse error is OK here, /ctx->widget/ is checked in /flush()/.
ctx->widget = ls_full_strtou_b((const char *) buf, nbuf);
}
return token_helper(ctx, (Token) {
TYPE_STRING,
{.str_idx = append_to_strarr(ctx, (const char *) buf, nbuf)}
});
}
static int callback_start_map(void *vctx)
{
return token_helper(vctx, (Token) {TYPE_MAP_START, {0}});
}
static int callback_map_key(void *vctx, const unsigned char *buf, size_t nbuf)
{
Context *ctx = vctx;
if (ctx->depth == 1) {
ctx->last_key_is_name = (nbuf == 4 && memcmp(buf, "name", 4) == 0);
}
return token_helper(ctx, (Token) {
TYPE_STRING_KEY,
{.str_idx = append_to_strarr(ctx, (const char *) buf, nbuf)}
});
}
static int callback_end_map(void *vctx)
{
return token_helper(vctx, (Token) {TYPE_MAP_END, {0}});
}
static int callback_start_array(void *vctx)
{
return token_helper(vctx, (Token) {TYPE_ARRAY_START, {0}});
}
static int callback_end_array(void *vctx)
{
return token_helper(vctx, (Token) {TYPE_ARRAY_END, {0}});
}
int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs funcs)
{
Priv *p = bd->priv;
if (p->noclickev)
return LUASTATUS_NONFATAL_ERR;
Context ctx = {
.depth = -1,
.last_key_is_name = false,
.strarr = ls_strarr_new(),
.tokens = token_list_new(),
.widget = -1,
.bd = bd,
.funcs = funcs,
};
yajl_callbacks callbacks = {
.yajl_null = callback_null,
.yajl_boolean = callback_boolean,
.yajl_integer = callback_integer,
.yajl_double = callback_double,
.yajl_string = callback_string,
.yajl_start_map = callback_start_map,
.yajl_map_key = callback_map_key,
.yajl_end_map = callback_end_map,
.yajl_start_array = callback_start_array,
.yajl_end_array = callback_end_array,
};
yajl_handle hand = yajl_alloc(&callbacks, NULL, &ctx);
unsigned char buf[1024];
while (1) {
ssize_t nread = read(p->in_fd, buf, sizeof(buf));
if (nread < 0) {
LS_ERRF(bd, "(event watcher) read error: %s", ls_tls_strerror(errno));
goto error;
} else if (nread == 0) {
LS_ERRF(bd, "(event watcher) i3bar closed its end of the pipe");
goto error;
}
switch (yajl_parse(hand, buf, nread)) {
case yajl_status_ok:
break;
case yajl_status_client_canceled:
goto error;
case yajl_status_error:
{
unsigned char *descr = yajl_get_error(hand, /*verbose*/ 1, buf, nread);
LS_ERRF(bd, "(event watcher) yajl parse error: %s", (char *) descr);
yajl_free_error(hand, descr);
}
goto error;
}
}
error:
ls_strarr_destroy(ctx.strarr);
token_list_free(&ctx.tokens);
yajl_free(hand);
return LUASTATUS_ERR;
}
================================================
FILE: barlibs/i3/event_watcher.h
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef event_watcher_h_
#define event_watcher_h_
#include "include/barlib_data_v1.h"
int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs funcs);
#endif
================================================
FILE: barlibs/i3/fuzz_esc_json/.gitignore
================================================
harness
findings
================================================
FILE: barlibs/i3/fuzz_esc_json/build.sh
================================================
#!/bin/sh
if [ -z "$CC" ]; then
echo >&2 "You must set the 'CC' environment variable."
echo >&2 "Hint: you probably want to set 'CC' to 'some-directory/afl-gcc'."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
$CC -Wall -Wextra -O3 -fsanitize=undefined -std=c99 -D_POSIX_C_SOURCE=200809L \
-I"$luastatus_root" \
./harness.c \
../escape_json_str.c \
"$luastatus_root"/libls/ls_string.c \
"$luastatus_root"/libls/ls_alloc_utils.c \
"$luastatus_root"/libls/ls_panic.c \
"$luastatus_root"/libls/ls_cstring_utils.c \
"$luastatus_root"/libsafe/*.c \
-o harness
================================================
FILE: barlibs/i3/fuzz_esc_json/clear.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
rm -rf ./findings
================================================
FILE: barlibs/i3/fuzz_esc_json/fuzz.sh
================================================
#!/bin/sh
set -e
if [ -z "$XXX_AFL_DIR" ]; then
echo >&2 "You must set the 'XXX_AFL_DIR' environment variable."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
mkdir -p ./findings
export UBSAN_OPTIONS=halt_on_error=1
export AFL_EXIT_WHEN_DONE=1
"$XXX_AFL_DIR"/afl-fuzz -i testcases -o findings -t 5 ./harness @@
================================================
FILE: barlibs/i3/fuzz_esc_json/gen_testcases.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--a=1:'\"/' \
--a-range=h:1:0-31 \
--b=1:abc \
--b-range=h:1:127-255 \
--a-is-important \
--length=5-20 \
--num-files=10 \
--random-seed=123
================================================
FILE: barlibs/i3/fuzz_esc_json/harness.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
#include "fuzz_utils/fuzz_utils.h"
#include "../escape_json_str.h"
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "USAGE: harness INPUT_FILE\n");
return 2;
}
int fd_in = open(argv[1], O_RDONLY | O_CLOEXEC);
if (fd_in < 0) {
perror(argv[1]);
abort();
}
FuzzInput input = fuzz_input_new_prealloc(1024);
if (fuzz_input_read(fd_in, &input) < 0) {
perror("read");
abort();
}
LS_String res = ls_string_new_from_s("escape result = ");
append_json_escaped_str(&res, SAFEV_new_UNSAFE(input.data, input.size));
fuzz_utils_used(res.data, res.size);
fuzz_input_free(input);
ls_string_free(res);
close(fd_in);
return 0;
}
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_000
================================================
\"//\
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_001
================================================
""\
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_003
================================================
/\
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_004
================================================
"/cb\"ac"b\
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_006
================================================
baa߫"
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_007
================================================
c"bcc
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_008
================================================
cbcȂbab\
================================================
FILE: barlibs/i3/fuzz_esc_json/testcases/testcase_009
================================================
cbƐbccb
================================================
FILE: barlibs/i3/fuzz_esc_pango/.gitignore
================================================
harness
findings
================================================
FILE: barlibs/i3/fuzz_esc_pango/build.sh
================================================
#!/bin/sh
if [ -z "$CC" ]; then
echo >&2 "You must set the 'CC' environment variable."
echo >&2 "Hint: you probably want to set 'CC' to 'some-directory/afl-gcc'."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
$CC -Wall -Wextra -O3 -fsanitize=undefined -std=c99 -D_POSIX_C_SOURCE=200809L \
-I"$luastatus_root" \
./harness.c \
../pango_escape.c \
"$luastatus_root"/libls/ls_string.c \
"$luastatus_root"/libls/ls_alloc_utils.c \
"$luastatus_root"/libls/ls_panic.c \
"$luastatus_root"/libls/ls_cstring_utils.c \
"$luastatus_root"/libsafe/*.c \
-o harness
================================================
FILE: barlibs/i3/fuzz_esc_pango/clear.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
rm -rf ./findings
================================================
FILE: barlibs/i3/fuzz_esc_pango/fuzz.sh
================================================
#!/bin/sh
set -e
if [ -z "$XXX_AFL_DIR" ]; then
echo >&2 "You must set the 'XXX_AFL_DIR' environment variable."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
mkdir -p ./findings
export UBSAN_OPTIONS=halt_on_error=1
export AFL_EXIT_WHEN_DONE=1
"$XXX_AFL_DIR"/afl-fuzz -i testcases -o findings -t 5 ./harness @@
================================================
FILE: barlibs/i3/fuzz_esc_pango/gen_testcases.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--a=1:'&<>\"' \
--b=1:abc \
--a-is-important \
--length=5-20 \
--num-files=10 \
--random-seed=123
================================================
FILE: barlibs/i3/fuzz_esc_pango/harness.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
#include "fuzz_utils/fuzz_utils.h"
#include "../pango_escape.h"
static void append_to_ls_string(void *ud, SAFEV segment)
{
LS_String *dst = ud;
ls_string_append_b(dst, SAFEV_ptr_UNSAFE(segment), SAFEV_len(segment));
}
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "USAGE: harness INPUT_FILE\n");
return 2;
}
int fd_in = open(argv[1], O_RDONLY | O_CLOEXEC);
if (fd_in < 0) {
perror(argv[1]);
abort();
}
FuzzInput input = fuzz_input_new_prealloc(1024);
if (fuzz_input_read(fd_in, &input) < 0) {
perror("read");
abort();
}
LS_String res = ls_string_new_from_s("pango escape result = ");
pango_escape(
SAFEV_new_UNSAFE(input.data, input.size),
append_to_ls_string,
&res);
fuzz_utils_used(res.data, res.size);
fuzz_input_free(input);
ls_string_free(res);
close(fd_in);
return 0;
}
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_000
================================================
&<>\"&
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_001
================================================
>&&<&\>&b\"">""c\
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_002
================================================
>c>>\&\c"<c\<&>\a&
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_003
================================================
&<\<<cc>cbb""<\<
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_004
================================================
">&aca""><"bb>"baa&
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_005
================================================
&\<b>bcbbb>b\>cc>&ab
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_006
================================================
acb&\ab\a
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_007
================================================
ac>bc
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_008
================================================
bbccba<
================================================
FILE: barlibs/i3/fuzz_esc_pango/testcases/testcase_009
================================================
ababbaabcbbb
================================================
FILE: barlibs/i3/i3.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <lua.h>
#include <lauxlib.h>
#include "include/barlib_v1.h"
#include "include/sayf_macros.h"
#include "libls/ls_string.h"
#include "libls/ls_alloc_utils.h"
#include "libls/ls_parse_int.h"
#include "libls/ls_cstring_utils.h"
#include "libls/ls_tls_ebuf.h"
#include "libls/ls_io_utils.h"
#include "libls/ls_lua_compat.h"
#include "libsafe/safev.h"
#include "priv.h"
#include "event_watcher.h"
#include "escape_json_str.h"
#include "pango_escape.h"
static void destroy(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
for (size_t i = 0; i < p->nwidgets; ++i) {
ls_string_free(p->bufs[i]);
}
free(p->bufs);
ls_string_free(p->tmpbuf);
ls_close(p->in_fd);
if (p->out) {
fclose(p->out);
}
free(p);
}
static int init(LuastatusBarlibData *bd, const char *const *opts, size_t nwidgets)
{
Priv *p = bd->priv = LS_XNEW(Priv, 1);
*p = (Priv) {
.nwidgets = nwidgets,
.bufs = LS_XNEW(LS_String, nwidgets),
.tmpbuf = ls_string_new_reserve(1024),
.in_fd = -1,
.out = NULL,
.noclickev = false,
.noseps = false,
};
for (size_t i = 0; i < nwidgets; ++i)
p->bufs[i] = ls_string_new_reserve(1024);
// All the options may be passed multiple times!
int in_fd = -1;
int out_fd = -1;
const char *extra_init_json = NULL;
bool allow_stopping = false;
for (const char *const *s = opts; *s; ++s) {
const char *v;
if ((v = ls_strfollow(*s, "in_fd="))) {
if ((in_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "in_fd value is not a valid unsigned integer");
goto error;
}
} else if ((v = ls_strfollow(*s, "out_fd="))) {
if ((out_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "out_fd value is not a valid unsigned integer");
goto error;
}
} else if (strcmp(*s, "no_click_events") == 0) {
p->noclickev = true;
} else if (strcmp(*s, "no_separators") == 0) {
p->noseps = true;
} else if (strcmp(*s, "allow_stopping") == 0) {
allow_stopping = true;
} else if ((v = ls_strfollow(*s, "extra_init_json="))) {
extra_init_json = v;
} else {
LS_FATALF(bd, "unknown option '%s'", *s);
goto error;
}
}
// we require /in_fd/ and /out_fd/ to >=3 because making stdin/stdout/stderr CLOEXEC has very
// bad consequences, and we just don't want to complicate the logic.
if (in_fd < 3) {
LS_FATALF(bd, "in_fd is not specified or less than 3");
goto error;
}
if (out_fd < 3) {
LS_FATALF(bd, "out_fd is not specified or less than 3");
goto error;
}
// assign
p->in_fd = in_fd;
if (!(p->out = fdopen(out_fd, "w"))) {
LS_FATALF(bd, "can't fdopen %d: %s", out_fd, ls_tls_strerror(errno));
goto error;
}
// make CLOEXEC
if (ls_make_cloexec(in_fd) < 0) {
LS_FATALF(bd, "can't make fd %d CLOEXEC: %s", in_fd, ls_tls_strerror(errno));
goto error;
}
if (ls_make_cloexec(out_fd) < 0) {
LS_FATALF(bd, "can't make fd %d CLOEXEC: %s", out_fd, ls_tls_strerror(errno));
goto error;
}
// print header
fprintf(p->out, "{\"version\":1,\"click_events\":%s", p->noclickev ? "false" : "true");
if (extra_init_json && extra_init_json[0]) {
fprintf(p->out, ",%s", extra_init_json);
}
if (!allow_stopping) {
fprintf(p->out, ",\"stop_signal\":0,\"cont_signal\":0");
}
fprintf(p->out, "}\n[\n");
fflush(p->out);
if (ferror(p->out)) {
LS_FATALF(bd, "write error: %s", ls_tls_strerror(errno));
goto error;
}
return LUASTATUS_OK;
error:
destroy(bd);
return LUASTATUS_ERR;
}
static bool redraw(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
FILE *out = p->out;
size_t n = p->nwidgets;
LS_String *bufs = p->bufs;
putc('[', out);
bool first = true;
for (size_t i = 0; i < n; ++i) {
if (bufs[i].size) {
if (!first) {
putc(',', out);
}
fwrite(bufs[i].data, 1, bufs[i].size, out);
first = false;
}
}
fputs("],\n", out);
fflush(out);
if (ferror(out)) {
LS_FATALF(bd, "write error: %s", ls_tls_strerror(errno));
return false;
}
return true;
}
static void append_to_lua_buf(void *ud, SAFEV segment)
{
luaL_Buffer *b = ud;
luaL_addlstring(b, SAFEV_ptr_UNSAFE(segment), SAFEV_len(segment));
}
static int l_pango_escape(lua_State *L)
{
size_t ns;
// WARNING: luaL_check*() functions do a long jump on error!
const char *s = luaL_checklstring(L, 1, &ns);
luaL_Buffer b;
luaL_buffinit(L, &b);
SAFEV v = SAFEV_new_UNSAFE(s, ns);
pango_escape(v, append_to_lua_buf, &b);
luaL_pushresult(&b);
return 1;
}
static void register_funcs(LuastatusBarlibData *bd, lua_State *L)
{
(void) bd;
// L: table
lua_pushcfunction(L, l_pango_escape); // L: table l_pango_escape
lua_setfield(L, -2, "pango_escape"); // L: table
}
static inline bool append_json_number(LS_String *s, double value)
{
if (!isfinite(value)) {
return false;
}
ls_string_append_f(s, "%.20g", value);
return true;
}
// Appends a JSON segment generated from table at the top of /L/'s stack, to
// /((Priv *) bd->priv)->tmpbuf/.
static bool append_segment(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
{
Priv *p = bd->priv;
LS_String *dst = &p->tmpbuf;
// add a "prologue"
if (dst->size) {
ls_string_append_c(dst, ',');
}
ls_string_append_f(dst, "{\"name\":\"%zu\"", widget_idx);
bool has_separator_key = false;
// L: ? table
lua_pushnil(L); // L: ? table nil
while (lua_next(L, -2)) {
// L: ? table key value
if (!lua_isstring(L, -2)) {
LS_ERRF(bd, "segment key: expected string, found %s", luaL_typename(L, -2));
return false;
}
const char *key = lua_tostring(L, -2);
if (strcmp(key, "name") == 0) {
LS_WARNF(bd, "segment: ignoring 'name', it is set automatically; use 'instance' "
"instead");
goto next_entry;
}
if (strcmp(key, "separator") == 0) {
has_separator_key = true;
}
ls_string_append_c(dst, ',');
append_json_escaped_str(dst, SAFEV_new_from_cstr_UNSAFE(key));
ls_string_append_c(dst, ':');
switch (lua_type(L, -1)) {
case LUA_TNUMBER:
{
double val = lua_tonumber(L, -1);
if (!append_json_number(dst, val)) {
LS_ERRF(bd, "segment entry '%s': invalid number (NaN/Inf)", key);
return false;
}
}
break;
case LUA_TSTRING:
{
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
append_json_escaped_str(dst, SAFEV_new_UNSAFE(s, ns));
}
break;
case LUA_TBOOLEAN:
{
bool val = lua_toboolean(L, -1);
ls_string_append_s(dst, val ? "true" : "false");
}
break;
case LUA_TNIL:
ls_string_append_s(dst, "null");
break;
default:
LS_ERRF(bd, "segment entry '%s': expected string, number, boolean or nil, found %s",
key, luaL_typename(L, -1));
return false;
}
next_entry:
lua_pop(L, 1); // L: ? table key
}
// L: ? table
// add an "epilogue"
if (p->noseps && !has_separator_key) {
ls_string_append_s(dst, ",\"separator\":false");
}
ls_string_append_c(dst, '}');
return true;
}
typedef enum {
TC_EMPTY,
TC_ARRAY,
TC_DICT,
} TableClass;
static inline TableClass classify_table(lua_State *L)
{
// L: ? table
lua_pushnil(L); // L: ? table nil
if (!lua_next(L, -2)) {
// L: ? table
return TC_EMPTY;
}
// L: ? table key value
bool is_array = lua_isnumber(L, -2);
lua_pop(L, 2); // L: ? table
return is_array ? TC_ARRAY : TC_DICT;
}
static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
{
Priv *p = bd->priv;
ls_string_clear(&p->tmpbuf);
// L: ? data
switch (lua_type(L, -1)) {
case LUA_TNIL:
break;
case LUA_TTABLE:
switch (classify_table(L)) {
case TC_EMPTY:
break;
case TC_DICT:
if (!append_segment(bd, L, widget_idx)) {
goto invalid_data;
}
break;
case TC_ARRAY:
{
size_t len = ls_lua_array_len(L, -1);
for (size_t i = 1; i <= len; ++i) {
lua_rawgeti(L, -1, i); // L: ? data value
switch (lua_type(L, -1)) {
case LUA_TTABLE:
if (!append_segment(bd, L, widget_idx)) {
goto invalid_data;
}
break;
case LUA_TNIL:
break;
default:
LS_ERRF(bd, "array value: expected table or nil, found %s",
luaL_typename(L, -1));
goto invalid_data;
}
lua_pop(L, 1); // L: ? data
}
}
}
// L: ? data
break;
default:
LS_ERRF(bd, "expected table or nil, found %s", luaL_typename(L, -1));
goto invalid_data;
}
if (!ls_string_eq(p->tmpbuf, p->bufs[widget_idx])) {
ls_string_swap(&p->tmpbuf, &p->bufs[widget_idx]);
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
}
return LUASTATUS_OK;
invalid_data:
ls_string_clear(&p->bufs[widget_idx]);
return LUASTATUS_NONFATAL_ERR;
}
static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
{
Priv *p = bd->priv;
LS_String *s = &p->bufs[widget_idx];
ls_string_assign_s(
s, "{\"full_text\":\"(Error)\",\"color\":\"#ff0000\",\"background\":\"#000000\"");
if (p->noseps) {
ls_string_append_s(s, ",\"separator\":false");
}
ls_string_append_c(s, '}');
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
return LUASTATUS_OK;
}
LuastatusBarlibIface luastatus_barlib_iface_v1 = {
.init = init,
.register_funcs = register_funcs,
.set = set,
.set_error = set_error,
.event_watcher = event_watcher,
.destroy = destroy,
};
================================================
FILE: barlibs/i3/luastatus-i3-wrapper
================================================
#!/bin/sh
exec ${LUASTATUS:-luastatus} -b i3 -B in_fd=3 -B out_fd=4 "$@" 3<&0 0</dev/null 4>&1 1>&2
================================================
FILE: barlibs/i3/pango_escape.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "pango_escape.h"
#include <stddef.h>
#include "libsafe/safev.h"
#define LIT(StrLit_) SAFEV_new_from_literal(StrLit_)
void pango_escape(
SAFEV v,
void (*append)(void *ud, SAFEV segment),
void *ud)
{
size_t n = SAFEV_len(v);
size_t prev = 0;
for (size_t i = 0; i < n; ++i) {
SAFEV esc = {0};
switch (SAFEV_at(v, i)) {
case '&': esc = LIT("&"); break;
case '<': esc = LIT("<"); break;
case '>': esc = LIT(">"); break;
case '\'': esc = LIT("'"); break;
case '"': esc = LIT("""); break;
default: continue;
}
append(ud, SAFEV_subspan(v, prev, i));
append(ud, esc);
prev = i + 1;
}
append(ud, SAFEV_suffix(v, prev));
}
================================================
FILE: barlibs/i3/pango_escape.h
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef pango_escape_h_
#define pango_escape_h_
#include "libsafe/safev.h"
void pango_escape(
SAFEV v,
void (*append)(void *ud, SAFEV segment),
void *ud);
#endif
================================================
FILE: barlibs/i3/priv.h
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef priv_h_
#define priv_h_
#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include "libls/ls_string.h"
typedef struct {
size_t nwidgets;
LS_String *bufs;
// Temporary buffer for secondary buffering, to avoid unneeded redraws.
LS_String tmpbuf;
// Input file descriptor.
int in_fd;
// /fdopen/'ed output file descritor.
FILE *out;
bool noclickev;
bool noseps;
} Priv;
#endif
================================================
FILE: barlibs/lemonbar/CMakeLists.txt
================================================
file (GLOB sources "*.c")
luastatus_add_barlib (
barlib-lemonbar
$<TARGET_OBJECTS:ls>
$<TARGET_OBJECTS:safe>
${sources}
)
target_compile_definitions (barlib-lemonbar PUBLIC -D_POSIX_C_SOURCE=200809L)
luastatus_target_compile_with (barlib-lemonbar LUA)
target_include_directories (barlib-lemonbar PUBLIC "${PROJECT_SOURCE_DIR}")
include (GNUInstallDirs)
install (PROGRAMS luastatus-lemonbar-launcher DESTINATION ${CMAKE_INSTALL_BINDIR})
luastatus_add_man_page (README.rst luastatus-barlib-lemonbar 7)
================================================
FILE: barlibs/lemonbar/README.rst
================================================
.. :X-man-page-only: luastatus-barlib-lemonbar
.. :X-man-page-only: #########################
.. :X-man-page-only:
.. :X-man-page-only: #############################
.. :X-man-page-only: lemonbar barlib for luastatus
.. :X-man-page-only: #############################
.. :X-man-page-only:
.. :X-man-page-only: :Copyright: LGPLv3
.. :X-man-page-only: :Manual section: 7
Overview
========
This barlib talks with ``lemonbar``.
It joins all non-empty strings returned by widgets by a separator, which defaults to ``" | "``.
Redirections and ``luastatus-lemonbar-launcher``
================================================
``lemonbar`` is not capable of creating a bidirectional pipe itself; instead, it requires all the
data to be written to its stdin and read from its stdout.
That's why the input/output file descriptors of this barlib must be manually redirected.
A launcher, ``luastatus-lemonbar-launcher``, is shipped with it; it spawns ``lemonbar`` connected to
a bidirectional pipe and executes ``luastatus`` with ``-b lemonbar``, all the required ``-B``
options, and additional arguments passed by you.
Pass each ``lemonbar`` argument with ``-p``, then pass ``--``, then pass luastatus arguments, e.g.::
luastatus-lemonbar-launcher -p -B#111111 -p -f'Droid Sans Mono for Powerline:pixelsize=12:weight=Bold' -- -Bseparator=' ' widget1.lua widget2.lua
``cb`` return value
===================
Either of:
* a string with lemonbar markup
An empty string hides the widget.
* an array of such strings
Equivalent to returning a string with all non-empty elements of the array joined by the
separator.
* ``nil``
Hides the widget.
Functions
=========
The following functions are provided:
* ``escaped_str = luastatus.barlib.escape(str)``
Escapes text for lemonbar markup.
``event`` argument
==================
A string with the name of the command.
Options
=======
The following options are supported:
* ``in_fd=<fd>``
File descriptor to read ``lemonbar`` input from. Usually set by the launcher.
* ``out_fd=<fd>``
File descriptor to write to. Usually set by the launcher.
* ``separator=<string>``
Set the separator.
================================================
FILE: barlibs/lemonbar/fuzz_esc/.gitignore
================================================
harness
findings
================================================
FILE: barlibs/lemonbar/fuzz_esc/build.sh
================================================
#!/bin/sh
if [ -z "$CC" ]; then
echo >&2 "You must set the 'CC' environment variable."
echo >&2 "Hint: you probably want to set 'CC' to 'some-directory/afl-gcc'."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
$CC -Wall -Wextra -O3 -fsanitize=undefined -std=c99 -D_POSIX_C_SOURCE=200809L \
-I"$luastatus_root" \
./harness.c \
../markup_utils.c \
"$luastatus_root"/libls/ls_string.c \
"$luastatus_root"/libls/ls_alloc_utils.c \
"$luastatus_root"/libls/ls_panic.c \
"$luastatus_root"/libls/ls_cstring_utils.c \
"$luastatus_root"/libls/ls_parse_int.c \
"$luastatus_root"/libsafe/*.c \
-o harness
================================================
FILE: barlibs/lemonbar/fuzz_esc/clear.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
rm -rf ./findings
================================================
FILE: barlibs/lemonbar/fuzz_esc/fuzz.sh
================================================
#!/bin/sh
set -e
if [ -z "$XXX_AFL_DIR" ]; then
echo >&2 "You must set the 'XXX_AFL_DIR' environment variable."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
mkdir -p ./findings
export UBSAN_OPTIONS=halt_on_error=1
export AFL_EXIT_WHEN_DONE=1
"$XXX_AFL_DIR"/afl-fuzz -i testcases -o findings -t 5 ./harness @@
================================================
FILE: barlibs/lemonbar/fuzz_esc/gen_testcases.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--a=1:abc \
--b=1:'%' \
--length=5-20 \
--num-files=10 \
--random-seed=123
================================================
FILE: barlibs/lemonbar/fuzz_esc/harness.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
#include "fuzz_utils/fuzz_utils.h"
#include "../markup_utils.h"
static void append_to_ls_string(void *ud, SAFEV segment)
{
LS_String *dst = ud;
ls_string_append_b(dst, SAFEV_ptr_UNSAFE(segment), SAFEV_len(segment));
}
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "USAGE: harness INPUT_FILE\n");
return 2;
}
int fd_in = open(argv[1], O_RDONLY | O_CLOEXEC);
if (fd_in < 0) {
perror(argv[1]);
abort();
}
FuzzInput input = fuzz_input_new_prealloc(1024);
if (fuzz_input_read(fd_in, &input) < 0) {
perror("read");
abort();
}
LS_String res = ls_string_new_from_s("escape result = ");
escape(
append_to_ls_string,
&res,
SAFEV_new_UNSAFE(input.data, input.size));
fuzz_utils_used(res.data, res.size);
fuzz_input_free(input);
ls_string_free(res);
close(fd_in);
return 0;
}
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_000
================================================
acabca
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_001
================================================
abbc%cccbbacacb%cc
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_002
================================================
ccacb%a%%aacbcc
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_003
================================================
%c%abb%%%ccb%abcb
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_004
================================================
%a%ca%b%
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_005
================================================
%a%cbc%%%
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_006
================================================
%b%b%b%%c%%%%b%
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_007
================================================
%%%%%%%%bb
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_008
================================================
%%%%b%%%%%%%%%c%
================================================
FILE: barlibs/lemonbar/fuzz_esc/testcases/testcase_009
================================================
%%%%%%
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/.gitignore
================================================
harness
findings
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/build.sh
================================================
#!/bin/sh
if [ -z "$CC" ]; then
echo >&2 "You must set the 'CC' environment variable."
echo >&2 "Hint: you probably want to set 'CC' to 'some-directory/afl-gcc'."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
$CC -Wall -Wextra -O3 -fsanitize=undefined -std=c99 -D_POSIX_C_SOURCE=200809L \
-I"$luastatus_root" \
./harness.c \
../markup_utils.c \
"$luastatus_root"/libls/ls_string.c \
"$luastatus_root"/libls/ls_alloc_utils.c \
"$luastatus_root"/libls/ls_panic.c \
"$luastatus_root"/libls/ls_cstring_utils.c \
"$luastatus_root"/libls/ls_parse_int.c \
"$luastatus_root"/libsafe/*.c \
-o harness
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/clear.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
rm -rf ./findings
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/fuzz.sh
================================================
#!/bin/sh
set -e
if [ -z "$XXX_AFL_DIR" ]; then
echo >&2 "You must set the 'XXX_AFL_DIR' environment variable."
exit 1
fi
# We add '-d' argument for original AFL because otherwise it
# does not terminate within 24 hours.
#
# '-d' means "quick & dirty mode (skips deterministic steps)".
case "$XXX_AFL_IS_PP" in
0)
extra_opts='-d'
;;
1)
extra_opts=
;;
*)
echo >&2 "You must set 'XXX_AFL_IS_PP' environment variable to either 0 or 1."
echo >&2 "Set it to 0 if AFL is the original Google's version (not AFL++)."
echo >&2 "Set it to 1 if AFL is actually AFL++."
exit 1
esac
# We also set AFL_NO_ARITH=1 because it's a text-based format.
# This potentially speeds up fuzzing.
export AFL_NO_ARITH=1
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
mkdir -p ./findings
export UBSAN_OPTIONS=halt_on_error=1
export AFL_EXIT_WHEN_DONE=1
"$XXX_AFL_DIR"/afl-fuzz $extra_opts -i testcases -o findings -t 5 ./harness @@
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/gen_testcases.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
nl=$(printf '\nx')
nl=${nl%x}
# 'fps' means 'final percent sign'
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--file-prefix='X_' \
--a=1:x \
--b=1:x \
--mut-substrings="|${nl}|}|%{A|%{x|%x|%%" \
--length=10 \
--num-files=6 \
--random-seed=123 \
--extra-testcase='fps:x%'
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--file-prefix='Y_' \
--a=1:x \
--b=1:x \
--mut-prefix='%{A' \
--mut-substrings='|:' \
--length=10 \
--num-files=4 \
--random-seed=123
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--file-prefix='Z_' \
--a=1:x \
--b=1:x \
--mut-prefix='x%{A' \
--mut-substrings='|:' \
--length=10 \
--num-files=5 \
--random-seed=123
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/harness.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
#include "fuzz_utils/fuzz_utils.h"
#include "../markup_utils.h"
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "USAGE: harness INPUT_FILE\n");
return 2;
}
int fd_in = open(argv[1], O_RDONLY | O_CLOEXEC);
if (fd_in < 0) {
perror(argv[1]);
abort();
}
FuzzInput input = fuzz_input_new_prealloc(1024);
if (fuzz_input_read(fd_in, &input) < 0) {
perror("read");
abort();
}
LS_String res = ls_string_new_reserve(2048);
ls_string_append_s(&res, "sanitize result = ");
append_sanitized(
&res,
123,
SAFEV_new_UNSAFE(input.data, input.size));
fuzz_utils_used(res.data, res.size);
fuzz_input_free(input);
ls_string_free(res);
close(fd_in);
return 0;
}
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_000
================================================
xxxx
xxxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_001
================================================
xxxxxxx}xxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_002
================================================
xxxxxxxxxx%{A
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_003
================================================
xxxxx%{xxxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_004
================================================
xxxxxxxx%xxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_005
================================================
xxxxxxxxx%%x
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_fps
================================================
x%
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_000
================================================
xxxx:xxxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_001
================================================
%xxxxxxx:xxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_002
================================================
%{xxxxxxxxxx:
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_003
================================================
%{Axxxxx:xxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_000
================================================
xxxx:xxxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_001
================================================
xxxxxxxx:xxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_002
================================================
x%xxxxxxxxxx:
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_003
================================================
x%{xxxxx:xxxxx
================================================
FILE: barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_004
================================================
x%{Axxxxxxxx:xx
================================================
FILE: barlibs/lemonbar/lemonbar.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
#include <errno.h>
#include <stdbool.h>
#include "include/barlib_v1.h"
#include "include/sayf_macros.h"
#include "libls/ls_string.h"
#include "libls/ls_cstring_utils.h"
#include "libls/ls_tls_ebuf.h"
#include "libls/ls_parse_int.h"
#include "libls/ls_io_utils.h"
#include "libls/ls_alloc_utils.h"
#include "libls/ls_lua_compat.h"
#include "libsafe/safev.h"
#include "markup_utils.h"
typedef struct {
size_t nwidgets;
LS_String *bufs;
// Temporary buffer for secondary buffering, to avoid unneeded redraws.
LS_String tmpbuf;
char *sep;
// /fdopen/'ed input file descriptor.
FILE *in;
// /fdopen/'ed output file descriptor.
FILE *out;
} Priv;
static void destroy(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
for (size_t i = 0; i < p->nwidgets; ++i)
ls_string_free(p->bufs[i]);
free(p->bufs);
ls_string_free(p->tmpbuf);
free(p->sep);
if (p->in)
fclose(p->in);
if (p->out)
fclose(p->out);
free(p);
}
static int init(LuastatusBarlibData *bd, const char *const *opts, size_t nwidgets)
{
Priv *p = bd->priv = LS_XNEW(Priv, 1);
*p = (Priv) {
.nwidgets = nwidgets,
.bufs = LS_XNEW(LS_String, nwidgets),
.tmpbuf = ls_string_new_reserve(512),
.sep = NULL,
.in = NULL,
.out = NULL,
};
for (size_t i = 0; i < nwidgets; ++i)
p->bufs[i] = ls_string_new_reserve(512);
// All the options may be passed multiple times!
const char *sep = NULL;
int in_fd = -1;
int out_fd = -1;
for (const char *const *s = opts; *s; ++s) {
const char *v;
if ((v = ls_strfollow(*s, "in_fd="))) {
if ((in_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "in_fd value is not a valid unsigned integer");
goto error;
}
} else if ((v = ls_strfollow(*s, "out_fd="))) {
if ((out_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "out_fd value is not a valid unsigned integer");
goto error;
}
} else if ((v = ls_strfollow(*s, "separator="))) {
sep = v;
} else {
LS_FATALF(bd, "unknown option '%s'", *s);
goto error;
}
}
p->sep = ls_xstrdup(sep ? sep : " | ");
// we require /in_fd/ and /out_fd/ to be >=3 because making stdin/stdout/stderr CLOEXEC has very
// bad consequences, and we just don't want to complicate the logic.
if (in_fd < 3) {
LS_FATALF(bd, "in_fd is not specified or less than 3");
goto error;
}
if (out_fd < 3) {
LS_FATALF(bd, "out_fd is not specified or less than 3");
goto error;
}
// open
if (!(p->in = fdopen(in_fd, "r"))) {
LS_FATALF(bd, "can't fdopen %d: %s", in_fd, ls_tls_strerror(errno));
goto error;
}
if (!(p->out = fdopen(out_fd, "w"))) {
LS_FATALF(bd, "can't fdopen %d: %s", out_fd, ls_tls_strerror(errno));
goto error;
}
// make CLOEXEC
if (ls_make_cloexec(in_fd) < 0) {
LS_FATALF(bd, "can't make fd %d CLOEXEC: %s", in_fd, ls_tls_strerror(errno));
goto error;
}
if (ls_make_cloexec(out_fd) < 0) {
LS_FATALF(bd, "can't make fd %d CLOEXEC: %s", out_fd, ls_tls_strerror(errno));
goto error;
}
return LUASTATUS_OK;
error:
destroy(bd);
return LUASTATUS_ERR;
}
static void append_to_lua_buf_callback(void *ud, SAFEV v)
{
luaL_Buffer *b = ud;
luaL_addlstring(b, SAFEV_ptr_UNSAFE(v), SAFEV_len(v));
}
static int l_escape(lua_State *L)
{
size_t ns;
// WARNING: /luaL_check*()/ functions do a long jump on error!
const char *s = luaL_checklstring(L, 1, &ns);
luaL_Buffer b;
luaL_buffinit(L, &b);
escape(append_to_lua_buf_callback, &b, SAFEV_new_UNSAFE(s, ns));
luaL_pushresult(&b); // L: result
return 1;
}
static void register_funcs(LuastatusBarlibData *bd, lua_State *L)
{
(void) bd;
// L: table
lua_pushcfunction(L, l_escape); // L: table l_escape
lua_setfield(L, -2, "escape"); // L: table
}
static bool redraw(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
FILE *out = p->out;
size_t n = p->nwidgets;
LS_String *bufs = p->bufs;
const char *sep = p->sep;
bool first = true;
for (size_t i = 0; i < n; ++i) {
if (bufs[i].size) {
if (!first) {
fputs(sep, out);
}
fwrite(bufs[i].data, 1, bufs[i].size, out);
first = false;
}
}
putc('\n', out);
fflush(out);
if (ferror(out)) {
LS_FATALF(bd, "write error: %s", ls_tls_strerror(errno));
return false;
}
return true;
}
static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
{
Priv *p = bd->priv;
LS_String *buf = &p->tmpbuf;
ls_string_clear(buf);
// L: ? data
switch (lua_type(L, -1)) {
case LUA_TNIL:
break;
case LUA_TSTRING:
{
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
append_sanitized(buf, widget_idx, SAFEV_new_UNSAFE(s, ns));
}
break;
case LUA_TTABLE:
{
const char *sep = p->sep;
size_t len = ls_lua_array_len(L, -1);
for (size_t i = 1; i <= len; ++i) {
lua_rawgeti(L, -1, i); // L: ? data value
if (lua_isnil(L, -1)) {
goto next;
}
if (!lua_isstring(L, -1)) {
LS_ERRF(bd, "table value: expected string, found %s", luaL_typename(L, -1));
goto invalid_data;
}
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
if (buf->size && ns) {
ls_string_append_s(buf, sep);
}
append_sanitized(buf, widget_idx, SAFEV_new_UNSAFE(s, ns));
next:
lua_pop(L, 1); // L: ? data
}
// L: ? data
}
break;
default:
LS_ERRF(bd, "expected string, table or nil, found %s", luaL_typename(L, -1));
goto invalid_data;
}
if (!ls_string_eq(*buf, p->bufs[widget_idx])) {
ls_string_swap(buf, &p->bufs[widget_idx]);
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
}
return LUASTATUS_OK;
invalid_data:
ls_string_clear(&p->bufs[widget_idx]);
return LUASTATUS_NONFATAL_ERR;
}
static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
{
Priv *p = bd->priv;
ls_string_assign_s(&p->bufs[widget_idx], "%{B#f00}%{F#fff}(Error)%{B-}%{F-}");
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
return LUASTATUS_OK;
}
static int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs funcs)
{
Priv *p = bd->priv;
char *buf = NULL;
size_t nbuf = 256;
for (ssize_t nread; (nread = getline(&buf, &nbuf, p->in)) >= 0;) {
if (nread == 0 || buf[nread - 1] != '\n')
continue;
size_t ncommand;
size_t widget_idx;
const char *command = parse_command(buf, nread - 1, &ncommand, &widget_idx);
if (!command)
continue;
if (widget_idx >= p->nwidgets) {
continue;
}
lua_State *L = funcs.call_begin(bd->userdata, widget_idx);
lua_pushlstring(L, command, ncommand);
funcs.call_end(bd->userdata, widget_idx);
}
if (feof(p->in)) {
LS_ERRF(bd, "lemonbar closed its pipe end");
} else {
LS_ERRF(bd, "read error: %s", ls_tls_strerror(errno));
}
free(buf);
return LUASTATUS_ERR;
}
LuastatusBarlibIface luastatus_barlib_iface_v1 = {
.init = init,
.register_funcs = register_funcs,
.set = set,
.set_error = set_error,
.event_watcher = event_watcher,
.destroy = destroy,
};
================================================
FILE: barlibs/lemonbar/luastatus-lemonbar-launcher
================================================
#!/usr/bin/env bash
set -e
if (( BASH_VERSINFO[0] < 4 )); then
echo >&2 "bash 4.0 or higher is required (this one is $BASH_VERSION)."
exit 1
fi
usage() {
printf '%s\n' >&2 "$*
USAGE: ${0##*/} [-p lemonbar_argument [-p ...]] -- [luastatus_argument [...]]
Note that '--' is mandatory."
exit 2
}
lemonbar_args=()
# There is no easy way to require '--' with getopts, so we parse $@ manually.
while true; do
if (( $# == 0 )); then
usage "'--' argument not found."
fi
case "$1" in
--)
shift
break
;;
-p)
if (( $# == 1 )); then
usage "'-p' option requires an argument."
fi
shift
lemonbar_args+=("$1")
;;
-p*)
lemonbar_args+=("${1:2}")
;;
*)
usage "Unexpected argument '$1' found before '--'."
;;
esac
shift
done
coproc ${LEMONBAR:-lemonbar} "${lemonbar_args[@]}"
exec <&${COPROC[0]} >&${COPROC[1]}
exec ${LUASTATUS:-luastatus} -b lemonbar -B in_fd=3 -B out_fd=4 "$@" 3<&0 0</dev/null 4>&1 1>&2
================================================
FILE: barlibs/lemonbar/markup_utils.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "markup_utils.h"
#include "libls/ls_string.h"
#include "libls/ls_parse_int.h"
#include "libsafe/safev.h"
#include <stddef.h>
#include <stdbool.h>
void escape(
void (*append)(void *ud, SAFEV segment),
void *ud,
SAFEV v)
{
// just replace all "%"s with "%%"
for (;;) {
size_t i = SAFEV_index_of(v, '%');
if (i == (size_t) -1) {
break;
}
append(ud, SAFEV_subspan(v, 0, i));
append(ud, SAFEV_new_from_literal("%%"));
v = SAFEV_suffix(v, i + 1);
}
append(ud, v);
}
static inline void append_sv(LS_String *dst, SAFEV v)
{
ls_string_append_b(dst, SAFEV_ptr_UNSAFE(v), SAFEV_len(v));
}
void append_sanitized(LS_String *buf, size_t widget_idx, SAFEV v)
{
size_t n = SAFEV_len(v);
size_t prev = 0;
bool a_tag = false;
for (size_t i = 0; i < n; ++i) {
#define DO_PREV(WhetherToIncludeThis_) \
do { \
size_t j__ = i + ((WhetherToIncludeThis_) ? 1 : 0); \
append_sv(buf, SAFEV_subspan(v, prev, j__)); \
prev = i + 1; \
} while (0)
#define PEEK(Offset_) SAFEV_at_or(v, i + (Offset_), '\0')
switch (SAFEV_at(v, i)) {
case '\n':
DO_PREV(false);
break;
case '%':
if (PEEK(1) == '{' && PEEK(2) == 'A') {
a_tag = true;
} else if (PEEK(1) == '%') {
++i;
}
break;
case ':':
if (a_tag) {
DO_PREV(true);
ls_string_append_f(buf, "%zu_", widget_idx);
a_tag = false;
}
break;
case '}':
a_tag = false;
break;
}
#undef DO_PREV
#undef PEEK
}
append_sv(buf, SAFEV_suffix(v, prev));
}
const char *parse_command(const char *line, size_t nline, size_t *ncommand, size_t *widget_idx)
{
const char *endptr;
int idx = ls_strtou_b(line, nline, &endptr);
if (idx < 0 ||
endptr == line ||
endptr == line + nline ||
*endptr != '_')
{
return NULL;
}
const char *command = endptr + 1;
*ncommand = nline - (command - line);
*widget_idx = idx;
return command;
}
================================================
FILE: barlibs/lemonbar/markup_utils.h
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef markup_utils_h_
#define markup_utils_h_
#include <stddef.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
void escape(
void (*append)(void *ud, SAFEV segment),
void *ud,
SAFEV v);
void append_sanitized(LS_String *buf, size_t widget_idx, SAFEV v);
const char *parse_command(const char *line, size_t nline, size_t *ncommand, size_t *widget_idx);
#endif
================================================
FILE: barlibs/stdout/CMakeLists.txt
================================================
file (GLOB sources "*.c")
luastatus_add_barlib (
barlib-stdout
$<TARGET_OBJECTS:ls>
$<TARGET_OBJECTS:safe>
${sources}
)
target_compile_definitions (barlib-stdout PUBLIC -D_POSIX_C_SOURCE=200809L)
luastatus_target_compile_with (barlib-stdout LUA)
target_include_directories (barlib-stdout PUBLIC "${PROJECT_SOURCE_DIR}")
include (GNUInstallDirs)
install (PROGRAMS luastatus-stdout-wrapper DESTINATION ${CMAKE_INSTALL_BINDIR})
luastatus_add_man_page (README.rst luastatus-barlib-stdout 7)
================================================
FILE: barlibs/stdout/README.rst
================================================
.. :X-man-page-only: luastatus-barlib-stdout
.. :X-man-page-only: #######################
.. :X-man-page-only:
.. :X-man-page-only: ###########################
.. :X-man-page-only: stdout barlib for luastatus
.. :X-man-page-only: ###########################
.. :X-man-page-only:
.. :X-man-page-only: :Copyright: LGPLv3
.. :X-man-page-only: :Manual section: 7
Overview
========
This barlib simply writes lines to a file descriptor.
It can be used for status bars such as **dzen**/**dzen2**, **xmobar**, **yabar**, **dvtm**, and
others.
It joins all non-empty strings returned by widgets by a separator, which defaults to ``" | "``.
It does not provide functions.
Redirections and ``luastatus-stdout-wrapper``
=============================================
Since we need to write to stdout, it is very easy to mess things up: Lua's ``print()`` prints to
stdout, processes spawned by widgets/plugins inherit our stdin and stdout, etc.
That's why this barlib requires that stdout file descriptor is manually redirected. A shell wrapper,
``luastatus-stdout-wrapper``, is shipped with it; it does all the redirections needed and executes
``luastatus`` with ``-b stdout`` and additional arguments passed by you.
It does not redirect stdin and/or pass ``in_fd=`` option. Make your own wrapper if this is needed.
``cb`` return value
===================
Either of:
* a string
An empty string hides the widget.
* an array of strings
Equivalent to returning a string with all non-empty elements of the array joined by the
separator.
* ``nil``
Hides the widget.
Options
=======
The following options are supported:
* ``out_fd=<fd>``
File descriptor to write to. Usually set by the wrapper.
* ``separator=<string>``
Set the separator.
* ``error=<string>``
Set the content of an "error" segment. Defaults to ``"(Error)"``.
* ``in_filename=<string>`` or ``in_fd=<fd>``
Enable event watcher.
If ``in_filename=<string>`` is specified, this barlib will open the specified
filename for reading and then read from. If ``in_fd=<fd>`` is specified, the
specified file descriptor will be read from. It is invalid to pass both options;
in this case, this barlib will fail to initialize.
This barilib will then read lines from the specified source. Each line will be
treated as an event.
This barlib doesn't try to interpret the content of the line; instead, the event
will be broadcast to all widgets. Thus, if this option is used, it is the
responsibility of each widget (that listens to the events) to check if the event
is somehow related to it.
``event`` argument
==================
Events are only reported if either ``in_filename=`` or ``in_fd=`` option was
specified (see above). In this case, the argument is the line that was read from
the specified file, without the trailing newline character.
================================================
FILE: barlibs/stdout/fuzz/.gitignore
================================================
harness
findings
================================================
FILE: barlibs/stdout/fuzz/build.sh
================================================
#!/bin/sh
if [ -z "$CC" ]; then
echo >&2 "You must set the 'CC' environment variable."
echo >&2 "Hint: you probably want to set 'CC' to 'some-directory/afl-gcc'."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
$CC -Wall -Wextra -O3 -fsanitize=undefined -std=c99 -D_POSIX_C_SOURCE=200809L \
-I"$luastatus_root" \
./harness.c \
../sanitize.c \
"$luastatus_root"/libls/ls_string.c \
"$luastatus_root"/libls/ls_alloc_utils.c \
"$luastatus_root"/libls/ls_panic.c \
"$luastatus_root"/libls/ls_cstring_utils.c \
"$luastatus_root"/libsafe/*.c \
-o harness
================================================
FILE: barlibs/stdout/fuzz/clear.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
rm -rf ./findings
================================================
FILE: barlibs/stdout/fuzz/fuzz.sh
================================================
#!/bin/sh
set -e
if [ -z "$XXX_AFL_DIR" ]; then
echo >&2 "You must set the 'XXX_AFL_DIR' environment variable."
exit 1
fi
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
mkdir -p ./findings
export UBSAN_OPTIONS=halt_on_error=1
export AFL_EXIT_WHEN_DONE=1
"$XXX_AFL_DIR"/afl-fuzz -i testcases -o findings -t 5 ./harness @@
================================================
FILE: barlibs/stdout/fuzz/gen_testcases.sh
================================================
#!/bin/sh
set -e
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
luastatus_root=../../..
nl=$(printf '\nx')
nl=${nl%x}
"$luastatus_root"/fuzz_utils/gen_testcases/gen_testcases.py \
./testcases \
--a=1:"$nl" \
--b=1:xyz \
--a-is-important \
--length=5-20 \
--num-files=10 \
--random-seed=123
================================================
FILE: barlibs/stdout/fuzz/harness.c
================================================
/*
* Copyright (C) 2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
#include "fuzz_utils/fuzz_utils.h"
#include "../sanitize.h"
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "USAGE: harness INPUT_FILE\n");
return 2;
}
int fd_in = open(argv[1], O_RDONLY | O_CLOEXEC);
if (fd_in < 0) {
perror(argv[1]);
abort();
}
FuzzInput input = fuzz_input_new_prealloc(1024);
if (fuzz_input_read(fd_in, &input) < 0) {
perror("read");
abort();
}
LS_String res = ls_string_new_from_s("sanitize result = ");
append_sanitized(&res, SAFEV_new_UNSAFE(input.data, input.size));
fuzz_utils_used(res.data, res.size);
fuzz_input_free(input);
ls_string_free(res);
close(fd_in);
return 0;
}
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_000
================================================
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_001
================================================
y
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_002
================================================
z
y
x
x
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_003
================================================
xz
z
z
y
z
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_004
================================================
y
x
z
z
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_005
================================================
z
xx
z
y
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_006
================================================
x
y
z
yy
yyy
yxx
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_007
================================================
xyyxyx
zy
zy
zxyy
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_008
================================================
xxxxzxx
================================================
FILE: barlibs/stdout/fuzz/testcases/testcase_009
================================================
zyyyyzxyyxyxxx
================================================
FILE: barlibs/stdout/luastatus-dvtm
================================================
#!/bin/sh
FIFO=~/.luastatus-dvtm
set -e
rm -f "$FIFO"
mkfifo -m600 "$FIFO"
exec ${LUASTATUS:-luastatus} -b stdout -B out_fd=3 3>"$FIFO" "$@" &
status_pid=$!
${DVTM:-dvtm} -s "$FIFO" 2>/dev/null
kill "$status_pid"
rm -f "$FIFO"
================================================
FILE: barlibs/stdout/luastatus-stdout-wrapper
================================================
#!/bin/sh
exec ${LUASTATUS:-luastatus} -b stdout -B out_fd=3 "$@" 3>&1 1>&2
================================================
FILE: barlibs/stdout/open_stdio_file.c
================================================
/*
* Copyright (C) 2026 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "open_stdio_file.h"
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include "libls/ls_io_utils.h"
#include "libls/ls_tls_ebuf.h"
#include "include/barlib_data_v1.h"
#include "include/sayf_macros.h"
static bool open_input_fd(
LuastatusBarlibData *bd,
FILE **dst,
int fd)
{
if (ls_make_cloexec(fd) < 0) {
LS_FATALF(bd, "can't make fd %d (in_fd) CLOEXEC: %s", fd, ls_tls_strerror(errno));
return false;
}
*dst = fdopen(fd, "r");
if (!*dst) {
LS_FATALF(bd, "can't fdopen %d (in_fd): %s", fd, ls_tls_strerror(errno));
return false;
}
return true;
}
static bool open_input_filename(
LuastatusBarlibData *bd,
FILE **dst,
const char *filename)
{
int fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
LS_FATALF(bd, "can't open '%s' (in_filename): %s", filename, ls_tls_strerror(errno));
return false;
}
*dst = fdopen(fd, "r");
if (!*dst) {
LS_FATALF(bd, "can't fdopen %d (opened in_filename): %s", fd, ls_tls_strerror(errno));
close(fd);
return false;
}
return true;
}
bool open_input(
LuastatusBarlibData *bd,
FILE **dst,
int fd,
const char *filename)
{
if (fd >= 0 && filename) {
LS_FATALF(bd, "both in_fd and in_filename were specified");
return false;
}
if (fd >= 0) {
return open_input_fd(bd, dst, fd);
}
if (filename) {
return open_input_filename(bd, dst, filename);
}
return true;
}
bool open_output(
LuastatusBarlibData *bd,
FILE **dst,
int fd)
{
if (ls_make_cloexec(fd) < 0) {
LS_FATALF(bd, "can't make fd %d (out_fd) CLOEXEC: %s", fd, ls_tls_strerror(errno));
return false;
}
*dst = fdopen(fd, "w");
if (!*dst) {
LS_FATALF(bd, "can't fdopen %d (out_fd): %s", fd, ls_tls_strerror(errno));
return false;
}
return true;
}
================================================
FILE: barlibs/stdout/open_stdio_file.h
================================================
/*
* Copyright (C) 2026 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef open_stdio_file_
#define open_stdio_file_
#include <stdio.h>
#include <stdbool.h>
#include "include/barlib_data_v1.h"
bool open_input(
LuastatusBarlibData *bd,
FILE **dst,
int fd,
const char *filename);
bool open_output(
LuastatusBarlibData *bd,
FILE **dst,
int fd);
#endif
================================================
FILE: barlibs/stdout/sanitize.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include "sanitize.h"
#include <stddef.h>
#include "libls/ls_string.h"
#include "libsafe/safev.h"
static inline void append_sv(LS_String *dst, SAFEV v)
{
ls_string_append_b(dst, SAFEV_ptr_UNSAFE(v), SAFEV_len(v));
}
void append_sanitized(LS_String *buf, SAFEV v)
{
for (;;) {
size_t i = SAFEV_index_of(v, '\n');
if (i == (size_t) -1) {
break;
}
append_sv(buf, SAFEV_subspan(v, 0, i));
v = SAFEV_suffix(v, i + 1);
}
append_sv(buf, v);
}
================================================
FILE: barlibs/stdout/sanitize.h
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef sanitize_h_
#define sanitize_h_
#include "libls/ls_string.h"
#include "libsafe/safev.h"
void append_sanitized(LS_String *buf, SAFEV v);
#endif
================================================
FILE: barlibs/stdout/stdout.c
================================================
/*
* Copyright (C) 2015-2025 luastatus developers
*
* This file is part of luastatus.
*
* luastatus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* luastatus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with luastatus. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
#include <errno.h>
#include <stdbool.h>
#include <sys/types.h>
#include "include/barlib_v1.h"
#include "include/sayf_macros.h"
#include "libls/ls_string.h"
#include "libls/ls_cstring_utils.h"
#include "libls/ls_tls_ebuf.h"
#include "libls/ls_parse_int.h"
#include "libls/ls_alloc_utils.h"
#include "libls/ls_lua_compat.h"
#include "libsafe/safev.h"
#include "sanitize.h"
#include "open_stdio_file.h"
typedef struct {
size_t nwidgets;
LS_String *bufs;
// Temporary buffer for secondary buffering, to avoid unneeded redraws.
LS_String tmpbuf;
char *sep;
// Content of an "error" segment.
char *error;
// /fdopen/'ed output file descriptor.
FILE *out;
// Value of /in_filename/ option.
FILE *in;
} Priv;
static void destroy(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
for (size_t i = 0; i < p->nwidgets; ++i) {
ls_string_free(p->bufs[i]);
}
free(p->bufs);
ls_string_free(p->tmpbuf);
free(p->sep);
free(p->error);
if (p->out) {
fclose(p->out);
}
if (p->in) {
fclose(p->in);
}
free(p);
}
static int init(LuastatusBarlibData *bd, const char *const *opts, size_t nwidgets)
{
Priv *p = bd->priv = LS_XNEW(Priv, 1);
*p = (Priv) {
.nwidgets = nwidgets,
.bufs = LS_XNEW(LS_String, nwidgets),
.tmpbuf = ls_string_new_reserve(512),
.sep = NULL,
.error = NULL,
.out = NULL,
.in = NULL,
};
for (size_t i = 0; i < nwidgets; ++i)
p->bufs[i] = ls_string_new_reserve(512);
// All the options may be passed multiple times!
const char *sep = NULL;
const char *error = NULL;
const char *in_filename = NULL;
int out_fd = -1;
int in_fd = -1;
for (const char *const *s = opts; *s; ++s) {
const char *v;
if ((v = ls_strfollow(*s, "out_fd="))) {
if ((out_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "out_fd value is not a valid unsigned integer");
goto error;
}
} else if ((v = ls_strfollow(*s, "in_fd="))) {
if ((in_fd = ls_full_strtou(v)) < 0) {
LS_FATALF(bd, "in_fd value is not a valid unsigned integer");
goto error;
}
} else if ((v = ls_strfollow(*s, "separator="))) {
sep = v;
} else if ((v = ls_strfollow(*s, "error="))) {
error = v;
} else if ((v = ls_strfollow(*s, "in_filename="))) {
in_filename = v;
} else {
LS_FATALF(bd, "unknown option '%s'", *s);
goto error;
}
}
p->sep = ls_xstrdup(sep ? sep : " | ");
p->error = ls_xstrdup(error ? error : "(Error)");
// we require /out_fd/ to be >=3 because making stdin/stdout/stderr CLOEXEC has very bad
// consequences, and we just don't want to complicate the logic.
if (out_fd < 3) {
LS_FATALF(bd, "out_fd is not specified or less than 3");
goto error;
}
// same goes for /in_fd/, if specified
if (in_fd >= 0 && in_fd < 3) {
LS_FATALF(bd, "in_fd is less than 3");
goto error;
}
// open output
if (!open_output(bd, &p->out, out_fd)) {
goto error;
}
// open input
if (!open_input(bd, &p->in, in_fd, in_filename)) {
goto error;
}
return LUASTATUS_OK;
error:
destroy(bd);
return LUASTATUS_ERR;
}
static bool redraw(LuastatusBarlibData *bd)
{
Priv *p = bd->priv;
FILE *out = p->out;
size_t n = p->nwidgets;
LS_String *bufs = p->bufs;
const char *sep = p->sep;
bool first = true;
for (size_t i = 0; i < n; ++i) {
if (bufs[i].size) {
if (!first) {
fputs(sep, out);
}
fwrite(bufs[i].data, 1, bufs[i].size, out);
first = false;
}
}
putc('\n', out);
fflush(out);
if (ferror(out)) {
LS_FATALF(bd, "write error: %s", ls_tls_strerror(errno));
return false;
}
return true;
}
static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
{
Priv *p = bd->priv;
LS_String *buf = &p->tmpbuf;
ls_string_clear(buf);
// L: ? data
switch (lua_type(L, -1)) {
case LUA_TNIL:
break;
case LUA_TSTRING:
{
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
append_sanitized(buf, SAFEV_new_UNSAFE(s, ns));
}
break;
case LUA_TTABLE:
{
const char *sep = p->sep;
size_t len = ls_lua_array_len(L, -1);
for (size_t i = 1; i <= len; ++i) {
lua_rawgeti(L, -1, i); // L: ? data value
if (lua_isnil(L, -1)) {
goto next;
}
if (!lua_isstring(L, -1)) {
LS_ERRF(bd, "table value: expected string, found %s", luaL_typename(L, -1));
goto invalid_data;
}
size_t ns;
const char *s = lua_tolstring(L, -1, &ns);
if (buf->size && ns) {
ls_string_append_s(buf, sep);
}
append_sanitized(buf, SAFEV_new_UNSAFE(s, ns));
next:
lua_pop(L, 1); // L: ? data value
}
// L: ? data
}
break;
default:
LS_ERRF(bd, "expected string, table or nil, found %s", luaL_typename(L, -1));
goto invalid_data;
}
if (!ls_string_eq(*buf, p->bufs[widget_idx])) {
ls_string_swap(buf, &p->bufs[widget_idx]);
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
}
return LUASTATUS_OK;
invalid_data:
ls_string_clear(&p->bufs[widget_idx]);
return LUASTATUS_NONFATAL_ERR;
}
static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
{
Priv *p = bd->priv;
ls_string_assign_s(&p->bufs[widget_idx], p->error);
if (!redraw(bd)) {
return LUASTATUS_ERR;
}
return LUASTATUS_OK;
}
static int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs funcs)
{
Priv *p = bd->priv;
if (!p->in) {
LS_DEBUGF(bd, "event watcher: in_fd/in_filename not specified, returning");
return LUASTATUS_NONFATAL_ERR;
}
char *line = NULL;
size_t line_buf_n = 1024;
ssize_t line_n;
while ((line_n = getline(&line, &line_buf_n, p->in)) >= 0) {
if (line_n && line[line_n - 1] == '\n') {
--line_n;
}
for (size_t i = 0; i < p->nwidgets; ++i) {
lua_State *L = funcs.call_begin(bd->userdata, i);
lua_pushlstring(L, line, line_n);
funcs.call_end(bd->userdata, i);
}
}
if (feof(p->in)) {
LS_FATALF(bd, "event watcher: the other end of pipe/FIFO/something has been closed");
} else {
LS_FATALF(bd, "event watcher: I/O error: %s", ls_tls_strerror(errno));
}
free(line);
return LUASTATUS_ERR;
}
LuastatusBarlibIface luastatus_barlib_iface_v1 = {
.init = init,
.set = set,
.set_error = set_error,
.event_watcher = event_watcher,
.destroy = destroy,
};
================================================
FILE: check_final_newline.py
================================================
#!/usr/bin/env python3
import os
import sys
def say(s: str) -> None:
print(s, file=sys.stderr)
def main() -> None:
args = sys.argv[1:]
if not args:
say('USAGE: check_final_newline.py FILE [FILE ...]')
sys.exit(2)
everything_ok = True
for arg in args:
with open(arg, 'rb') as f:
f.seek(0, os.SEEK_END)
file_size = f.tell()
if not file_size:
continue
f.seek(-1, os.SEEK_END)
final_byte = f.read(1)
if final_byte != b'\n':
say(f'File "{arg}" has no trailing newline!')
everything_ok = False
if everything_ok:
sys.exit(0)
else:
sys.exit(1)
if __name__ == '__main__':
main()
================================================
FILE: check_includes.sh
================================================
#!/usr/bin/env bash
# USAGE: check_includes.sh DIRECTORY [EXTRA CFLAGS...]
# Requires 'include-what-you-use' tool.
set -e
set -o pipefail
check_entity=${1?}; shift
if [[ -d $check_entity ]]; then
check_dir=$check_entity
check_file=
else
check_dir=$(dirname -- "$check_entity")
check_file=$check_entity
fi
extra_cflags=( -D_POSIX_C_SOURCE=200809L "$@" )
luastatus_dir="$check_dir"
luastatus_dir_found=0
for (( i = 0; i < 10; ++i )); do
if [[ -e "$luastatus_dir"/generate-man.sh ]]; then
luastatus_dir_found=1
break
fi
luastatus_dir+='/..'
done
if (( ! luastatus_dir_found )); then
echo >&2 "Cannot find luastatus dir"
exit 1
fi
cmakelists_dir=${CMAKELISTS_DIR:-$check_dir}
modules=()
if [[ -e "$cmakelists_dir"/CMakeLists.txt ]]; then
modules_raw=$(sed -rn 's/^\s*pkg_check_modules\s*\(.*\s+REQUIRED\s+(.*)\)\s*$/\1/p' "$cmakelists_dir"/CMakeLists.txt)
# Replace all whitespace with newlines
modules_raw=$(sed -r 's/\s+/\n/g' <<< "$modules_raw")
# Remove version specifications (e.g. "yajl>=2.0.4" -> "yajl")
modules_raw=$(sed -r 's/^([-a-zA-Z0-9_.]+).*/\1/' <<< "$modules_raw")
# Split by whitespace, assign to 'modules' array
modules=( $modules_raw )
fi
if (( ${#modules[@]} )); then
echo >&2 "Modules: ${modules[*]}"
else
echo >&2 "Modules: (none)"
fi
my_filter() {
awk '
/^The full include-list for / {
skip = 1
}
/^---$/ {
skip = 0
}
# print if and only if (!skip)
!skip
'
}
cflags=$(pkg-config --cflags ${LUA_LIB:-lua} "${modules[@]}")
do_check_specific_file() {
include-what-you-use -I"$luastatus_dir" $cflags "${extra_cflags[@]}" "$1" 2>&1 | my_filter
}
if [[ -n $check_file ]]; then
do_check_specific_file "$check_file"
else
find "$check_dir" -name '*.[ch]' | while IFS= read -r src_file; do
if [[ $src_file == *.in.h ]]; then
continue
fi
do_check_specific_file "$src_file"
done
fi
================================================
FILE: check_style.sh
================================================
#!/usr/bin/env bash
set -e
set -o pipefail
cd -- "$(dirname "$(readlink "$0" || printf '%s\n' "$0")")"
say() {
printf '%s\n' "$*" >&2
}
exts=(
c h
lua
py
sh bash
md rst txt
)
find_name_clause=()
for ext in "${exts[@]}"; do
if (( ${#find_name_clause[@]} )); then
find_name_clause+=( -or )
fi
find_name_clause+=( -name "*.$ext" )
done
ignore_db=(
f:CMakeCache.txt
D:CMakeFiles
D:CMakeScripts
f:Makefile
f:cmake_install.cmake
f:install_manifest.txt
f:CTestTestfile.cmake
D:build
)
check_against_ignore_db() {
local entry
local entry_basename
for entry in "${ignore_db[@]}"; do
entry_basename=${entry#?:}
case "$entry" in
f:*)
if [[ $1 == */"$entry_basename" ]]; then
return 1
fi
;;
D:*)
if [[ $1 == */"$entry_basename"/* ]]; then
return 1
fi
;;
*)
say "FATAL: ignore_db contains invalid entry '$entry'.";
exit 1
;;
esac
done
return 0
}
paths=()
while IFS= read -r path; do
if ! check_against_ignore_db "$path"; then
continue
fi
paths+=( "$path" )
done < <(find \( "${find_name_clause[@]}" \) -and -type f)
if (( ! ${#paths[@]} )); then
say 'No files found with extensions of interest.'
say 'This means something is wrong, so exiting with non-zero code.'
exit 1
fi
printf '%s\n' "${paths[@]}" | xargs -d $'\n' ./check_final_newline.py
ok=1
for path in "${paths[@]}"; do
if grep -E -H -n '\s$' -- "$path"; then
ok=0
fi
done
if (( !ok )); then
say 'Some files have lines with trailing whitespace; see above.'
exit 1
fi
say "Checked ${#paths[@]} file(s), everything is OK."
exit 0
================================================
FILE: contrib/luastatus-9999.ebuild
================================================
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CMAKE_IN_SOURCE_BUILD=1
inherit cmake
DESCRIPTION="Universal status bar content generator"
HOMEPAGE="https://github.com/shdown/luastatus"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
SRC_URI=""
EGIT_REPO_URI="https://github.com/shdown/${PN}.git"
KEYWORDS="~amd64 ~x86"
else
SRC_URI="https://github.com/shdown/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 x86"
fi
BARLIBS="
${PN}_barlibs_dwm
${PN}_barlibs_i3
${PN}_barlibs_lemonbar
${PN}_barlibs_stdout
"
PROPER_PLUGINS="
+${PN}_plugins_alsa
+${PN}_plugins_dbus
+${PN}_plugins_fs
+${PN}_plugins_inotify
+${PN}_plugins_mpd
+${PN}_plugins_network-linux
+${PN}_plugins_pulse
+${PN}_plugins_timer
+${PN}_plugins_udev
+${PN}_plugins_unixsock
+${PN}_plugins_xkb
+${PN}_plugins_xtitle
"
DERIVED_PLUGINS="
+${PN}_plugins_backlight-linux
+${PN}_plugins_battery-linux
+${PN}_plugins_cpu-usage-linux
+${PN}_plugins_file-contents-linux
+${PN}_plugins_imap
+${PN}_plugins_mem-usage-linux
+${PN}_plugins_pipe
"
PLUGINS="
${PROPER_PLUGINS}
${DERIVED_PLUGINS}
"
LICENSE="LGPL-3+"
SLOT="0"
IUSE="doc examples luajit ${BARLIBS} ${PLUGINS}"
REQUIRED_USE="
${PN}_plugins_backlight-linux? ( ${PN}_plugins_udev )
${PN}_plugins_battery-linux? ( ${PN}_plugins_udev )
${PN}_plugins_cpu-usage-linux? ( ${PN}_plugins_timer )
${PN}_plugins_file-contents-linux? ( ${PN}_plugins_inotify )
${PN}_plugins_imap? ( ${PN}_plugins_timer )
${PN}_plugins_mem-usage-linux? ( ${PN}_plugins_timer )
${PN}_plugins_pipe? ( ${PN}_plugins_timer )
"
DEPEND="
doc? ( dev-python/docutils )
"
RDEPEND="
luajit? ( dev-lang/luajit:2 )
!luajit? ( dev-lang/lua )
${PN}_barlibs_dwm? ( x11-libs/libxcb )
${PN}_barlibs_i3? ( >=dev-libs/yajl-2.0.4 )
${PN}_plugins_alsa? ( media-libs/alsa-lib )
${PN}_plugins_dbus? ( dev-libs/glib )
${PN}_plugins_network-linux? ( sys-kernel/linux-headers dev-libs/libnl )
${PN}_plugins_pulse? ( media-sound/pulseaudio )
${PN}_plugins_udev? ( virtual/libudev )
${PN}_plugins_xkb? ( x11-libs/libX11 )
${PN}_plugins_xtitle? ( x11-libs/libxcb x11-libs/xcb-util-wm x11-libs/xcb-util )
"
src_configure() {
local mycmakeargs=(
$(use luajit && echo -DWITH_LUA_LIBRARY=luajit)
-DBUILD_DOCS=$(usex doc)
-DBUILD_BARLIB_DWM=$(usex ${PN}_barlibs_dwm)
-DBUILD_BARLIB_I3=$(usex ${PN}_barlibs_i3)
-DBUILD_BARLIB_LEMONBAR=$(usex ${PN}_barlibs_lemonbar)
-DBUILD_BARLIB_STDOUT=$(usex ${PN}_barlibs_stdout)
-DBUILD_PLUGIN_ALSA=$(usex ${PN}_plugins_alsa)
-DBUILD_PLUGIN_BACKLIGHT_LINUX=$(usex ${PN}_plugins_backlight-linux)
-DBUILD_PLUGIN_BATTERY_LINUX=$(usex ${PN}_plugins_battery-linux)
-DBUILD_PLUGIN_CPU_USAGE_LINUX=$(usex ${PN}_plugins_cpu-usage-linux)
-DBUILD_PLUGIN_DBUS=$(usex ${PN}_plugins_dbus)
-DBUILD_PLUGIN_FILE_CONTENTS_LINUX=$(usex ${PN}_plugins_file-contents-linux)
-DBUILD_PLUGIN_FS=$(usex ${PN}_plugins_fs)
-DBUILD_PLUGIN_IMAP=$(usex ${PN}_plugins_imap)
-DBUILD_PLUGIN_INOTIFY=$(usex ${PN}_plugins_inotify)
-DBUILD_PLUGIN_MEM_USAGE_LINUX=$(usex ${PN}_plugins_mem-usage-linux)
-DBUILD_PLUGIN_MPD=$(usex ${PN}_plugins_mpd)
-DBUILD_PLUGIN_NETWORK_LINUX=$(usex ${PN}_plugins_network-linux)
-DBUILD_PLUGIN_PIPE=$(usex ${PN}_plugins_pipe)
-DBUILD_PLUGIN_PULSE=$(usex ${PN}_plugins_pulse)
-DBUILD_PLUGIN_TIMER=$(usex ${PN}_plugins_timer)
-DBUILD_PLUGIN_UDEV=$(usex ${PN}_plugins_udev)
-DBUILD_PLUGIN_UNIXSOCK=$(usex ${PN}_plugins_unixsock)
-DBUILD_PLUGIN_XKB=$(usex ${PN}_plugins_xkb)
-DBUILD_PLUGIN_XTITLE=$(usex ${PN}_plugins_xtitle)
)
cmake_src_configure
}
src_install() {
cmake_src_install
local i
if use examples; then
dodir /usr/share/doc/${PF}/examples
docinto examples
for i in ${BARLIBS//+/}; do
if use ${i}; then
barlib=${i#${PN}_barlibs_}
dodoc -r examples/${barlib}
docompress -x /usr/share/doc/${PF}/examples/${barlib}
fi
done
fi
}
================================================
FILE: contrib/luastatus.spec
================================================
Name: luastatus
Version: 0.3.0
Release: 1%{?dist}
Summary: universal statusbar content generator
License: LGPL3+
URL: https://github.com/shdown/luastatus
Source0: https://github.com/shdown/luastatus/archive/v%version.tar.gz
BuildRequires: cmake
BuildRequires: luajit-devel
BuildRequires: libxcb-devel
BuildRequires: yajl-devel
BuildRequires: alsa-lib-devel
BuildRequires: xcb-util-wm-devel
BuildRequires: xcb-util-devel
BuildRequires: glib2-devel
%description
a universal status bar content generator
%package plugins
Summary: luastatus plugins
Requires: %{name} = %{version}-%{release}
%description plugins
luastatus plugins
%prep
%setup -q
%build
%cmake -DWITH_LUA_LIBRARY=luajit .
%make_build
%install
%make_install
%files
%doc COPYING.txt COPYING.LESSER.txt README.md
%{_bindir}/luastatus
%{_bindir}/luastatus-i3-wrapper
%{_bindir}/luastatus-lemonbar-launcher
%{_mandir}/man1/luastatus.1*
%{_libdir}/luastatus/barlibs/*
%files plugins
%{_libdir}/luastatus/plugins/*
%changelog
================================================
FILE: debian/changelog
================================================
luastatus (1:9999) UNRELEASED; urgency=medium
* local build
-- Local User <localuser@localhost> Sat, 08 Feb 2014 01:01:01 -0800
================================================
FILE: debian/compat
================================================
10
================================================
FILE: debian/control
================================================
Source: luastatus
Section: misc
Priority: optional
Maintainer: Viktor Krapivensky <shdownnine@gmail.com>
Standards-Version: 4.5.0
Build-Depends:
cmake (>= 3.1.3),
debhelper (>= 10),
valgrind,
jq,
liblua5.3-dev,
pkg-config,
python3-docutils,
libyajl-dev,
libasound2-dev,
libglib2.0-dev,
libpulse-dev,
libudev-dev,
linux-libc-dev,
libnl-3-dev,
libnl-genl-3-dev,
libx11-dev,
libxcb1-dev,
libxcb-ewmh-dev,
libxcb-icccm4-dev,
libxcb-util0-dev
Homepage: https://github.com/shdown/luastatus
Rules-Requires-Root: no
Package: luastatus
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends:
Suggests:
Description: Universal status bar content generator
luastatus is a universal status bar content generator. It allows the user to
configure the way the data from event sources is processed and shown, with
Lua. Its main feature is that the content can be updated immediately as some
event occurs.
.
This package contains the main binary and the following plugins: timer, fs,
inotify, udev, backlight-linux, battery-linux, cpu-usage-linux,
file-contents-linux, mem-usage-linux, pipe.
Package: luastatus-barlib-i3
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, luastatus
Recommends:
Suggests: i3-wm
Description: i3 barlib for luastatus
This package contains the i3 barlib for luastatus. This barlib talks to i3bar
(part of the i3 window manager), or any other program compatible with it on
the protocol level. This package also pro
gitextract_ja3_jqjt/
├── .circleci/
│ ├── config.yml
│ └── run-pt.sh
├── .gitignore
├── .luacheckrc
├── CMakeLists.txt
├── COPYING.LESSER.txt
├── COPYING.txt
├── DEPENDS.txt
├── DOCS/
│ ├── CUSTOM_DATA_SRC_WIDGET.md
│ ├── MIGRATION_GUIDE.md
│ ├── WRITING_BARLIB_OR_PLUGIN.md
│ ├── c_notes/
│ │ ├── eintr-policy.md
│ │ └── empty-ranges-and-c-stdlib.md
│ └── design/
│ ├── locking-patterns.md
│ └── map_get.md
├── README.md
├── barlibs/
│ ├── dwm/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── dwm.c
│ ├── i3/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── escape_json_str.c
│ │ ├── escape_json_str.h
│ │ ├── event_watcher.c
│ │ ├── event_watcher.h
│ │ ├── fuzz_esc_json/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_esc_pango/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── i3.c
│ │ ├── luastatus-i3-wrapper
│ │ ├── pango_escape.c
│ │ ├── pango_escape.h
│ │ └── priv.h
│ ├── lemonbar/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── fuzz_esc/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_sanitize/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── X_testcase_000
│ │ │ ├── X_testcase_001
│ │ │ ├── X_testcase_002
│ │ │ ├── X_testcase_003
│ │ │ ├── X_testcase_004
│ │ │ ├── X_testcase_005
│ │ │ ├── X_testcase_fps
│ │ │ ├── Y_testcase_000
│ │ │ ├── Y_testcase_001
│ │ │ ├── Y_testcase_002
│ │ │ ├── Y_testcase_003
│ │ │ ├── Z_testcase_000
│ │ │ ├── Z_testcase_001
│ │ │ ├── Z_testcase_002
│ │ │ ├── Z_testcase_003
│ │ │ └── Z_testcase_004
│ │ ├── lemonbar.c
│ │ ├── luastatus-lemonbar-launcher
│ │ ├── markup_utils.c
│ │ └── markup_utils.h
│ └── stdout/
│ ├── CMakeLists.txt
│ ├── README.rst
│ ├── fuzz/
│ │ ├── .gitignore
│ │ ├── build.sh
│ │ ├── clear.sh
│ │ ├── fuzz.sh
│ │ ├── gen_testcases.sh
│ │ ├── harness.c
│ │ └── testcases/
│ │ ├── testcase_000
│ │ ├── testcase_001
│ │ ├── testcase_002
│ │ ├── testcase_003
│ │ ├── testcase_004
│ │ ├── testcase_005
│ │ ├── testcase_006
│ │ ├── testcase_007
│ │ ├── testcase_008
│ │ └── testcase_009
│ ├── luastatus-dvtm
│ ├── luastatus-stdout-wrapper
│ ├── open_stdio_file.c
│ ├── open_stdio_file.h
│ ├── sanitize.c
│ ├── sanitize.h
│ └── stdout.c
├── check_final_newline.py
├── check_includes.sh
├── check_style.sh
├── contrib/
│ ├── luastatus-9999.ebuild
│ └── luastatus.spec
├── debian/
│ ├── changelog
│ ├── compat
│ ├── control
│ ├── copyright
│ └── rules
├── examples/
│ ├── dwm/
│ │ ├── alsa-gauge.lua
│ │ ├── alsa.lua
│ │ ├── backlight.lua
│ │ ├── battery.lua
│ │ ├── bluetooth.lua
│ │ ├── btc-price.lua
│ │ ├── cpu-freq.lua
│ │ ├── cpu-temperature.lua
│ │ ├── cpu-usage.lua
│ │ ├── disk-io.lua
│ │ ├── file-contents.lua
│ │ ├── fs.lua
│ │ ├── gmail.lua
│ │ ├── ip.lua
│ │ ├── loadavg-linux.lua
│ │ ├── media-player-mpris.lua
│ │ ├── mem-usage.lua
│ │ ├── mpd.lua
│ │ ├── network-rate.lua
│ │ ├── pulse-gauge.lua
│ │ ├── pulse.lua
│ │ ├── systemd-unit.lua
│ │ ├── time-battery-combined.lua
│ │ ├── time-date.lua
│ │ ├── tor.lua
│ │ ├── uptime-linux.lua
│ │ ├── weather-rus.lua
│ │ ├── weather.lua
│ │ ├── wireless.lua
│ │ └── xkb.lua
│ ├── i3/
│ │ ├── alsa-gauge.lua
│ │ ├── alsa-interactive-gauge.lua
│ │ ├── alsa.lua
│ │ ├── backlight.lua
│ │ ├── battery.lua
│ │ ├── bluetooth.lua
│ │ ├── btc-price.lua
│ │ ├── cpu-freq.lua
│ │ ├── cpu-temperature.lua
│ │ ├── cpu-usage.lua
│ │ ├── disk-io.lua
│ │ ├── file-contents.lua
│ │ ├── fs.lua
│ │ ├── gmail.lua
│ │ ├── ip.lua
│ │ ├── loadavg-linux.lua
│ │ ├── media-player-mpris.lua
│ │ ├── mem-usage.lua
│ │ ├── mpd-progressbar.lua
│ │ ├── network-rate.lua
│ │ ├── pulse-gauge.lua
│ │ ├── pulse-interactive-gauge.lua
│ │ ├── pulse.lua
│ │ ├── systemd-unit.lua
│ │ ├── time-battery-combined.lua
│ │ ├── time-date.lua
│ │ ├── tor.lua
│ │ ├── update-on-click.lua
│ │ ├── uptime-linux.lua
│ │ ├── weather-rus.lua
│ │ ├── weather.lua
│ │ ├── wireless.lua
│ │ └── xkb.lua
│ └── lemonbar/
│ ├── alsa-gauge.lua
│ ├── alsa.lua
│ ├── backlight.lua
│ ├── battery.lua
│ ├── bluetooth.lua
│ ├── btc-price.lua
│ ├── cpu-freq.lua
│ ├── cpu-temperature.lua
│ ├── cpu-usage.lua
│ ├── disk-io.lua
│ ├── file-contents.lua
│ ├── fs.lua
│ ├── gmail.lua
│ ├── ip.lua
│ ├── loadavg-linux.lua
│ ├── media-player-mpris.lua
│ ├── mem-usage.lua
│ ├── mpd-progressbar.lua
│ ├── network-rate.lua
│ ├── pulse-gauge.lua
│ ├── pulse.lua
│ ├── systemd-unit.lua
│ ├── time-battery-combined.lua
│ ├── time-date.lua
│ ├── tor.lua
│ ├── uptime-linux.lua
│ ├── weather-rus.lua
│ ├── weather.lua
│ ├── wireless.lua
│ └── xkb.lua
├── fuzz_utils/
│ ├── do_fuzz_everything.sh
│ ├── find_interesting.sh
│ ├── fuzz_utils.h
│ └── gen_testcases/
│ ├── .gitignore
│ ├── __init__.py
│ ├── gen_testcases.py
│ ├── mod_generator.py
│ ├── mod_mutator.py
│ └── mod_mutators.py
├── generate-man.sh
├── include/
│ ├── barlib_data.h
│ ├── barlib_data_v1.h
│ ├── barlib_v1.h
│ ├── common.h
│ ├── plugin_data.h
│ ├── plugin_data_v1.h
│ ├── plugin_v1.h
│ └── sayf_macros.h
├── libhackyfix/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── fatal.c
│ ├── fatal.h
│ ├── get_rtld_next_handle.c
│ ├── get_rtld_next_handle.h
│ └── libhackyfix.c
├── libls/
│ ├── CMakeLists.txt
│ ├── ls_algo.h
│ ├── ls_alloc_utils.c
│ ├── ls_alloc_utils.h
│ ├── ls_compdep.h
│ ├── ls_cstring_utils.c
│ ├── ls_cstring_utils.h
│ ├── ls_evloop_lfuncs.h
│ ├── ls_fifo_device.h
│ ├── ls_freemem.h
│ ├── ls_getenv_r.c
│ ├── ls_getenv_r.h
│ ├── ls_io_utils.c
│ ├── ls_io_utils.h
│ ├── ls_lua_compat.h
│ ├── ls_osdep.c
│ ├── ls_osdep.h
│ ├── ls_panic.c
│ ├── ls_panic.h
│ ├── ls_parse_int.c
│ ├── ls_parse_int.h
│ ├── ls_probes.in.h
│ ├── ls_strarr.h
│ ├── ls_string.c
│ ├── ls_string.h
│ ├── ls_time_utils.h
│ ├── ls_tls_ebuf.c
│ ├── ls_tls_ebuf.h
│ ├── ls_xallocf.c
│ └── ls_xallocf.h
├── libmoonvisit/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── moonvisit.c
│ └── moonvisit.h
├── libprocalive/
│ ├── CMakeLists.txt
│ ├── procalive_lfuncs.c
│ └── procalive_lfuncs.h
├── librunshell/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── runshell.c
│ └── runshell.h
├── libsafe/
│ ├── CMakeLists.txt
│ ├── mut_safev.h
│ ├── safe_common.c
│ ├── safe_common.h
│ └── safev.h
├── libwidechar/
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── config.in.h
│ ├── libwidechar.c
│ ├── libwidechar.h
│ ├── libwidechar_compdep.h
│ └── libwidechar_xspan.h
├── plugins/
│ ├── alsa/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── alsa.c
│ ├── backlight-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── backlight-linux.lua
│ ├── battery-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── battery-linux.lua
│ ├── cpu-freq-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── cpu-freq-linux.lua
│ ├── cpu-usage-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── cpu-usage-linux.lua
│ ├── dbus/
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── README_FN_CALL_METHOD.rst
│ │ ├── README_FN_MKVAL.rst
│ │ ├── README_FN_PROP.rst
│ │ ├── bustype2idx.h
│ │ ├── cstringify.sh
│ │ ├── cvt.c
│ │ ├── cvt.h
│ │ ├── dbus.c
│ │ ├── load_lualib.c
│ │ ├── load_lualib.h
│ │ ├── lualib.lua
│ │ └── zoo/
│ │ ├── README.txt
│ │ ├── zoo.c
│ │ ├── zoo.h
│ │ ├── zoo_call_params.c
│ │ ├── zoo_call_params.h
│ │ ├── zoo_call_prot.c
│ │ ├── zoo_call_prot.h
│ │ ├── zoo_checkudata.c
│ │ ├── zoo_checkudata.h
│ │ ├── zoo_mt.c
│ │ ├── zoo_mt.h
│ │ ├── zoo_uncvt_type.c
│ │ ├── zoo_uncvt_type.h
│ │ ├── zoo_uncvt_val.c
│ │ └── zoo_uncvt_val.h
│ ├── disk-io-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── disk-io-linux.lua
│ ├── file-contents-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── file-contents-linux.lua
│ ├── fs/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── fs.c
│ │ ├── strlist.c
│ │ └── strlist.h
│ ├── imap/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── imap.lua
│ ├── inotify/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── inotify.c
│ │ ├── inotify_compat.h
│ │ └── probes.in.h
│ ├── is-program-running/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── is-program-running.lua
│ ├── mem-usage-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── mem-usage-linux.lua
│ ├── mpd/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── connect.c
│ │ ├── connect.h
│ │ ├── fuzz/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── fuzz_all.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness
│ │ │ ├── harness.c
│ │ │ ├── testcases_append_kv/
│ │ │ │ ├── testcase_000
│ │ │ │ ├── testcase_001
│ │ │ │ ├── testcase_002
│ │ │ │ ├── testcase_003
│ │ │ │ ├── testcase_004
│ │ │ │ ├── testcase_005
│ │ │ │ ├── testcase_006
│ │ │ │ ├── testcase_007
│ │ │ │ ├── testcase_008
│ │ │ │ └── testcase_009
│ │ │ ├── testcases_check_greeting/
│ │ │ │ ├── testcase_000
│ │ │ │ ├── testcase_001
│ │ │ │ ├── testcase_002
│ │ │ │ ├── testcase_003
│ │ │ │ ├── testcase_004
│ │ │ │ ├── testcase_005
│ │ │ │ ├── testcase_006
│ │ │ │ ├── testcase_007
│ │ │ │ ├── testcase_008
│ │ │ │ ├── testcase_009
│ │ │ │ └── testcase_pfx_only
│ │ │ ├── testcases_get_resp_type/
│ │ │ │ ├── ack_testcase_000
│ │ │ │ ├── ack_testcase_001
│ │ │ │ ├── ack_testcase_002
│ │ │ │ ├── ack_testcase_003
│ │ │ │ ├── ack_testcase_004
│ │ │ │ ├── ok_testcase_000
│ │ │ │ ├── ok_testcase_001
│ │ │ │ ├── ok_testcase_002
│ │ │ │ ├── ok_testcase_003
│ │ │ │ ├── ok_testcase_004
│ │ │ │ ├── ok_testcase_pfx_only
│ │ │ │ ├── other_testcase_000
│ │ │ │ ├── other_testcase_001
│ │ │ │ ├── other_testcase_002
│ │ │ │ ├── other_testcase_003
│ │ │ │ └── other_testcase_004
│ │ │ └── testcases_write_quoted/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── line_reader.c
│ │ ├── line_reader.h
│ │ ├── mpd.c
│ │ ├── safe_haven.c
│ │ └── safe_haven.h
│ ├── mpris/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── mpris.lua
│ ├── multiplex/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── config.in.h
│ │ ├── conq.c
│ │ ├── conq.h
│ │ ├── external_context.h
│ │ ├── map_ref.c
│ │ ├── map_ref.h
│ │ ├── multiplex.c
│ │ ├── priv.h
│ │ ├── runner.c
│ │ ├── runner.h
│ │ ├── runtime_data.c
│ │ ├── runtime_data.h
│ │ ├── wspec_list.c
│ │ └── wspec_list.h
│ ├── network-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── ethernet_info.c
│ │ ├── ethernet_info.h
│ │ ├── iface_type.c
│ │ ├── iface_type.h
│ │ ├── network.c
│ │ ├── string_set.c
│ │ ├── string_set.h
│ │ ├── wireless_info.c
│ │ └── wireless_info.h
│ ├── network-rate-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── network-rate-linux.lua
│ ├── pipe/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── pipe.lua
│ ├── pipev2/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── launch.c
│ │ ├── launch.h
│ │ ├── pipev2.c
│ │ ├── sigdb.c
│ │ ├── sigdb.h
│ │ ├── utils.c
│ │ └── utils.h
│ ├── pulse/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── pulse.c
│ ├── systemd-unit/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── systemd-unit.lua
│ ├── temperature-linux/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── temperature-linux.lua
│ ├── timer/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── timer.c
│ ├── udev/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ └── udev.c
│ ├── unixsock/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── cloexec_accept.c
│ │ ├── cloexec_accept.h
│ │ ├── probes.in.h
│ │ ├── server.c
│ │ ├── server.h
│ │ └── unixsock.c
│ ├── web/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── compat_lua_resume.c
│ │ ├── compat_lua_resume.h
│ │ ├── fuzz_esc_json/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── clear.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── fuzz_urldecode/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ ├── testcase_009
│ │ │ ├── testcase_extra1
│ │ │ ├── testcase_extra2
│ │ │ └── testcase_extra3
│ │ ├── fuzz_urlencode/
│ │ │ ├── .gitignore
│ │ │ ├── build.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── fuzz_all.sh
│ │ │ ├── gen_testcases.sh
│ │ │ ├── harness.c
│ │ │ └── testcases/
│ │ │ ├── testcase_000
│ │ │ ├── testcase_001
│ │ │ ├── testcase_002
│ │ │ ├── testcase_003
│ │ │ ├── testcase_004
│ │ │ ├── testcase_005
│ │ │ ├── testcase_006
│ │ │ ├── testcase_007
│ │ │ ├── testcase_008
│ │ │ └── testcase_009
│ │ ├── get_min_curl_ver.sh
│ │ ├── json_config.in.h
│ │ ├── make_request.c
│ │ ├── make_request.h
│ │ ├── mod_json/
│ │ │ ├── json_decode.c
│ │ │ ├── json_decode.h
│ │ │ ├── json_encode_num.c
│ │ │ ├── json_encode_num.h
│ │ │ ├── json_encode_str.c
│ │ │ ├── json_encode_str.h
│ │ │ ├── mod_json.c
│ │ │ └── mod_json.h
│ │ ├── mod_urlencode/
│ │ │ ├── mod_urlencode.c
│ │ │ ├── mod_urlencode.h
│ │ │ ├── urldecode.c
│ │ │ ├── urldecode.h
│ │ │ ├── urlencode.c
│ │ │ └── urlencode.h
│ │ ├── next_request_params.h
│ │ ├── opts.c
│ │ ├── opts.h
│ │ ├── parse_opts.c
│ │ ├── parse_opts.h
│ │ ├── set_error.c
│ │ ├── set_error.h
│ │ └── web.c
│ ├── xkb/
│ │ ├── CMakeLists.txt
│ │ ├── README.rst
│ │ ├── somehow.c
│ │ ├── somehow.h
│ │ ├── wrongly.c
│ │ ├── wrongly.h
│ │ └── xkb.c
│ └── xtitle/
│ ├── CMakeLists.txt
│ ├── README.rst
│ └── xtitle.c
├── release.sh
├── run_literally_all_tests.sh
├── run_luacheck.sh
└── tests/
├── .gitignore
├── CMakeLists.txt
├── README.txt
├── barlib-runners/
│ └── runner-redirect-34
├── dlopen.supp
├── glib.supp
├── httpserv/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── argparser.c
│ ├── argparser.h
│ ├── buffer.c
│ ├── buffer.h
│ ├── common.c
│ ├── common.h
│ ├── main.c
│ ├── server.c
│ ├── server.h
│ ├── sleep_millis.c
│ └── sleep_millis.h
├── kcov_wrapper.c
├── listnets.c
├── minstd.h
├── mock_barlib.c
├── mock_plugin.c
├── optional/
│ └── dbus_srv.py
├── parrot.c
├── pt.sh
├── pt_dbus_daemon.lib.bash
├── pt_pulseaudio_daemon.lib.bash
├── pt_stopwatch.lib.bash
├── pt_tests/
│ ├── _misc/
│ │ └── 01-simul.lib.bash
│ ├── add_test.sh
│ ├── barlib-i3/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 02-input.lib.bash
│ │ └── 03-lfunc-pango-escape.lib.bash
│ ├── barlib-lemonbar/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 02-input.lib.bash
│ │ └── 03-lfunc-pango-escape.lib.bash
│ ├── barlib-stdout/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-output.lib.bash
│ │ ├── 03-input-filename.lib.bash
│ │ └── 04-input-fd.lib.bash
│ ├── luastatus/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-misc.lib.bash
│ │ ├── 02-getenv.lib.bash
│ │ ├── 03-exit.lib.bash
│ │ ├── 04-setlocale.lib.bash
│ │ ├── 05-libwidechar.lib.bash
│ │ └── 06-execute.lib.bash
│ ├── plugin-battery-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-full-status-full.lib.bash
│ │ ├── 02-full-status-not-charging.lib.bash
│ │ ├── 03-dischaging.lib.bash
│ │ ├── 04-charging.lib.bash
│ │ └── 05-nofile.lib.bash
│ ├── plugin-cpu-freq-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-please-reload.lib.bash
│ ├── plugin-cpu-usage-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-total.lib.bash
│ │ ├── 02-cpu1.lib.bash
│ │ ├── 03-cpu2.lib.bash
│ │ ├── 04-cpu3.lib.bash
│ │ └── 05-cpu4.lib.bash
│ ├── plugin-dbus/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-timeout.lib.bash
│ │ ├── 03-greet.lib.bash
│ │ ├── 04-get-prop.lib.bash
│ │ ├── 05-get-all-prop.lib.bash
│ │ ├── 06-OPTIONAL-getset-prop.lib.bash
│ │ ├── 07-OPTIONAL-getall-prop.lib.bash
│ │ ├── 08-OPTIONAL-call-method-str.lib.bash
│ │ ├── 09-OPTIONAL-call-method-DTLL.lib.bash
│ │ ├── 10-OPTIONAL-call-method-arr.lib.bash
│ │ ├── 11-OPTIONAL-call-method-dict.lib.bash
│ │ ├── 12-OPTIONAL-call-method-tuple.lib.bash
│ │ ├── 13-OPTIONAL-call-method-misc.lib.bash
│ │ ├── 14-OPTIONAL-call-method-handle.lib.bash
│ │ ├── 15-report-when-ready.lib.bash
│ │ └── skip-me-if.lib.bash
│ ├── plugin-disk-io-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-file-contents-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-fs/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-default.lib.bash
│ │ ├── 02-root.lib.bash
│ │ ├── 03-glob-yesmatch.lib.bash
│ │ ├── 04-glob-nomatch.lib.bash
│ │ ├── 05-bad-path.lib.bash
│ │ ├── 06-wakeup-fifo.lib.bash
│ │ └── 07-dyn-paths.lib.bash
│ ├── plugin-imap/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-retry-timeout.lib.bash
│ │ └── 03-idle-timeout.lib.bash
│ ├── plugin-inotify/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-lfunc-get-initial-wds.lib.bash
│ │ ├── 03-lfunc-add-watch.lib.bash
│ │ ├── 04-lfunuc-rm-watch.lib.bash
│ │ ├── 05-timeout.lib.bash
│ │ ├── 06-dir.lib.bash
│ │ ├── 07-lfunc-push-timeout.lib.bash
│ │ ├── 08-lfunc-get-supported-events.lib.bash
│ │ └── 09-access.lib.bash
│ ├── plugin-is-program-running/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-pidfile-devnull.lib.bash
│ │ ├── 02-pidfile.lib.bash
│ │ ├── 03-pidfile-fileerr.lib.bash
│ │ ├── 04-fileexists.lib.bash
│ │ ├── 05-dirnonempty-root.lib.bash
│ │ ├── 06-dirnonempty-normal-files.lib.bash
│ │ ├── 07-dirnonempty-nonexisting.lib.bash
│ │ └── 08-dirnonempty-with-hidden.lib.bash
│ ├── plugin-mem-usage-linux/
│ │ ├── 00-common.lib.bash
│ │ └── 01-simple.lib.bash
│ ├── plugin-mpd/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-bad-answer.lib.bash
│ │ ├── 02-simple-template.lib.bash
│ │ ├── 03-simple.lib.bash
│ │ ├── 04-simple-bind.lib.bash
│ │ ├── 05-simple-bind-invalid.lib.bash
│ │ ├── 06-simple-bind-invalid-ipv6.lib.bash
│ │ ├── 07-keepalive.lib.bash
│ │ ├── 08-retry-in.lib.bash
│ │ ├── 09-retry-fifo.lib.bash
│ │ ├── 10-timeout.lib.bash
│ │ ├── 11-password-and-events.lib.bash
│ │ ├── 12-connect-via-unix-socket.lib.bash
│ │ ├── 13-bad-password.lib.bash
│ │ └── 14-bad-hostname.lib.bash
│ ├── plugin-multiplex/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-two-data-sources.lib.bash
│ │ └── 03-call-event.lib.bash
│ ├── plugin-network-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-simple-newfmt.lib.bash
│ ├── plugin-network-rate-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-in-array-form.lib.bash
│ │ └── 03-iface-filter.lib.bash
│ ├── plugin-pipe/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-func-shell-escape.lib.bash
│ ├── plugin-pipev2/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-greet.lib.bash
│ │ ├── 03-bye.lib.bash
│ │ ├── 04-write-to-stdin.lib.bash
│ │ ├── 05-kill-default.lib.bash
│ │ ├── 06-kill-by-spelling.lib.bash
│ │ ├── 07-kill-by-signo.lib.bash
│ │ └── 08-sigrt-bounds.lib.bash
│ ├── plugin-pulse/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ └── 02-lfuncs.lib.bash
│ ├── plugin-temperature-linux/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-common-carcass.lib.bash
│ │ ├── 02-simple.lib.bash
│ │ ├── 03-filter-by-kind.lib.bash
│ │ └── 04-filter-by-name.lib.bash
│ ├── plugin-timer/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-default.lib.bash
│ │ ├── 02-period.lib.bash
│ │ ├── 03-wakeup-fifo.lib.bash
│ │ ├── 04-lfuncs.lib.bash
│ │ ├── 05-procalive-lfuncs.lib.bash
│ │ └── 06-self-pipe.lib.bash
│ ├── plugin-unixsock/
│ │ ├── 00-common.lib.bash
│ │ ├── 01-simple.lib.bash
│ │ ├── 02-greet.lib.bash
│ │ ├── 03-do-not-try-unlink-failure.lib.bash
│ │ ├── 04-do-try-unlink-success.lib.bash
│ │ ├── 05-timeout.lib.bash
│ │ └── 06-lfuncs.lib.bash
│ └── plugin-web/
│ ├── 00-common.lib.bash
│ ├── 01-simple.lib.bash
│ ├── 02-post.lib.bash
│ ├── 03-call-cb.lib.bash
│ ├── 04-with-headers.lib.bash
│ ├── 05-json-encode.lib.bash
│ ├── 06-urlencode.lib.bash
│ ├── 07-urldecode.lib.bash
│ ├── 08-json-decode.lib.bash
│ ├── 09-json-decode-null.lib.bash
│ ├── 10-error.lib.bash
│ ├── 11-timeout.lib.bash
│ ├── 12-not-avail.lib.bash
│ ├── 13-time-now.lib.bash
│ └── 14-get-supported-opts.lib.bash
├── pulsetalker.sh
├── stopwatch.c
├── torture.sh
└── utils.lib.bash
SYMBOL INDEX (935 symbols across 148 files)
FILE: barlibs/dwm/dwm.c
type Priv (line 35) | typedef struct {
function destroy (line 53) | static void destroy(LuastatusBarlibData *bd)
function do_connect (line 69) | static int do_connect(
function redraw (line 90) | static bool redraw(LuastatusBarlibData *bd)
function init (line 130) | static int init(LuastatusBarlibData *bd, const char *const *opts, size_t...
function set (line 177) | static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
function set_error (line 239) | static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
FILE: barlibs/i3/escape_json_str.c
function append_sv (line 27) | static inline void append_sv(LS_String *dst, SAFEV v)
function append_json_escaped_str (line 32) | void append_json_escaped_str(LS_String *dst, SAFEV v)
FILE: barlibs/i3/event_watcher.c
type Token (line 47) | typedef struct {
type TokenList (line 69) | typedef struct {
function TokenList (line 75) | static inline TokenList token_list_new(void)
function token_list_push (line 80) | static inline void token_list_push(TokenList *x, Token token)
function token_list_clear (line 88) | static inline void token_list_clear(TokenList *x)
function token_list_free (line 93) | static inline void token_list_free(TokenList *x)
type Context (line 98) | typedef struct {
function push_object (line 121) | static void push_object(lua_State *L, Context *ctx, size_t *idx)
function flush (line 180) | static void flush(Context *ctx)
function token_helper (line 199) | static int token_helper(Context *ctx, Token token)
function append_to_strarr (line 236) | static inline size_t append_to_strarr(Context *ctx, const char *buf, siz...
function callback_null (line 242) | static int callback_null(void *vctx)
function callback_boolean (line 247) | static int callback_boolean(void *vctx, int value)
function callback_integer (line 252) | static int callback_integer(void *vctx, long long value)
function callback_double (line 257) | static int callback_double(void *vctx, double value)
function callback_string (line 262) | static int callback_string(void *vctx, const unsigned char *buf, size_t ...
function callback_start_map (line 276) | static int callback_start_map(void *vctx)
function callback_map_key (line 281) | static int callback_map_key(void *vctx, const unsigned char *buf, size_t...
function callback_end_map (line 293) | static int callback_end_map(void *vctx)
function callback_start_array (line 298) | static int callback_start_array(void *vctx)
function callback_end_array (line 303) | static int callback_end_array(void *vctx)
function event_watcher (line 308) | int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs funcs)
FILE: barlibs/i3/fuzz_esc_json/harness.c
function main (line 31) | int main(int argc, char **argv)
FILE: barlibs/i3/fuzz_esc_pango/harness.c
function append_to_ls_string (line 31) | static void append_to_ls_string(void *ud, SAFEV segment)
function main (line 37) | int main(int argc, char **argv)
FILE: barlibs/i3/i3.c
function destroy (line 46) | static void destroy(LuastatusBarlibData *bd)
function init (line 61) | static int init(LuastatusBarlibData *bd, const char *const *opts, size_t...
function redraw (line 157) | static bool redraw(LuastatusBarlibData *bd)
function append_to_lua_buf (line 185) | static void append_to_lua_buf(void *ud, SAFEV segment)
function l_pango_escape (line 191) | static int l_pango_escape(lua_State *L)
function register_funcs (line 207) | static void register_funcs(LuastatusBarlibData *bd, lua_State *L)
function append_json_number (line 215) | static inline bool append_json_number(LS_String *s, double value)
function append_segment (line 226) | static bool append_segment(LuastatusBarlibData *bd, lua_State *L, size_t...
type TableClass (line 308) | typedef enum {
function TableClass (line 314) | static inline TableClass classify_table(lua_State *L)
function set (line 328) | static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
function set_error (line 391) | static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
FILE: barlibs/i3/pango_escape.c
function pango_escape (line 26) | void pango_escape(
FILE: barlibs/i3/priv.h
type Priv (line 29) | typedef struct {
FILE: barlibs/lemonbar/fuzz_esc/harness.c
function append_to_ls_string (line 31) | static void append_to_ls_string(void *ud, SAFEV segment)
function main (line 37) | int main(int argc, char **argv)
FILE: barlibs/lemonbar/fuzz_sanitize/harness.c
function main (line 31) | int main(int argc, char **argv)
FILE: barlibs/lemonbar/lemonbar.c
type Priv (line 43) | typedef struct {
function destroy (line 60) | static void destroy(LuastatusBarlibData *bd)
function init (line 75) | static int init(LuastatusBarlibData *bd, const char *const *opts, size_t...
function append_to_lua_buf_callback (line 152) | static void append_to_lua_buf_callback(void *ud, SAFEV v)
function l_escape (line 158) | static int l_escape(lua_State *L)
function register_funcs (line 174) | static void register_funcs(LuastatusBarlibData *bd, lua_State *L)
function redraw (line 182) | static bool redraw(LuastatusBarlibData *bd)
function set (line 209) | static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
function set_error (line 274) | static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
function event_watcher (line 284) | static int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs...
FILE: barlibs/lemonbar/markup_utils.c
function escape (line 29) | void escape(
function append_sv (line 47) | static inline void append_sv(LS_String *dst, SAFEV v)
function append_sanitized (line 52) | void append_sanitized(LS_String *buf, size_t widget_idx, SAFEV v)
FILE: barlibs/stdout/fuzz/harness.c
function main (line 31) | int main(int argc, char **argv)
FILE: barlibs/stdout/open_stdio_file.c
function open_input_fd (line 33) | static bool open_input_fd(
function open_input_filename (line 52) | static bool open_input_filename(
function open_input (line 73) | bool open_input(
function open_output (line 92) | bool open_output(
FILE: barlibs/stdout/sanitize.c
function append_sv (line 25) | static inline void append_sv(LS_String *dst, SAFEV v)
function append_sanitized (line 30) | void append_sanitized(LS_String *buf, SAFEV v)
FILE: barlibs/stdout/stdout.c
type Priv (line 42) | typedef struct {
function destroy (line 62) | static void destroy(LuastatusBarlibData *bd)
function init (line 81) | static int init(LuastatusBarlibData *bd, const char *const *opts, size_t...
function redraw (line 157) | static bool redraw(LuastatusBarlibData *bd)
function set (line 184) | static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
function set_error (line 246) | static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
function event_watcher (line 256) | static int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs...
FILE: check_final_newline.py
function say (line 6) | def say(s: str) -> None:
function main (line 10) | def main() -> None:
FILE: fuzz_utils/fuzz_utils.h
type FuzzInput (line 43) | typedef struct {
function FUZZ_UTILS_INHEADER (line 49) | FUZZ_UTILS_INHEADER FuzzInput fuzz_input_new_prealloc(size_t prealloc)
function FUZZ_UTILS_INHEADER (line 65) | FUZZ_UTILS_INHEADER void fuzz_input__ensure1(FuzzInput *x)
function fuzz_input_read (line 89) | int fuzz_input_read(int fd, FuzzInput *dst)
function FUZZ_UTILS_INHEADER (line 103) | FUZZ_UTILS_INHEADER void fuzz_input_free(FuzzInput x)
function FUZZ_UTILS_INHEADER (line 108) | FUZZ_UTILS_INHEADER void fuzz_utils_used(const char *ptr, size_t len)
FILE: fuzz_utils/gen_testcases/gen_testcases.py
class ChunkSpec (line 36) | class ChunkSpec:
method __init__ (line 37) | def __init__(self, weight: int, chunk: bytes, is_homogeneous: bool) ->...
function make_chunk_spec_checked (line 45) | def make_chunk_spec_checked(weight: int, chunk: bytes, is_homogeneous: b...
function into_h_w_and_rest (line 53) | def into_h_w_and_rest(s: str) -> typing.Tuple[bool, int, str]:
function parse_arg_ab (line 64) | def parse_arg_ab(s: str) -> ChunkSpec:
function parse_arg_ab_range (line 72) | def parse_arg_ab_range(s: str) -> ChunkSpec:
function parse_arg_length (line 86) | def parse_arg_length(s: str) -> typing.Tuple[int, int]:
function parse_arg_num_files (line 100) | def parse_arg_num_files(s: str) -> int:
function parse_arg_prefix (line 107) | def parse_arg_prefix(s: str) -> bytes:
function parse_arg_substrings (line 111) | def parse_arg_substrings(s: str) -> typing.List[bytes]:
function parse_arg_extra_testcase (line 117) | def parse_arg_extra_testcase(s: str) -> typing.Tuple[str, bytes]:
function main (line 122) | def main() -> None:
FILE: fuzz_utils/gen_testcases/mod_generator.py
function _clamp (line 22) | def _clamp(x: int, min_value: int, max_value: int) -> int:
class Sheaf (line 31) | class Sheaf:
method __init__ (line 32) | def __init__(self, b: bytes, is_homogeneous: bool) -> None:
method get_length (line 37) | def get_length(self) -> int:
method random_byte (line 40) | def random_byte(self) -> bytes:
method all_bytes (line 44) | def all_bytes(self) -> typing.Iterator[bytes]:
class WeightedSheafList (line 49) | class WeightedSheafList:
method __init__ (line 50) | def __init__(self) -> None:
method add_sheaf (line 54) | def add_sheaf(self, sheaf: Sheaf, weight: int) -> None:
method is_nonempty (line 59) | def is_nonempty(self) -> bool:
method random_sheaf (line 62) | def random_sheaf(self) -> Sheaf:
method get_whole_length (line 67) | def get_whole_length(self) -> int:
method make_whole_iterator (line 76) | def make_whole_iterator(self) -> typing.Iterator[bytes]:
class Generator (line 87) | class Generator:
method __init__ (line 88) | def __init__(self) -> None:
method add_sheaf_for_key (line 91) | def add_sheaf_for_key(self, key: str, sheaf: Sheaf, weight: int) -> None:
method has_choices_for_key (line 94) | def has_choices_for_key(self, key: str) -> bool:
method get_whole_length_for_key (line 97) | def get_whole_length_for_key(self, key: str) -> int:
method random_bytes (line 100) | def random_bytes(self, length: int, i: int, n: int, include_all_of_A: ...
FILE: fuzz_utils/gen_testcases/mod_mutator.py
class Mutator (line 23) | class Mutator:
method mutate (line 24) | def mutate(self, b: bytes, variant: int) -> bytes:
method get_number_of_variants (line 27) | def get_number_of_variants(self) -> int:
function generate_with_mutators (line 31) | def generate_with_mutators(
FILE: fuzz_utils/gen_testcases/mod_mutators.py
class PrefixMutator (line 24) | class PrefixMutator(mod_mutator.Mutator):
method __init__ (line 25) | def __init__(self, prefix: bytes) -> None:
method mutate (line 28) | def mutate(self, b: bytes, variant: int) -> bytes:
method get_number_of_variants (line 31) | def get_number_of_variants(self) -> int:
class SubstringMutator (line 35) | class SubstringMutator(mod_mutator.Mutator):
method __init__ (line 36) | def __init__(self, substr_variants: typing.List[bytes]) -> None:
method mutate (line 39) | def mutate(self, b: bytes, variant: int) -> bytes:
method get_number_of_variants (line 44) | def get_number_of_variants(self) -> int:
FILE: include/barlib_data.h
type LUASTATUS_BARLIB_SAYF_ATTRIBUTE (line 36) | typedef LUASTATUS_BARLIB_SAYF_ATTRIBUTE void LuastatusBarlibSayf_v1(
type LuastatusBarlibData_v1 (line 39) | typedef struct {
type LuastatusBarlibEWFuncs_v1 (line 53) | typedef struct {
type LuastatusBarlibIface_v1 (line 59) | typedef struct {
FILE: include/plugin_data.h
type LUASTATUS_PLUGIN_SAYF_ATTRIBUTE (line 36) | typedef LUASTATUS_PLUGIN_SAYF_ATTRIBUTE void LuastatusPluginSayf_v1(
type LuastatusPluginData_v1 (line 39) | typedef struct {
type LuastatusPluginRunFuncs_v1 (line 53) | typedef struct {
type LuastatusPluginIface_v1 (line 59) | typedef struct {
FILE: libhackyfix/fatal.c
function full_write (line 26) | static void full_write(int fd, const char *buf, size_t nbuf)
function libhackyfix_fatal (line 38) | void libhackyfix_fatal(const char *msg)
FILE: libhackyfix/libhackyfix.c
type lconv (line 38) | struct lconv
type lconv (line 40) | struct lconv
function query_and_copy_lconv (line 56) | static void query_and_copy_lconv(void)
function initialize (line 77) | __attribute__((constructor))
function deinitialize (line 95) | __attribute__((destructor))
function fflush (line 114) | int fflush(FILE *f)
type lconv (line 167) | struct lconv
FILE: libls/ls_alloc_utils.c
function mul_zu (line 27) | static inline bool mul_zu(size_t *dst, size_t a, size_t b)
FILE: libls/ls_cstring_utils.h
function LS_INHEADER (line 31) | LS_INHEADER const char *ls_strfollow(const char *str, const char *prefix)
FILE: libls/ls_evloop_lfuncs.h
type LS_PushedTimeout (line 50) | typedef struct {
function LS_INHEADER (line 56) | LS_INHEADER void ls_pushed_timeout_init(LS_PushedTimeout *p)
function LS_INHEADER (line 66) | LS_INHEADER LS_TimeDelta ls_pushed_timeout_fetch(LS_PushedTimeout *p, LS...
function LS_INHEADER (line 80) | LS_INHEADER int ls_pushed_timeout_lfunc(lua_State *L)
function LS_INHEADER (line 104) | LS_INHEADER void ls_pushed_timeout_push_luafunc(LS_PushedTimeout *p, lua...
function LS_INHEADER (line 111) | LS_INHEADER void ls_pushed_timeout_destroy(LS_PushedTimeout *p)
function LS_INHEADER (line 133) | LS_INHEADER int ls_self_pipe_open(int fds[2])
function LS_INHEADER (line 145) | LS_INHEADER int ls_self_pipe_lfunc(lua_State *L)
function LS_INHEADER (line 168) | LS_INHEADER void ls_self_pipe_push_luafunc(int fds[2], lua_State *L)
FILE: libls/ls_fifo_device.h
type LS_FifoDevice (line 49) | typedef struct {
function ls_fifo_device_new (line 53) | ls_fifo_device_new(void)
function LS_INHEADER (line 58) | LS_INHEADER int ls_fifo_device_open(LS_FifoDevice *dev, const char *path)
function LS_INHEADER (line 73) | LS_INHEADER int ls_fifo_device_wait(LS_FifoDevice *dev, LS_TimeDelta tmo)
function LS_INHEADER (line 83) | LS_INHEADER void ls_fifo_device_close(LS_FifoDevice *dev)
function LS_INHEADER (line 88) | LS_INHEADER void ls_fifo_device_reset(LS_FifoDevice *dev)
FILE: libls/ls_io_utils.c
function poll_forever (line 30) | static int poll_forever(struct pollfd *fds, size_t nfds)
function ls_poll (line 39) | int ls_poll(struct pollfd *fds, size_t nfds, LS_TimeDelta tmo)
function ls_open_fifo (line 66) | int ls_open_fifo(const char *fifo)
FILE: libls/ls_io_utils.h
function LS_INHEADER (line 40) | LS_INHEADER int ls_make_cloexec(int fd)
function LS_INHEADER (line 56) | LS_INHEADER int ls_make_nonblock(int fd)
function LS_INHEADER (line 70) | LS_INHEADER int ls_close(int fd)
type pollfd (line 79) | struct pollfd
function LS_INHEADER (line 82) | LS_INHEADER int ls_wait_input_on_fd(int fd, LS_TimeDelta tmo)
FILE: libls/ls_lua_compat.h
function LS_INHEADER (line 37) | LS_INHEADER bool ls_lua_is_lua51(lua_State *L)
function LS_INHEADER (line 55) | LS_INHEADER size_t ls_lua_array_len(lua_State *L, int pos)
function LS_INHEADER (line 71) | LS_INHEADER int ls_lua_num_prealloc(size_t n)
FILE: libls/ls_osdep.c
function ls_cloexec_pipe (line 29) | int ls_cloexec_pipe(int pipefd[2])
function ls_cloexec_socket (line 43) | int ls_cloexec_socket(int domain, int type, int protocol)
FILE: libls/ls_panic.c
function ls__do_panic_impl__ (line 25) | void ls__do_panic_impl__(
function ls__do_panic_with_errnum_impl__ (line 39) | void ls__do_panic_with_errnum_impl__(
FILE: libls/ls_parse_int.c
function ls_strtou_b (line 25) | int ls_strtou_b(const char *s, size_t ns, const char **endptr)
function ls_full_strtou_b (line 53) | int ls_full_strtou_b(const char *s, size_t ns)
FILE: libls/ls_parse_int.h
function LS_INHEADER (line 47) | LS_INHEADER int ls_full_strtou(const char *s)
FILE: libls/ls_strarr.h
type LS_StringArray_Offsets (line 34) | typedef struct {
type LS_StringArray (line 40) | typedef struct {
function ls_strarr_new (line 45) | ls_strarr_new(void)
function LS_INHEADER (line 53) | LS_INHEADER LS_StringArray ls_strarr_new_reserve(size_t totlen, size_t n...
function LS_INHEADER (line 62) | LS_INHEADER void ls_strarr_append(LS_StringArray *sa, const char *buf, s...
function LS_INHEADER (line 73) | LS_INHEADER void ls_strarr_append_s(LS_StringArray *sa, const char *s)
function LS_INHEADER (line 80) | LS_INHEADER size_t ls_strarr_size(LS_StringArray sa)
function LS_INHEADER (line 85) | LS_INHEADER const char *ls_strarr_at(LS_StringArray sa, size_t i, size_t...
function LS_INHEADER (line 99) | LS_INHEADER void ls_strarr_clear(LS_StringArray *sa)
function LS_INHEADER (line 107) | LS_INHEADER void ls_strarr_destroy(LS_StringArray sa)
FILE: libls/ls_string.c
function ls_string_append_vf (line 27) | void ls_string_append_vf(LS_String *x, const char *fmt, va_list vl)
FILE: libls/ls_string.h
type LS_String (line 34) | typedef struct {
function LS_INHEADER (line 40) | LS_INHEADER LS_String ls_string_new(void)
function LS_INHEADER (line 45) | LS_INHEADER LS_String ls_string_new_reserve(size_t n)
function LS_INHEADER (line 51) | LS_INHEADER void ls_string_reserve(LS_String *x, size_t n)
function LS_INHEADER (line 59) | LS_INHEADER void ls_string_ensure_avail(LS_String *x, size_t n)
function LS_INHEADER (line 66) | LS_INHEADER void ls_string_clear(LS_String *x)
function LS_INHEADER (line 71) | LS_INHEADER void ls_string_assign_b(LS_String *x, const char *buf, size_...
function LS_INHEADER (line 81) | LS_INHEADER void ls_string_assign_s(LS_String *x, const char *s)
function LS_INHEADER (line 88) | LS_INHEADER void ls_string_append_b(LS_String *x, const char *buf, size_...
function LS_INHEADER (line 98) | LS_INHEADER void ls_string_append_s(LS_String *x, const char *s)
function LS_INHEADER (line 105) | LS_INHEADER void ls_string_append_c(LS_String *x, char c)
function ls_string_assign_vf (line 128) | void ls_string_assign_vf(LS_String *x, const char *fmt, va_list vl)
function LS_INHEADER (line 143) | LS_INHEADER LS_String ls_string_new_from_s(const char *s)
function LS_INHEADER (line 150) | LS_INHEADER LS_String ls_string_new_from_b(const char *buf, size_t nbuf)
function LS_INHEADER (line 157) | LS_INHEADER LS_ATTR_PRINTF(1, 0)
function LS_INHEADER (line 182) | LS_INHEADER bool ls_string_eq(LS_String x, LS_String y)
function LS_INHEADER (line 188) | LS_INHEADER void ls_string_swap(LS_String *x, LS_String *y)
function LS_INHEADER (line 193) | LS_INHEADER void ls_string_free(LS_String x)
FILE: libls/ls_time_utils.h
type LS_TimeStamp (line 40) | typedef struct {
type LS_TimeDelta (line 45) | typedef struct {
function LS_INHEADER (line 55) | LS_INHEADER bool ls_double_is_good_time_delta(double x)
function LS_INHEADER (line 60) | LS_INHEADER bool ls_TD_is_forever(LS_TimeDelta TD)
function LS_INHEADER (line 65) | LS_INHEADER bool ls_TS_is_bad(LS_TimeStamp TS)
function LS_INHEADER (line 70) | LS_INHEADER bool ls_double_to_TD_checked(double delta, LS_TimeDelta *out)
function LS_INHEADER (line 82) | LS_INHEADER LS_TimeDelta ls_double_to_TD(double delta, LS_TimeDelta if_bad)
function LS_INHEADER (line 91) | LS_INHEADER LS_TimeDelta ls_double_to_TD_or_die(double delta)
function LS_INHEADER (line 100) | LS_INHEADER double ls_timespec_to_raw_double(struct timespec ts)
function LS_INHEADER (line 107) | LS_INHEADER LS_TimeStamp ls_timespec_to_TS(struct timespec ts)
function LS_INHEADER (line 112) | LS_INHEADER LS_TimeDelta ls_timespec_to_TD(struct timespec ts)
function timespec (line 117) | timespec ls_now_timespec(void)
function ls_now (line 145) | ls_now(void)
function timespec (line 150) | timespec ls_TD_to_timespec(LS_TimeDelta TD)
function timeval (line 161) | timeval ls_TD_to_timeval(LS_TimeDelta TD)
function LS_INHEADER (line 172) | LS_INHEADER int ls_TD_to_poll_ms_tmo(LS_TimeDelta TD)
function LS_INHEADER (line 181) | LS_INHEADER LS_TimeDelta ls_TS_minus_TS_nonneg(LS_TimeStamp a, LS_TimeSt...
function LS_INHEADER (line 190) | LS_INHEADER LS_TimeStamp ls_TS_plus_TD(LS_TimeStamp a, LS_TimeDelta b)
function LS_INHEADER (line 198) | LS_INHEADER bool ls_TD_less(LS_TimeDelta a, LS_TimeDelta b)
function LS_INHEADER (line 206) | LS_INHEADER void ls_sleep(LS_TimeDelta TD)
function LS_INHEADER (line 221) | LS_INHEADER void ls_sleep_simple(double seconds)
FILE: libls/ls_tls_ebuf.h
function LS_INHEADER (line 32) | LS_INHEADER const char *ls_tls_strerror(int errnum)
FILE: libmoonvisit/moonvisit.c
function oom_handler (line 31) | static void oom_handler(void)
function write_str (line 41) | static size_t write_str(char *dst, size_t ndst, const char *src)
function moon_visit_err (line 52) | bool moon_visit_err(MoonVisit *mv, const char *fmt, ...)
function moon_visit_checktype_at (line 72) | int moon_visit_checktype_at(
function moon_visit_str_f (line 97) | int moon_visit_str_f(
function moon_visit_str (line 132) | int moon_visit_str(
function moon_visit_num (line 171) | int moon_visit_num(
function moon_visit_bool (line 197) | int moon_visit_bool(
function moon_visit_table_f (line 223) | int moon_visit_table_f(
function aux_is_first_key_numeric (line 247) | static inline bool aux_is_first_key_numeric(lua_State *L, int pos)
function aux_get_array_len (line 262) | static inline size_t aux_get_array_len(lua_State *L, int pos)
function moon_visit_table_f_at (line 271) | int moon_visit_table_f_at(
function moon_visit_sint (line 322) | int moon_visit_sint(
function moon_visit_uint (line 345) | int moon_visit_uint(
function moon_visit_scrutinize_table (line 368) | int moon_visit_scrutinize_table(
function moon_visit_scrutinize_str (line 386) | int moon_visit_scrutinize_str(
FILE: libmoonvisit/moonvisit.h
type MoonVisit (line 36) | typedef struct {
FILE: libprocalive/procalive_lfuncs.c
function procalive_lfunc_access (line 59) | int procalive_lfunc_access(lua_State *L)
function procalive_lfunc_stat (line 83) | int procalive_lfunc_stat(lua_State *L)
function get_lua_num_prealloc (line 128) | static inline int get_lua_num_prealloc(size_t n)
function push_glob_t (line 133) | static bool push_glob_t(lua_State *L, glob_t *g)
function procalive_lfunc_glob (line 147) | int procalive_lfunc_glob(lua_State *L)
function pid_t (line 194) | static pid_t parse_pid(const char *s, const char **out_err_msg)
function procalive_lfunc_is_process_alive (line 213) | int procalive_lfunc_is_process_alive(lua_State *L)
function procalive_lfuncs_register_all (line 248) | void procalive_lfuncs_register_all(lua_State *L)
FILE: librunshell/runshell.c
function runshell (line 73) | int runshell(const char *cmd)
function runshell_l_os_execute_lua51ver (line 130) | int runshell_l_os_execute_lua51ver(lua_State *L)
function runshell_l_os_execute (line 142) | int runshell_l_os_execute(lua_State *L)
FILE: libsafe/mut_safev.h
type MUT_SAFEV (line 27) | typedef struct {
function LIBSAFE_INHEADER (line 32) | LIBSAFE_INHEADER MUT_SAFEV MUT_SAFEV_new_empty(void)
function LIBSAFE_INHEADER (line 37) | LIBSAFE_INHEADER MUT_SAFEV MUT_SAFEV_new_UNSAFE(char *buf, size_t nbuf)
function LIBSAFE_INHEADER (line 51) | LIBSAFE_INHEADER void MUT_SAFEV_set_at(MUT_SAFEV Mv, size_t i, char c)
function LIBSAFE_INHEADER (line 57) | LIBSAFE_INHEADER SAFEV MUT_SAFEV_TO_SAFEV(MUT_SAFEV Mv)
FILE: libsafe/safe_common.c
function libsafe_assert_failed__ (line 24) | void libsafe_assert_failed__(
FILE: libsafe/safev.h
type SAFEV (line 28) | typedef struct {
function LIBSAFE_INHEADER (line 34) | LIBSAFE_INHEADER SAFEV SAFEV_new_empty(void)
function LIBSAFE_INHEADER (line 40) | LIBSAFE_INHEADER SAFEV SAFEV_new_UNSAFE(const char *ptr, size_t n)
function LIBSAFE_INHEADER (line 49) | LIBSAFE_INHEADER SAFEV SAFEV_new_from_cstr_UNSAFE(const char *cstr)
function LIBSAFE_INHEADER (line 71) | LIBSAFE_INHEADER char SAFEV_at(SAFEV v, size_t i)
function LIBSAFE_INHEADER (line 78) | LIBSAFE_INHEADER char SAFEV_at_or(SAFEV v, size_t i, char alt)
function LIBSAFE_INHEADER (line 89) | LIBSAFE_INHEADER size_t SAFEV_index_of(SAFEV v, unsigned char c)
function LIBSAFE_INHEADER (line 96) | LIBSAFE_INHEADER bool SAFEV_starts_with(SAFEV v, SAFEV prefix)
function LIBSAFE_INHEADER (line 108) | LIBSAFE_INHEADER bool SAFEV_equals(SAFEV v, SAFEV v1)
function LIBSAFE_INHEADER (line 121) | LIBSAFE_INHEADER SAFEV SAFEV_subspan(SAFEV v, size_t i, size_t j)
function LIBSAFE_INHEADER (line 132) | LIBSAFE_INHEADER SAFEV SAFEV_suffix(SAFEV v, size_t from_idx)
function LIBSAFE_INHEADER (line 142) | LIBSAFE_INHEADER const char *SAFEV_ptr_UNSAFE(SAFEV v)
function LIBSAFE_INHEADER (line 148) | LIBSAFE_INHEADER size_t SAFEV_len(SAFEV v)
function LIBSAFE_INHEADER (line 154) | LIBSAFE_INHEADER SAFEV SAFEV_rstrip_once(SAFEV v, char c)
function LIBSAFE_INHEADER (line 166) | LIBSAFE_INHEADER size_t SAFEV_trim_to_len(SAFEV v, size_t i)
function LIBSAFE_INHEADER (line 177) | LIBSAFE_INHEADER int SAFEV_bounded_len(SAFEV v, int bound)
FILE: libwidechar/libwidechar.c
function my_wcwidth (line 39) | static inline int my_wcwidth(wchar_t c) { return wcwidth(c); }
function my_wcwidth (line 44) | static inline int my_wcwidth(wchar_t c) { return c == L'\0' ? 0 : 1; }
function next (line 53) | static inline bool next(mbstate_t *state, xspan x, xspan *new_x, wchar_t...
function libwidechar_width (line 67) | int libwidechar_width(SAFEV v, uint64_t *out_width)
function libwidechar_truncate_to_width (line 87) | size_t libwidechar_truncate_to_width(
function libwidechar_make_valid_and_printable (line 119) | void libwidechar_make_valid_and_printable(
type LocaleSavedData (line 152) | typedef struct {
function LocaleSavedData (line 157) | static inline LocaleSavedData begin_locale(lua_State *L)
function end_locale (line 184) | static inline void end_locale(LocaleSavedData lsd, lua_State *L)
function SAFEV (line 192) | static inline SAFEV v_from_lua_string(lua_State *L, int pos)
function nonneg_double_to_u64 (line 199) | static inline uint64_t nonneg_double_to_u64(double d)
function nonneg_double_to_size_t (line 207) | static inline size_t nonneg_double_to_size_t(double d)
function extract_ij (line 222) | static size_t extract_ij(lua_State *L, int pos, size_t if_absent)
function SAFEV (line 231) | static SAFEV extract_string_with_ij(lua_State *L, int str_pos, int i_pos)
function lfunc_width (line 258) | static int lfunc_width(lua_State *L)
function lfunc_truncate_to_width (line 276) | static int lfunc_truncate_to_width(lua_State *L)
function append_to_lua_buf_callback (line 303) | static void append_to_lua_buf_callback(void *ud, SAFEV segment)
function lfunc_make_valid_and_printable (line 309) | static int lfunc_make_valid_and_printable(lua_State *L)
function lfunc_is_dummy_implementation (line 327) | static int lfunc_is_dummy_implementation(lua_State *L)
function libwidechar_register_lua_funcs (line 333) | void libwidechar_register_lua_funcs(lua_State *L)
FILE: libwidechar/libwidechar_xspan.h
type xspan (line 28) | typedef struct {
function LIBWIDECHAR_INHEADER (line 33) | LIBWIDECHAR_INHEADER xspan v_to_xspan(SAFEV v)
function LIBWIDECHAR_INHEADER (line 41) | LIBWIDECHAR_INHEADER bool xspan_nonempty(xspan x)
function LIBWIDECHAR_INHEADER (line 46) | LIBWIDECHAR_INHEADER void xspan_advance(xspan *x, size_t n)
function LIBWIDECHAR_INHEADER (line 51) | LIBWIDECHAR_INHEADER size_t xspan_processed_len(xspan x)
function LIBWIDECHAR_INHEADER (line 56) | LIBWIDECHAR_INHEADER SAFEV xspan_processed_v(xspan x)
function LIBWIDECHAR_INHEADER (line 61) | LIBWIDECHAR_INHEADER SAFEV xspan_unprocessed_v(xspan x)
function LIBWIDECHAR_INHEADER (line 66) | LIBWIDECHAR_INHEADER xspan xspan_skip_processed(xspan x)
FILE: plugins/alsa/alsa.c
type Priv (line 42) | typedef struct {
function destroy (line 51) | static void destroy(LuastatusPluginData *pd)
function init (line 61) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 119) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function card_has_nicename (line 127) | static bool card_has_nicename(
type GetVolFuncs (line 170) | typedef struct {
function GetVolFuncs (line 176) | static GetVolFuncs select_gv_funcs(bool capture, bool in_db)
function push_vol_info (line 195) | static void push_vol_info(lua_State *L, snd_mixer_elem_t *elem, GetVolFu...
type PollFdSet (line 222) | typedef struct {
function PollFdSet (line 228) | static inline PollFdSet pollfd_set_new(struct pollfd prefix)
function pollfd_set_resize (line 245) | static inline void pollfd_set_resize(PollFdSet *s, size_t n)
function pollfd_set_free (line 253) | static inline void pollfd_set_free(PollFdSet s)
function iteration (line 258) | static bool iteration(LuastatusPluginData *pd, LuastatusPluginRunFuncs f...
function run (line 381) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/dbus/bustype2idx.h
function LS_INHEADER (line 27) | LS_INHEADER size_t bustype2idx(GBusType bus_type)
FILE: plugins/dbus/cvt.c
function l_special_object (line 35) | static int l_special_object(lua_State *L)
function push_special_object (line 47) | static void push_special_object(lua_State *L, const char *s, size_t ns, ...
function on_recur_lim (line 65) | static void on_recur_lim(lua_State *L)
function push_gvariant_strlike (line 70) | static inline void push_gvariant_strlike(lua_State *L, GVariant *var)
function push_gvariant_iterable (line 77) | static void push_gvariant_iterable(lua_State *L, GVariant *var, unsigned...
function push_gvariant (line 113) | static void push_gvariant(lua_State *L, GVariant *var, unsigned recurlim)
function cvt (line 191) | void cvt(lua_State *L, GVariant *var)
FILE: plugins/dbus/dbus.c
type Signal (line 43) | typedef struct {
function signal_free (line 52) | static void signal_free(Signal s)
type SignalList (line 61) | typedef struct {
function SignalList (line 67) | static inline SignalList signal_list_new(void)
function signal_list_add (line 72) | static inline void signal_list_add(SignalList *x, Signal s)
function signal_list_destroy (line 80) | static inline void signal_list_destroy(SignalList *x)
type Priv (line 88) | typedef struct {
function destroy (line 96) | static void destroy(LuastatusPluginData *pd)
function SignalList (line 108) | static inline SignalList *get_sub(Priv *p, GBusType bus_type)
function parse_bus_str (line 114) | static int parse_bus_str(MoonVisit *mv, void *ud, const char *s, size_t ns)
function parse_flags_elem (line 130) | static int parse_flags_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function parse_signals_elem (line 154) | static int parse_signals_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function init (line 195) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 233) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
type PluginRunArgs (line 242) | typedef struct {
function set_str (line 250) | static inline void set_str(lua_State *L, const char *s, const char *key)
function callback_signal (line 258) | static void callback_signal(
function report_simple (line 297) | static void report_simple(
function gboolean (line 311) | static gboolean callback_timeout(gpointer user_data)
function gboolean (line 322) | static gboolean callback_idle(gpointer user_data)
function GDBusConnection (line 333) | static GDBusConnection *maybe_connect_and_subscribe(
function run (line 368) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/dbus/load_lualib.c
function report_and_pop_error (line 27) | static void report_and_pop_error(LuastatusPluginData *pd, lua_State *L, ...
function load_lualib (line 38) | bool load_lualib(LuastatusPluginData *pd, lua_State *L)
FILE: plugins/dbus/zoo/zoo.c
function failure (line 41) | static void failure(lua_State *L, GError *err)
function success (line 47) | static void success(lua_State *L, GVariant *res)
type Zoo (line 65) | struct Zoo {
function do_the_bloody_thing (line 69) | static int do_the_bloody_thing(
function l_call_method (line 125) | static int l_call_method(lua_State *L)
function l_call_method_str (line 155) | static int l_call_method_str(lua_State *L)
function l_get_property (line 189) | static int l_get_property(lua_State *L)
function l_get_all_properties (line 221) | static int l_get_all_properties(lua_State *L)
function l_set_property_str (line 251) | static int l_set_property_str(lua_State *L)
function l_set_property (line 285) | static int l_set_property(lua_State *L)
function Zoo (line 319) | Zoo *zoo_new(void)
function zoo_register_funcs (line 326) | void zoo_register_funcs(Zoo *z, lua_State *L)
function zoo_destroy (line 349) | void zoo_destroy(Zoo *z)
FILE: plugins/dbus/zoo/zoo.h
type Zoo (line 24) | struct Zoo
type Zoo (line 25) | typedef struct Zoo Zoo;
FILE: plugins/dbus/zoo/zoo_call_params.c
function check_type (line 34) | static void check_type(lua_State *L, int pos, const char *key, int expec...
function do_str (line 48) | static void do_str(lua_State *L, const char *key, char **dst, bool nulla...
function do_gvalue (line 70) | static void do_gvalue(lua_State *L, const char *key, GVariant **dst, boo...
function maybe_do_bool (line 87) | static void maybe_do_bool(lua_State *L, const char *key, bool *dst)
function maybe_do_timeout (line 102) | static void maybe_do_timeout(lua_State *L, const char *key, int *dst)
function do_bus_type (line 126) | static void do_bus_type(lua_State *L, const char *key, GBusType *dst)
function do_parse_throwable (line 146) | static int do_parse_throwable(lua_State *L)
function zoo_call_params_free (line 172) | void zoo_call_params_free(Zoo_CallParams *p)
function zoo_call_params_parse (line 182) | void zoo_call_params_parse(lua_State *L, Zoo_CallParams *p, int arg)
FILE: plugins/dbus/zoo/zoo_call_params.h
type Zoo_StrField (line 27) | typedef struct {
type Zoo_CallParams (line 33) | typedef struct {
FILE: plugins/dbus/zoo/zoo_call_prot.c
function zoo_call_prot (line 24) | bool zoo_call_prot(lua_State *L, int nargs, int nresults, lua_CFunction ...
FILE: plugins/dbus/zoo/zoo_mt.c
function zoo_mt_begin (line 25) | void zoo_mt_begin(lua_State *L, const char *mt_name)
function zoo_mt_add_method (line 34) | void zoo_mt_add_method(lua_State *L, const char *name, lua_CFunction f)
function zoo_mt_end (line 40) | void zoo_mt_end(lua_State *L)
FILE: plugins/dbus/zoo/zoo_uncvt_type.c
type Tobj (line 34) | typedef struct {
function Tobj (line 42) | static Tobj *fetch_tobj(lua_State *L, int pos, const char *what)
function GVariantType (line 48) | static const GVariantType *fetch_gtype_borrow(lua_State *L, int pos, con...
function make_tobj_steal (line 59) | static void make_tobj_steal(lua_State *L, GVariantType *t)
function make_tobj_copy (line 72) | static void make_tobj_copy(lua_State *L, const GVariantType *t)
function tobj_gc (line 78) | static int tobj_gc(lua_State *L)
function l_equals_to (line 88) | static int l_equals_to(lua_State *L)
function l_get_type_string (line 98) | static int l_get_type_string(lua_State *L)
function l_get_category (line 110) | static int l_get_category(lua_State *L)
function l_is_basic (line 129) | static int l_is_basic(lua_State *L)
function l_get_item_types (line 138) | static int l_get_item_types(lua_State *L)
function l_get_elem_type (line 168) | static int l_get_elem_type(lua_State *L)
function l_get_kv_types (line 181) | static int l_get_kv_types(lua_State *L)
function l_mktype_simple (line 196) | static int l_mktype_simple(lua_State *L)
function l_mktype_array (line 229) | static int l_mktype_array(lua_State *L)
function l_mktype_dict_entry (line 238) | static int l_mktype_dict_entry(lua_State *L)
type MkTupleUD (line 252) | typedef struct {
function throwable_l_mktype_tuple (line 257) | static int throwable_l_mktype_tuple(lua_State *L)
function l_mktype_tuple (line 282) | static int l_mktype_tuple(lua_State *L)
function GVariantType (line 299) | const GVariantType *zoo_uncvt_type_fetch_borrow(lua_State *L, int pos, c...
function zoo_uncvt_type_bake_steal (line 304) | void zoo_uncvt_type_bake_steal(GVariantType *t, lua_State *L)
function register_mt (line 309) | static void register_mt(lua_State *L)
function zoo_uncvt_type_register_mt_and_funcs (line 328) | void zoo_uncvt_type_register_mt_and_funcs(lua_State *L)
FILE: plugins/dbus/zoo/zoo_uncvt_val.c
type Vobj (line 41) | typedef struct {
function Vobj (line 50) | static Vobj *fetch_vobj(lua_State *L, int pos, const char *what)
function GVariant (line 55) | static GVariant *fetch_gvar_borrow(lua_State *L, int pos, const char *what)
function make_vobj_steal (line 65) | static void make_vobj_steal(lua_State *L, GVariant *v)
function make_vobj_from_floating (line 78) | static void make_vobj_from_floating(lua_State *L, GVariant *v)
function vobj_gc (line 86) | static int vobj_gc(lua_State *L)
function fetch_bool (line 96) | static bool fetch_bool(lua_State *L, int arg)
function fetch_byte (line 102) | static uint8_t fetch_byte(lua_State *L, int arg)
function fetch_int (line 121) | static uint64_t fetch_int(lua_State *L, int arg, bool is_signed)
function GVariant (line 163) | static GVariant *mkval_simple_impl(lua_State *L)
function l_mkval_simple (line 223) | static int l_mkval_simple(lua_State *L)
function l_mkval_dict_entry (line 229) | static int l_mkval_dict_entry(lua_State *L)
type MkSomethingUD (line 243) | typedef struct {
function free_ud (line 248) | static void free_ud(MkSomethingUD ud)
function throwable_l_mkval_tuple (line 256) | static int throwable_l_mkval_tuple(lua_State *L)
function l_mkval_tuple (line 281) | static int l_mkval_tuple(lua_State *L)
function throwable_l_mkval_array (line 295) | static int throwable_l_mkval_array(lua_State *L)
function l_mkval_array (line 334) | static int l_mkval_array(lua_State *L)
function l_get_type (line 348) | static int l_get_type(lua_State *L)
function l_equals_to (line 359) | static int l_equals_to(lua_State *L)
function l_to_lua (line 370) | static int l_to_lua(lua_State *L)
function GVariant (line 379) | GVariant *zoo_uncvt_val_fetch_newref(lua_State *L, int pos, const char *...
function register_mt (line 385) | static void register_mt(lua_State *L)
function zoo_uncvt_val_register_mt_and_funcs (line 398) | void zoo_uncvt_val_register_mt_and_funcs(lua_State *L)
FILE: plugins/fs/fs.c
type Priv (line 43) | typedef struct {
function destroy (line 55) | static void destroy(LuastatusPluginData *pd)
function parse_paths_elem (line 70) | static int parse_paths_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function parse_globs_elem (line 85) | static int parse_globs_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function init (line 100) | static int init(LuastatusPluginData *pd, lua_State *L)
function push_for (line 158) | static bool push_for(LuastatusPluginData *pd, lua_State *L, const char *...
type Call (line 175) | typedef struct {
function Call (line 181) | static inline Call start_call(LuastatusPluginData *pd, LuastatusPluginRu...
function add_path_to_call (line 193) | static inline void add_path_to_call(Call c, const char *path)
function end_call (line 202) | static inline void end_call(Call c)
function run (line 207) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
function lfunc_add_dyn_path (line 263) | static int lfunc_add_dyn_path(lua_State *L)
function lfunc_remove_dyn_path (line 278) | static int lfunc_remove_dyn_path(lua_State *L)
function lfunc_get_max_dyn_paths (line 294) | static int lfunc_get_max_dyn_paths(lua_State *L)
function register_funcs (line 300) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
FILE: plugins/fs/strlist.c
function Strlist (line 26) | Strlist strlist_new(void)
function resize_to (line 31) | static void resize_to(Strlist *x, size_t new_size)
function find (line 39) | static size_t find(Strlist *x, const char *s)
function strlist_push (line 51) | bool strlist_push(Strlist *x, const char *s)
function remove_at (line 67) | static void remove_at(Strlist *x, size_t i)
function strlist_remove (line 82) | bool strlist_remove(Strlist *x, const char *s)
function strlist_destroy (line 95) | void strlist_destroy(Strlist x)
FILE: plugins/fs/strlist.h
type Strlist (line 26) | typedef struct {
FILE: plugins/inotify/inotify.c
type Watch (line 47) | typedef struct {
type WatchList (line 52) | typedef struct {
function WatchList (line 58) | static inline WatchList watch_list_new(void)
function watch_list_add (line 63) | static inline void watch_list_add(WatchList *x, const char *path, int wd)
function watch_list_free (line 71) | static inline void watch_list_free(WatchList *x)
type Priv (line 78) | typedef struct {
function destroy (line 86) | static void destroy(LuastatusPluginData *pd)
type EventType (line 95) | typedef struct {
function parse_evlist_elem (line 143) | static int parse_evlist_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function parse_watch_entry (line 166) | static int parse_watch_entry(MoonVisit *mv, void *ud, int kpos, int vpos)
function init (line 195) | static int init(LuastatusPluginData *pd, lua_State *L)
function l_add_watch (line 235) | static int l_add_watch(lua_State *L)
function l_remove_watch (line 271) | static int l_remove_watch(lua_State *L)
function l_get_initial_wds (line 287) | static int l_get_initial_wds(lua_State *L)
function l_get_supported_events (line 300) | static int l_get_supported_events(lua_State *L)
function register_funcs (line 311) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function push_event (line 340) | static void push_event(lua_State *L, const struct inotify_event *event)
function run (line 369) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/inotify/inotify_compat.h
function LS_INHEADER (line 32) | LS_INHEADER int compat_inotify_init(bool nonblock, bool cloexec)
FILE: plugins/mpd/connect.c
function unixdom_open (line 40) | int unixdom_open(LuastatusPluginData *pd, const char *path)
function do_bind_to_addr (line 68) | static int do_bind_to_addr(int fd, const char *addr_str, BindAddrFamily ...
function bind_addr_family2af (line 106) | static int bind_addr_family2af(BindAddrFamily family)
function inetdom_open (line 119) | int inetdom_open(
FILE: plugins/mpd/connect.h
type BindAddrFamily (line 25) | typedef enum {
FILE: plugins/mpd/fuzz/harness.c
function do_the_thing (line 35) | static void do_the_thing(SAFEV v)
function do_the_thing (line 43) | static void do_the_thing(SAFEV v)
function do_the_thing (line 51) | static void do_the_thing(SAFEV v)
function do_the_thing (line 76) | static void do_the_thing(SAFEV v)
function main (line 96) | int main(int argc, char **argv)
FILE: plugins/mpd/line_reader.c
function LineReader (line 28) | LineReader line_reader_new(size_t prealloc)
function line_reader_read_line (line 36) | int line_reader_read_line(LineReader *LR, FILE *f, SAFEV *out)
function line_reader_destroy (line 47) | void line_reader_destroy(LineReader *LR)
FILE: plugins/mpd/line_reader.h
type LineReader (line 27) | typedef struct {
FILE: plugins/mpd/mpd.c
type Priv (line 50) | typedef struct {
function destroy (line 64) | static void destroy(LuastatusPluginData *pd)
function parse_events_elem (line 75) | static int parse_events_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function parse_ipver (line 91) | static int parse_ipver(const char *s)
function parse_bind_params (line 102) | static int parse_bind_params(Priv *p, MoonVisit *mv, int table_pos)
function init (line 141) | static int init(LuastatusPluginData *pd, lua_State *L)
function kv_strarr_table_push (line 220) | static void kv_strarr_table_push(LS_StringArray sa, lua_State *L)
function report_status (line 236) | static void report_status(
type Context (line 248) | typedef struct {
function read_line (line 254) | static inline int read_line(Context *ctx)
function log_io_error (line 259) | static void log_io_error(LuastatusPluginData *pd, Context *ctx)
function log_bad_response (line 268) | static void log_bad_response(
function loop_until_ok (line 279) | static int loop_until_ok(
function interact (line 303) | static void interact(
function do_enable_tcp_keepalive (line 442) | static void do_enable_tcp_keepalive(LuastatusPluginData *pd, int fd)
function do_enable_tcp_nodelay (line 450) | static void do_enable_tcp_nodelay(LuastatusPluginData *pd, int fd)
function run (line 458) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/mpd/safe_haven.c
function is_good_greeting (line 28) | bool is_good_greeting(SAFEV v)
function ResponseType (line 33) | ResponseType response_type(SAFEV v)
function do_fwrite_str_view (line 44) | static inline void do_fwrite_str_view(FILE *f, SAFEV v)
function write_quoted (line 52) | void write_quoted(FILE *f, SAFEV v)
function append_sv_to_strarr (line 72) | static inline void append_sv_to_strarr(LS_StringArray *sa, SAFEV v)
function append_line_to_kv_strarr (line 77) | void append_line_to_kv_strarr(LS_StringArray *sa, SAFEV line)
FILE: plugins/mpd/safe_haven.h
type ResponseType (line 28) | typedef enum {
FILE: plugins/multiplex/conq.c
type Conq (line 29) | struct Conq {
function Conq (line 41) | Conq *conq_create(size_t nslots)
function conq_update_slot (line 62) | void conq_update_slot(
function CONQ_MASK (line 87) | CONQ_MASK conq_fetch_updates(
function conq_destroy (line 114) | void conq_destroy(Conq *q)
FILE: plugins/multiplex/conq.h
type CONQ_MASK (line 33) | typedef uint64_t CONQ_MASK;
type ConqSlotState (line 38) | typedef enum {
type Conq (line 48) | struct Conq
type Conq (line 49) | typedef struct Conq Conq;
FILE: plugins/multiplex/external_context.h
type LuastatusPluginData_v1 (line 24) | typedef LuastatusPluginData_v1 *ExternalContext;
FILE: plugins/multiplex/map_ref.c
type Control (line 27) | typedef struct {
function MapRef (line 32) | MapRef map_ref_new_empty(void)
function Control (line 37) | static inline Control *load(MapRef ref)
function store (line 43) | static inline void store(MapRef ref, Control *C)
function map_ref_init (line 49) | void map_ref_init(MapRef *ref, ExternalContext ectx)
function map_ref_lock_mtx (line 64) | void map_ref_lock_mtx(MapRef ref)
function map_ref_unlock_mtx (line 70) | void map_ref_unlock_mtx(MapRef ref)
function map_ref_destroy (line 76) | void map_ref_destroy(MapRef ref)
FILE: plugins/multiplex/map_ref.h
type MapRef (line 24) | typedef struct {
FILE: plugins/multiplex/multiplex.c
function destroy (line 46) | static void destroy(LuastatusPluginData *pd)
function visit_wspec (line 59) | static int visit_wspec(MoonVisit *mv, void *ud, int kpos, int vpos)
function check_wspecs (line 78) | static bool check_wspecs(WspecList *x, char *errbuf, size_t nerrbuf)
function init (line 103) | static int init(LuastatusPluginData *pd, lua_State *L)
function l_call_event (line 153) | static int l_call_event(lua_State *L)
function register_funcs (line 200) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function recv_handle_new_data (line 224) | static void recv_handle_new_data(
function recv_callback (line 250) | static void recv_callback(void *vud, RunnerCallbackReason reason, lua_St...
function make_call_simple (line 274) | static void make_call_simple(
function push_update (line 288) | static void push_update(lua_State *L, const LS_String *buf, ConqSlotStat...
function make_call_update (line 309) | static void make_call_update(
function run (line 340) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/multiplex/priv.h
type Priv (line 29) | typedef struct {
FILE: plugins/multiplex/runner.c
type Plugin (line 62) | typedef struct {
type Widget (line 74) | typedef struct {
type Runner (line 98) | struct Runner {
function safe_vsnprintf (line 112) | static inline void safe_vsnprintf(char *buf, size_t nbuf, const char *fm...
function my_sayf (line 119) | static void my_sayf(Runner *runner, int level, const char *fmt, ...)
function external_sayf (line 134) | static void external_sayf(void *userdata, int level, const char *fmt, ...)
function plugin_load (line 164) | static bool plugin_load(Runner *runner, Plugin *p, const char *filename,...
function plugin_load_by_name (line 203) | static bool plugin_load_by_name(Runner *runner, Plugin *p, const char *n...
function plugin_unload (line 215) | static void plugin_unload(Plugin *p)
function lua_State (line 221) | static lua_State *xnew_lua_state(void)
function check_lua_call (line 241) | static bool check_lua_call(Runner *runner, lua_State *L, int ret)
function l_error_handler (line 276) | static int l_error_handler(lua_State *L)
function do_lua_call (line 291) | static inline bool do_lua_call(Runner *runner, lua_State *L, int nargs, ...
function l_os_exit (line 297) | static int l_os_exit(lua_State *L)
function l_os_getenv (line 307) | static int l_os_getenv(lua_State *L)
function l_os_setlocale (line 319) | static int l_os_setlocale(lua_State *L)
function l_require_plugin (line 327) | static int l_require_plugin(lua_State *L)
function inject_libs_replacements (line 354) | static void inject_libs_replacements(lua_State *L)
function inject_luastatus_module (line 377) | static void inject_luastatus_module(lua_State *L)
function inject_libs (line 401) | static void inject_libs(lua_State *L)
function widget_init_inspect_plugin (line 409) | static bool widget_init_inspect_plugin(Runner *runner)
function widget_init_inspect_cb (line 429) | static bool widget_init_inspect_cb(Runner *runner)
function widget_init_inspect_event (line 445) | static bool widget_init_inspect_event(Runner *runner)
function widget_init_inspect_push_opts (line 466) | static bool widget_init_inspect_push_opts(Runner *runner)
function widget_init (line 484) | static bool widget_init(Runner *runner, const char *name, const char *code)
function widget_destroy (line 560) | static void widget_destroy(Widget *w)
function register_funcs (line 569) | static void register_funcs(Runner *runner)
function lua_State (line 600) | static lua_State *plugin_call_begin(void *userdata)
function plugin_call_end (line 614) | static void plugin_call_end(void *userdata)
function plugin_call_cancel (line 635) | static void plugin_call_cancel(void *userdata)
function lua_State (line 645) | lua_State *runner_event_begin(Runner *runner)
function RunnerEventResult (line 658) | RunnerEventResult runner_event_end(Runner *runner)
function runner_run (line 680) | void runner_run(Runner *runner)
function Runner (line 696) | Runner *runner_new(
function runner_destroy (line 717) | void runner_destroy(Runner *runner)
FILE: plugins/multiplex/runner.h
type RunnerCallbackReason (line 25) | typedef enum {
type RunnerEventResult (line 36) | typedef enum {
type Runner (line 42) | struct Runner
type Runner (line 43) | typedef struct Runner Runner;
FILE: plugins/multiplex/runtime_data.c
function runtime_data_init (line 27) | void runtime_data_init(RuntimeData *x, ExternalContext ectx, size_t n)
FILE: plugins/multiplex/runtime_data.h
type UniversalUserdata (line 28) | typedef struct {
type RuntimeData (line 33) | typedef struct {
FILE: plugins/multiplex/wspec_list.c
function WspecList (line 26) | WspecList wspec_list_new(void)
function wspec_list_add (line 31) | void wspec_list_add(WspecList *x, const char *name, const char *code)
function wspec_list_find (line 61) | int wspec_list_find(WspecList *x, const char *name)
function wspec_list_get_rid_of_code (line 74) | void wspec_list_get_rid_of_code(WspecList *x, size_t idx)
function wspec_list_destroy (line 83) | void wspec_list_destroy(WspecList *x)
FILE: plugins/multiplex/wspec_list.h
type Wspec (line 26) | typedef struct {
type WspecList (line 31) | typedef struct {
function LS_INHEADER (line 39) | LS_INHEADER int wspec_list_size(WspecList *x)
function LS_INHEADER (line 44) | LS_INHEADER const char *wspec_list_get_name(WspecList *x, size_t idx)
function LS_INHEADER (line 50) | LS_INHEADER const char *wspec_list_get_code(WspecList *x, size_t idx)
FILE: plugins/network-linux/ethernet_info.c
function get_ethernet_speed (line 34) | uint32_t get_ethernet_speed(int sockfd, const char *iface)
FILE: plugins/network-linux/iface_type.c
function is_wlan_iface (line 29) | bool is_wlan_iface(const char *iface)
FILE: plugins/network-linux/network.c
type Priv (line 54) | typedef struct {
function destroy (line 66) | static void destroy(LuastatusPluginData *pd)
function init (line 76) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 147) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function report_error (line 155) | static void report_error(LuastatusPluginData *pd, LuastatusPluginRunFunc...
function inject_ip_info (line 173) | static void inject_ip_info(lua_State *L, struct ifaddrs *addr, bool new_...
function inject_wireless_info (line 219) | static void inject_wireless_info(lua_State *L, struct ifaddrs *addr)
function inject_ethernet_info (line 247) | static void inject_ethernet_info(lua_State *L, struct ifaddrs *addr, int...
function begin_call (line 265) | static void begin_call(Priv *p, lua_State *L)
function end_call (line 273) | static void end_call(Priv *p, lua_State *L, const char *what)
function make_call (line 290) | static void make_call(
function my_recvmsg (line 364) | static ssize_t my_recvmsg(int fd_netlink, struct msghdr *msg, LS_TimeDel...
function interpret_nl_msg (line 395) | static bool interpret_nl_msg(LuastatusPluginData *pd, char *msg_buf, siz...
function interact (line 426) | static bool interact(LuastatusPluginData *pd, LuastatusPluginRunFuncs fu...
function run (line 504) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/network-linux/string_set.c
function StringSet (line 29) | StringSet string_set_new(void)
function string_set_reset (line 34) | void string_set_reset(StringSet *s)
function string_set_add (line 42) | void string_set_add(StringSet *s, const char *val)
function elem_cmp (line 52) | static int elem_cmp(const void *a, const void *b)
function string_set_freeze (line 58) | void string_set_freeze(StringSet *s)
function string_set_contains (line 65) | bool string_set_contains(StringSet s, const char *val)
function string_set_destroy (line 75) | void string_set_destroy(StringSet s)
FILE: plugins/network-linux/string_set.h
type StringSet (line 26) | typedef struct {
FILE: plugins/network-linux/wireless_info.c
function find_ssid (line 41) | static void find_ssid(uint8_t *ies, uint32_t ies_len, uint8_t **ssid, ui...
function gwi_sta_cb (line 70) | static int gwi_sta_cb(struct nl_msg *msg, void *vud)
function gwi_scan_cb (line 137) | static int gwi_scan_cb(struct nl_msg *msg, void *vud)
function get_wireless_info (line 214) | bool get_wireless_info(const char *iface, WirelessInfo *info)
FILE: plugins/network-linux/wireless_info.h
type WirelessInfo (line 36) | typedef struct {
FILE: plugins/pipev2/launch.c
function unmake_cloexec (line 32) | static inline void unmake_cloexec(int fd)
type Pipe (line 44) | typedef struct {
function pipe_is_empty (line 51) | static inline bool pipe_is_empty(Pipe *p)
function pipe_make (line 56) | static inline int pipe_make(Pipe *p, int their_end)
function pipe_finalize (line 66) | static inline int pipe_finalize(Pipe *p)
function pipe_destroy (line 81) | static inline void pipe_destroy(Pipe *p)
function add_redir (line 90) | static inline void add_redir(posix_spawn_file_actions_t *fa, Pipe *p)
function launch (line 108) | int launch(const LaunchArg *argv, bool redir_stdin, LaunchResult *res, L...
FILE: plugins/pipev2/launch.h
type LaunchResult (line 27) | typedef struct {
type LaunchError (line 33) | typedef struct {
FILE: plugins/pipev2/pipev2.c
type ArgsList (line 50) | typedef struct {
type Priv (line 56) | typedef struct {
function args_list_add (line 75) | static void args_list_add(ArgsList *x, const char *s)
function args_list_destroy (line 85) | static void args_list_destroy(ArgsList *x)
function destroy (line 93) | static void destroy(LuastatusPluginData *pd)
function visit_argv_elem (line 106) | static int visit_argv_elem(MoonVisit *mv, void *ud, int kpos, int vpos)
function visit_delimiter (line 120) | static int visit_delimiter(MoonVisit *mv, void *ud, const char *s, size_...
function init (line 133) | static int init(LuastatusPluginData *pd, lua_State *L)
function l_write_to_stdin (line 188) | static int l_write_to_stdin(lua_State *L)
function fetch_sig_num (line 218) | static int fetch_sig_num(lua_State *L)
function l_kill (line 246) | static int l_kill(lua_State *L)
function l_get_sigrt_bounds (line 292) | static int l_get_sigrt_bounds(lua_State *L)
function register_funcs (line 299) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function report_reason_of_death (line 317) | static void report_reason_of_death(
function do_cleanup_leftover (line 338) | static void do_cleanup_leftover(LuastatusPluginData *pd, LaunchResult le...
function do_spawn (line 354) | static bool do_spawn(LuastatusPluginData *pd, FILE **out_f)
function do_wait (line 384) | static void do_wait(LuastatusPluginData *pd)
function make_call_simple (line 401) | static void make_call_simple(
function make_call_line (line 415) | static void make_call_line(
function run (line 434) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/pipev2/sigdb.c
type SigSpec (line 26) | typedef struct {
function sigdb_lookup_num_by_name (line 56) | int sigdb_lookup_num_by_name(const char *sig_name)
FILE: plugins/pipev2/utils.c
function utils_full_write (line 28) | int utils_full_write(int fd, const char *data, size_t ndata)
function utils_waitpid (line 44) | int utils_waitpid(pid_t pid, int *out_status)
FILE: plugins/pulse/pulse.c
type Priv (line 52) | typedef struct {
function destroy (line 57) | static void destroy(LuastatusPluginData *pd)
function init (line 66) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 102) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
type UserData (line 110) | typedef struct {
function self_pipe_cb (line 117) | static void self_pipe_cb(
function push_port_type (line 139) | static void push_port_type(lua_State *L, int type)
function push_str_or_nil (line 170) | static inline void push_str_or_nil(lua_State *L, const char *s)
function store_volume_from_sink_cb (line 179) | static void store_volume_from_sink_cb(
function store_sink_cb (line 231) | static void store_sink_cb(
function update_sink (line 247) | static void update_sink(pa_context *c, void *vud)
function subscribe_cb (line 260) | static void subscribe_cb(
function context_state_cb (line 295) | static void context_state_cb(pa_context *c, void *vud)
function iteration (line 329) | static bool iteration(LuastatusPluginData *pd, LuastatusPluginRunFuncs f...
function run (line 393) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/timer/timer.c
type Priv (line 41) | typedef struct {
function destroy (line 48) | static void destroy(LuastatusPluginData *pd)
function init (line 62) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 110) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function make_call (line 123) | static inline void make_call(
function run (line 133) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/udev/udev.c
type Priv (line 37) | typedef struct {
function destroy (line 47) | static void destroy(LuastatusPluginData *pd)
function init (line 57) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 106) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function report_status (line 114) | static inline void report_status(
function report_event (line 126) | static void report_event(
function run (line 166) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/unixsock/cloexec_accept.c
function cloexec_accept (line 30) | int cloexec_accept(int sockfd)
FILE: plugins/unixsock/server.c
type Client (line 40) | typedef struct {
type Server (line 45) | struct Server {
function Server (line 54) | Server *server_new(
function is_full (line 74) | static inline bool is_full(Server *S)
function server_poll (line 81) | int server_poll(
function is_dropped (line 106) | static inline bool is_dropped(Client *c)
function drop_client (line 111) | static void drop_client(Client *c)
function find_newline (line 121) | static inline bool find_newline(Client *c, size_t num_last_read)
function server_read_from_client (line 130) | int server_read_from_client(
function server_drop_client (line 186) | void server_drop_client(
function set_nclients (line 196) | static void set_nclients(Server *S, size_t new_n)
function update_pfds (line 206) | static void update_pfds(Server *S)
function add_client (line 219) | static void add_client(Server *S, int fd)
function server_accept_new_client (line 229) | int server_accept_new_client(Server *S)
function server_compact (line 247) | void server_compact(Server *S)
function server_destroy (line 261) | void server_destroy(Server *S)
FILE: plugins/unixsock/server.h
type Server (line 33) | struct Server
type Server (line 34) | typedef struct Server Server;
type pollfd (line 43) | struct pollfd
FILE: plugins/unixsock/unixsock.c
type Priv (line 45) | typedef struct {
function destroy (line 55) | static void destroy(LuastatusPluginData *pd)
function init (line 63) | static int init(LuastatusPluginData *pd, lua_State *L)
function register_funcs (line 122) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
function LS_TimeStamp (line 130) | static inline LS_TimeStamp new_deadline(Priv *p)
function LS_TimeDelta (line 139) | static inline LS_TimeDelta get_time_until_TS(LS_TimeStamp TS)
function report_status (line 147) | static void report_status(
function report_line (line 159) | static void report_line(
function mk_server (line 174) | static int mk_server(LuastatusPluginData *pd)
function run (line 215) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/web/compat_lua_resume.c
function do_resume (line 24) | static int do_resume(lua_State *L, lua_State *from, int nargs)
function do_resume (line 31) | static int do_resume(lua_State *L, lua_State *from, int nargs)
function do_resume (line 37) | static int do_resume(lua_State *L, lua_State *from, int nargs)
function compat_lua_resume (line 45) | int compat_lua_resume(lua_State *L, lua_State *from, int nargs, int *nre...
FILE: plugins/web/fuzz_esc_json/harness.c
function append_to_ls_string (line 31) | static void append_to_ls_string(void *ud, SAFEV v)
function main (line 37) | int main(int argc, char **argv)
FILE: plugins/web/fuzz_urldecode/harness.c
function main (line 33) | int main(int argc, char **argv)
FILE: plugins/web/fuzz_urlencode/harness.c
function main (line 33) | int main(int argc, char **argv)
FILE: plugins/web/make_request.c
function callback_resp (line 36) | static size_t callback_resp(char *buf, size_t char_sz, size_t nbuf, void...
function callback_header (line 46) | static size_t callback_header(char *buf, size_t char_sz, size_t nbuf, vo...
function callback_debug (line 74) | static int callback_debug(CURL *C, curl_infotype type, char *buf, size_t...
function make_request (line 89) | bool make_request(
FILE: plugins/web/make_request.h
type Response (line 33) | typedef struct {
FILE: plugins/web/mod_json/json_decode.c
type Params (line 40) | typedef struct {
function mt_new (line 48) | static int mt_new(lua_State *L, const char *field)
function mt_set (line 57) | static void mt_set(lua_State *L, int lref)
function mt_unref (line 67) | static void mt_unref(lua_State *L, int lref)
function convert_array (line 78) | static bool convert_array(lua_State *L, cJSON *j, Params *params)
function convert_dict (line 97) | static bool convert_dict(lua_State *L, cJSON *j, Params *params)
function convert (line 115) | static bool convert(lua_State *L, cJSON *j, Params *params)
function json_decode (line 161) | bool json_decode(lua_State *L, const char *input, int max_depth, int fla...
FILE: plugins/web/mod_json/json_encode_str.c
function json_encode_str (line 27) | void json_encode_str(
FILE: plugins/web/mod_json/mod_json.c
function getbool (line 30) | static inline bool getbool(lua_State *L, int arg)
function l_json_decode (line 39) | static int l_json_decode(lua_State *L)
function append_to_lua_buf_callback (line 69) | static void append_to_lua_buf_callback(void *ud, SAFEV v)
function l_json_encode_str (line 75) | static int l_json_encode_str(lua_State *L)
function l_json_encode_num (line 88) | static int l_json_encode_num(lua_State *L)
function mod_json_register_funcs (line 101) | void mod_json_register_funcs(lua_State *L)
FILE: plugins/web/mod_urlencode/mod_urlencode.c
function getbool (line 31) | static inline bool getbool(lua_State *L, int arg)
function l_urlencode (line 40) | static int l_urlencode(lua_State *L)
function l_urldecode (line 64) | static int l_urldecode(lua_State *L)
function mod_urlencode_register_funcs (line 87) | void mod_urlencode_register_funcs(lua_State *L)
FILE: plugins/web/mod_urlencode/urldecode.c
function urldecode_size (line 25) | size_t urldecode_size(SAFEV src)
function parse_hex_digit (line 43) | static int parse_hex_digit(char c)
function urldecode (line 57) | bool urldecode(SAFEV src, MUT_SAFEV dst)
FILE: plugins/web/mod_urlencode/urlencode.c
function should_be_escaped (line 25) | static inline bool should_be_escaped(char c)
function urlencode_size (line 50) | size_t urlencode_size(SAFEV src, bool plus_notation)
function urlencode (line 73) | void urlencode(SAFEV src, MUT_SAFEV dst, bool plus_notation)
FILE: plugins/web/next_request_params.h
type NextRequestParams (line 24) | typedef struct {
FILE: plugins/web/opts.c
function apply_str (line 32) | static bool apply_str(NextRequestParams *dst, lua_State *L, CURLoption w...
function apply_bool (line 50) | static bool apply_bool(NextRequestParams *dst, lua_State *L, CURLoption ...
function fetch_int (line 68) | static bool fetch_int(
function apply_long_nonneg (line 97) | static bool apply_long_nonneg(NextRequestParams *dst, lua_State *L, CURL...
function apply_long_nonneg_or_minus1 (line 116) | static bool apply_long_nonneg_or_minus1(NextRequestParams *dst, lua_Stat...
function apply_headers (line 131) | static bool apply_headers(NextRequestParams *dst, lua_State *L, CURLopti...
function apply_timeout (line 174) | static bool apply_timeout(NextRequestParams *dst, lua_State *L, CURLopti...
FILE: plugins/web/opts.h
type Opt (line 28) | typedef struct {
FILE: plugins/web/parse_opts.c
function find_opt (line 30) | static int find_opt(const char *spelling)
function check_if_our_flag (line 40) | static bool check_if_our_flag(NextRequestParams *dst, const char *s)
function handle_option (line 53) | static bool handle_option(NextRequestParams *dst, lua_State *L, char **o...
function parse_opts (line 85) | bool parse_opts(NextRequestParams *dst, lua_State *L, char **out_errmsg)
FILE: plugins/web/set_error.c
function set_type_error (line 28) | void set_type_error(char **out_errmsg, lua_State *L, int pos, int expect...
function set_curl_error (line 39) | void set_curl_error(char **out_errmsg, CURLcode rc)
FILE: plugins/web/web.c
type Priv (line 52) | typedef struct {
function destroy (line 61) | static void destroy(LuastatusPluginData *pd)
function lua_State (line 71) | static lua_State *make_coro(lua_State *L, int *out_lref)
function parse_planner (line 82) | static bool parse_planner(MoonVisit *mv, Priv *p)
function init (line 94) | static int init(LuastatusPluginData *pd, lua_State *L)
function l_get_supported_opts (line 151) | static int l_get_supported_opts(lua_State *L)
function l_time_now (line 161) | static int l_time_now(lua_State *L)
function register_funcs (line 168) | static void register_funcs(LuastatusPluginData *pd, lua_State *L)
type NextAction (line 186) | typedef enum {
type WakeupStatus (line 193) | typedef enum {
type Ctx (line 199) | typedef struct {
function clear_next_req_params (line 209) | static void clear_next_req_params(NextRequestParams *X)
function destroy_ctx (line 219) | static void destroy_ctx(Ctx *ctx)
function parseY_request (line 226) | static bool parseY_request(lua_State *L, Ctx *ctx, char **out_errmsg)
function parseY_sleep (line 237) | static bool parseY_sleep(lua_State *L, Ctx *ctx, char **out_errmsg)
function parseY_call_cb (line 253) | static bool parseY_call_cb(lua_State *L, Ctx *ctx, char **out_errmsg)
function NextAction (line 268) | static NextAction parse_action(const char *s)
function parseY (line 282) | static bool parseY(lua_State *L, Ctx *ctx, char **out_errmsg)
function push_wakeup_status (line 316) | static inline void push_wakeup_status(lua_State *L, WakeupStatus wakeup_...
function push_planner_by_lref (line 325) | static inline void push_planner_by_lref(Priv *p, lua_State *L, lua_State...
function make_flash_call (line 335) | static bool make_flash_call(
function action_call_cb (line 397) | static void action_call_cb(
function push_headers (line 415) | static void push_headers(lua_State *L, LS_StringArray headers)
function report_request_result_ok (line 434) | static void report_request_result_ok(
function report_request_result_error (line 462) | static void report_request_result_error(
function action_request (line 492) | static void action_request(
function action_sleep (line 520) | static void action_sleep(LuastatusPluginData *pd, Ctx *ctx)
function run (line 543) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/xkb/somehow.c
function bad_matches (line 67) | static inline bool bad_matches(const char *bad, size_t nbad, const char ...
function check_bad (line 80) | static inline bool check_bad(const char *bad, const char *s, size_t ns)
function somehow_parse_symbols (line 92) | void somehow_parse_symbols(const char *symbols, LS_StringArray *out, con...
FILE: plugins/xkb/wrongly.c
function wrongly_fetch (line 44) | bool wrongly_fetch(Display *dpy, WronglyResult *out)
function wrongly_parse_layout (line 105) | void wrongly_parse_layout(const char *layout, LS_StringArray *out)
FILE: plugins/xkb/wrongly.h
type WronglyResult (line 28) | typedef struct {
FILE: plugins/xkb/xkb.c
type How (line 50) | typedef enum {
type Priv (line 55) | typedef struct {
function parse_how_str (line 63) | static int parse_how_str(MoonVisit *mv, void *ud, const char *s, size_t ns)
function destroy (line 79) | static void destroy(LuastatusPluginData *pd)
function init (line 87) | static int init(LuastatusPluginData *pd, lua_State *L)
function Display (line 144) | static Display *open_dpy(
function query_wrongly (line 187) | static bool query_wrongly(LuastatusPluginData *pd, Display *dpy, LS_Stri...
function query_somehow (line 212) | static bool query_somehow(LuastatusPluginData *pd, Display *dpy, LS_Stri...
function query (line 231) | static inline bool query(LuastatusPluginData *pd, Display *dpy, LS_Strin...
function run (line 243) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: plugins/xtitle/xtitle.c
type Priv (line 44) | typedef struct {
function destroy (line 50) | static void destroy(LuastatusPluginData *pd)
function init (line 57) | static int init(LuastatusPluginData *pd, lua_State *L)
type Data (line 89) | typedef struct {
function do_watch (line 99) | static inline void do_watch(Data *d, xcb_window_t win, bool state)
function get_active_window (line 107) | static inline bool get_active_window(Data *d, xcb_window_t *win)
function push_window_title (line 118) | static bool push_window_title(Data *d, lua_State *L, xcb_window_t win)
function push_window_title_or_nil (line 171) | static inline void push_window_title_or_nil(Data *d, lua_State *L, xcb_w...
function push_window_class_and_instance (line 178) | static bool push_window_class_and_instance(Data *d, lua_State *L, xcb_wi...
function push_arg (line 209) | static void push_arg(Data *d, lua_State *L, xcb_window_t win)
function title_changed (line 231) | static bool title_changed(
function xcb_screen_iterator_t (line 264) | static xcb_screen_iterator_t find_nth_screen(xcb_connection_t *conn, int n)
function run (line 273) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: tests/httpserv/argparser.c
function parse_int (line 35) | static bool parse_int(const char *s, int *dst)
function ArgParser_Option (line 52) | static ArgParser_Option *find_opt(ArgParser_Option *opts, const char *ar...
function arg_parser_parse (line 64) | bool arg_parser_parse(
FILE: tests/httpserv/argparser.h
type ArgParser_Option (line 25) | typedef struct {
FILE: tests/httpserv/buffer.c
function buffer_append (line 25) | void buffer_append(Buffer *b, const char *chunk, size_t len)
function buffer_destroy (line 37) | void buffer_destroy(Buffer *b)
FILE: tests/httpserv/buffer.h
type Buffer (line 24) | typedef struct {
FILE: tests/httpserv/common.c
function mul_zu_or_oom (line 26) | static inline size_t mul_zu_or_oom(size_t a, size_t b)
FILE: tests/httpserv/main.c
type GlobalOptions (line 34) | typedef struct {
type Request (line 46) | typedef struct {
type RequestList (line 52) | typedef struct {
function Request (line 60) | Request *request_new(uint64_t cookie)
function Request (line 74) | static Request *request_find_or_die(uint64_t cookie)
function request_free (line 84) | static void request_free(Request *req)
function request_prepare_error (line 90) | static int request_prepare_error(Request *req, int status, const char *s...
function my_before_req_cb (line 105) | int my_before_req_cb(
function freeze_or_die (line 203) | static void freeze_or_die(void)
function my_after_req_cb (line 214) | static void my_after_req_cb(
function my_ready_cb (line 230) | static void my_ready_cb(
function ATTR_NORETURN (line 246) | ATTR_NORETURN
function parse_method_or_die (line 254) | static bool parse_method_or_die(const char *s)
function main (line 265) | int main(int argc, char **argv)
FILE: tests/httpserv/server.c
type Callbacks (line 28) | typedef struct {
type MyContext (line 38) | typedef struct {
function my_context_new (line 46) | static void my_context_new(MyContext *my_ctx)
function my_context_before_request (line 55) | static int my_context_before_request(
function my_context_add_chunk (line 70) | static void my_context_add_chunk(MyContext *ctx, const char *chunk, size...
function my_context_destroy (line 88) | static void my_context_destroy(MyContext *my_ctx)
function my_callback (line 94) | static int my_callback(
type lws_protocols (line 186) | struct lws_protocols
type lws_http_mount (line 191) | struct lws_http_mount
function run_server (line 211) | bool run_server(
FILE: tests/httpserv/sleep_millis.c
function sleep_millis (line 25) | void sleep_millis(int millis)
FILE: tests/kcov_wrapper.c
function say_perror (line 52) | static inline void say_perror(const char *msg)
function say_error (line 57) | static inline void say_error(const char *msg)
function make_cloexec (line 70) | static int make_cloexec(int fd)
function make_self_pipe (line 83) | static bool make_self_pipe(void)
function full_read (line 94) | static int full_read(int fd, char *buf, size_t nbuf)
function wait_for_input_on_fd (line 113) | static int wait_for_input_on_fd(int fd, int timeout_ms)
function full_write (line 124) | static int full_write(int fd, const char *data, size_t ndata)
function sig_handler (line 140) | static void sig_handler(int signo)
function handle_signal (line 151) | static bool handle_signal(int signo)
function install_signal_handlers (line 185) | static bool install_signal_handlers(void)
function wait_and_make_exit_code (line 198) | static int wait_and_make_exit_code(pid_t pid)
function parse_imax (line 233) | static bool parse_imax(const char *s, intmax_t *out)
function trim_newline (line 244) | static void trim_newline(char *s)
function pid_t (line 252) | static pid_t get_grandchild_pid(pid_t child_pid)
type State (line 316) | typedef struct {
function state_has_grandchild_pid (line 321) | static bool state_has_grandchild_pid(State *s)
function state_kill (line 340) | static void state_kill(State *s, int signo)
type QueuedSignals (line 348) | typedef struct {
function queued_signals_add (line 356) | static inline void queued_signals_add(QueuedSignals *q, int signo)
function main (line 375) | int main(int argc, char **argv)
FILE: tests/listnets.c
function main (line 27) | int main()
FILE: tests/minstd.h
function LS_INHEADER (line 31) | LS_INHEADER uint32_t minstd_make_up_some_seed(void)
type MINSTD_Prng (line 44) | typedef struct {
function LS_INHEADER (line 53) | LS_INHEADER MINSTD_Prng minstd_prng_new(uint32_t seed)
function LS_INHEADER (line 62) | LS_INHEADER uint32_t minstd_prng_next_raw(MINSTD_Prng *P)
function LS_INHEADER (line 69) | LS_INHEADER uint64_t minstd_prng_next_u64(MINSTD_Prng *P)
function LS_INHEADER (line 80) | LS_INHEADER uint32_t minstd_prng_next_limit_u32(MINSTD_Prng *P, uint32_t...
FILE: tests/mock_barlib.c
type Priv (line 35) | typedef struct {
function destroy (line 42) | static void destroy(LuastatusBarlibData *bd)
function init (line 49) | static int init(LuastatusBarlibData *bd, const char *const *opts, size_t...
function set (line 90) | static int set(LuastatusBarlibData *bd, lua_State *L, size_t widget_idx)
function set_error (line 101) | static int set_error(LuastatusBarlibData *bd, size_t widget_idx)
function event_watcher (line 108) | static int event_watcher(LuastatusBarlibData *bd, LuastatusBarlibEWFuncs...
FILE: tests/mock_plugin.c
type Priv (line 32) | typedef struct {
function destroy (line 36) | static void destroy(LuastatusPluginData *pd)
function init (line 42) | static int init(LuastatusPluginData *pd, lua_State *L)
function run (line 66) | static void run(LuastatusPluginData *pd, LuastatusPluginRunFuncs funcs)
FILE: tests/optional/dbus_srv.py
function log (line 45) | def log(s):
class MyServerObject (line 49) | class MyServerObject(dbus.service.Object):
method __init__ (line 50) | def __init__(self, bus, object_path):
method Upcase (line 55) | def Upcase(self, msg):
method ReturnFortyTwo (line 61) | def ReturnFortyTwo(self):
method ConvertArrayToDictHexify (line 66) | def ConvertArrayToDictHexify(self, arr):
method ConvertDictToString (line 76) | def ConvertDictToString(self, d):
method RecvTuple0 (line 81) | def RecvTuple0(self):
method RecvTuple1 (line 86) | def RecvTuple1(self, arg):
method RecvTuple2 (line 91) | def RecvTuple2(self, arg1, arg2):
method RecvTuple3 (line 96) | def RecvTuple3(self, arg1, arg2, arg3):
method RecvVariant (line 101) | def RecvVariant(self, x):
method Get (line 132) | def Get(self, _, prop_name):
method GetAll (line 140) | def GetAll(self, _):
method Set (line 147) | def Set(self, _, prop_name, value):
function main (line 156) | def main():
FILE: tests/parrot.c
function fail (line 42) | static void fail(void)
function full_write (line 47) | static int full_write(int fd, const char *buf, size_t nbuf)
type ThreadArg (line 60) | typedef struct {
function parrot (line 92) | static void parrot(int other_fd)
type FlagOption (line 113) | typedef struct {
function print_usage (line 127) | static void print_usage(void)
function client (line 143) | static int client(int (*func)(const char *arg), const char *arg)
function server (line 154) | static int server(int (*func)(const char *arg), const char *arg)
function in_addr_t (line 192) | static in_addr_t localhost(void)
function make_unix_client (line 202) | static int make_unix_client(const char *path)
function parse_uint (line 228) | static bool parse_uint(const char *s, unsigned *out)
function make_tcp_client (line 239) | static int make_tcp_client(const char *portstr)
function make_tcp_server (line 271) | static int make_tcp_server(const char *portstr)
function make_unix_server (line 315) | static int make_unix_server(const char *path)
function main (line 346) | int main(int argc, char **argv)
FILE: tests/stopwatch.c
function now_ts (line 29) | static inline struct timespec now_ts(void)
function now_ms (line 58) | static inline uint64_t now_ms(void)
function parse_uint_cstr_or_die (line 64) | static uint64_t parse_uint_cstr_or_die(const char *s)
function trim_newline (line 76) | static void trim_newline(char *s)
function main (line 84) | int main(int argc, char **argv)
Condensed preview — 805 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,390K chars).
[
{
"path": ".circleci/config.yml",
"chars": 1174,
"preview": "version: 2.1\nworkflows:\n nanodesu:\n jobs:\n - subetedesu:\n matrix:\n parameters:\n "
},
{
"path": ".circleci/run-pt.sh",
"chars": 1142,
"preview": "#!/usr/bin/env bash\n\nset -e\n\natexit=()\n\ntrap '\n # We need to run finalizers in reversed order.\n for (( i = ${#atex"
},
{
"path": ".gitignore",
"chars": 223,
"preview": "*.o\n*.so\n/_gitignored/\n# CMake\nCMakeCache.txt\nCMakeFiles\nCMakeScripts\nMakefile\ncmake_install.cmake\ninstall_manifest.txt\n"
},
{
"path": ".luacheckrc",
"chars": 104,
"preview": "new_globals = {'widget'}\nnew_read_globals = {'luastatus'}\nignore = {\n '631', -- \"Line is too long\"\n}\n"
},
{
"path": "CMakeLists.txt",
"chars": 7112,
"preview": "cmake_minimum_required (VERSION 3.1.3...3.10)\nproject (luastatus C)\n\nif (NOT CMAKE_BUILD_TYPE)\n set (CMAKE_BUILD_TYPE"
},
{
"path": "COPYING.LESSER.txt",
"chars": 7652,
"preview": " GNU LESSER GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007"
},
{
"path": "COPYING.txt",
"chars": 35149,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "DEPENDS.txt",
"chars": 2688,
"preview": "luastatus itself, without any barlibs and/or plugins, has the following dependencies:\n* docutils >=0.11 (rst2man program"
},
{
"path": "DOCS/CUSTOM_DATA_SRC_WIDGET.md",
"chars": 1786,
"preview": "Writing a widget that uses custom data source\n===\n\nA “custom data source” widget is a fancy way to refer to a widget tha"
},
{
"path": "DOCS/MIGRATION_GUIDE.md",
"chars": 739,
"preview": "0.2.0 to 0.3.0\n===\n* Semantics of the `greet` option of `inotify` plugin has changed;\n see `plugins/inotify/README.md` "
},
{
"path": "DOCS/WRITING_BARLIB_OR_PLUGIN.md",
"chars": 1558,
"preview": "Thread-safety\n===\nEach non-thread-safe thing must be synchronized with other entities by means of the `map_get`\nfunction"
},
{
"path": "DOCS/c_notes/eintr-policy.md",
"chars": 426,
"preview": "The main problem is that all the stdio functions may, according to POSIX, fail with `EINTR`, and there is no way to rest"
},
{
"path": "DOCS/c_notes/empty-ranges-and-c-stdlib.md",
"chars": 2901,
"preview": "http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf\n\nSubclause 7.1.4 Use of library functions, point 1:\n\n> Each of"
},
{
"path": "DOCS/design/locking-patterns.md",
"chars": 1407,
"preview": "The list of locking patterns of the main luastatus binary; run\n\n grep -Ew '(UN)?LOCK_[A-Z]' luastatus/luastatus.c\n\nto"
},
{
"path": "DOCS/design/map_get.md",
"chars": 675,
"preview": "Overview\n===\nluastatus provides the following function to barlibs and plugins:\n\n```c\nvoid ** (*map_get)(void *userdata, "
},
{
"path": "README.md",
"chars": 8713,
"preview": "[](https://circleci.com/gh/shdown/lua"
},
{
"path": "barlibs/dwm/CMakeLists.txt",
"chars": 461,
"preview": "file (GLOB sources \"*.c\")\nluastatus_add_barlib (barlib-dwm $<TARGET_OBJECTS:ls> ${sources})\n\ntarget_compile_definitions "
},
{
"path": "barlibs/dwm/README.rst",
"chars": 1052,
"preview": ".. :X-man-page-only: luastatus-barlib-dwm\n.. :X-man-page-only: #####################\n.. :X-man-page-only:\n.. :X-man-page"
},
{
"path": "barlibs/dwm/dwm.c",
"chars": 6702,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/i3/CMakeLists.txt",
"chars": 728,
"preview": "file (GLOB sources \"*.c\")\nluastatus_add_barlib (\n barlib-i3\n $<TARGET_OBJECTS:ls>\n $<TARGET_OBJECTS:safe>\n $"
},
{
"path": "barlibs/i3/README.rst",
"chars": 5227,
"preview": ".. :X-man-page-only: luastatus-barlib-i3\n.. :X-man-page-only: ###################\n.. :X-man-page-only:\n.. :X-man-page-on"
},
{
"path": "barlibs/i3/escape_json_str.c",
"chars": 1837,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/escape_json_str.h",
"chars": 973,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/event_watcher.c",
"chars": 10365,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/i3/event_watcher.h",
"chars": 927,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/i3/fuzz_esc_json/.gitignore",
"chars": 17,
"preview": "harness\nfindings\n"
},
{
"path": "barlibs/i3/fuzz_esc_json/build.sh",
"chars": 654,
"preview": "#!/bin/sh\n\nif [ -z \"$CC\" ]; then\n echo >&2 \"You must set the 'CC' environment variable.\"\n echo >&2 \"Hint: you prob"
},
{
"path": "barlibs/i3/fuzz_esc_json/clear.sh",
"chars": 98,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nrm -rf ./findings\n"
},
{
"path": "barlibs/i3/fuzz_esc_json/fuzz.sh",
"chars": 349,
"preview": "#!/bin/sh\n\nset -e\n\nif [ -z \"$XXX_AFL_DIR\" ]; then\n echo >&2 \"You must set the 'XXX_AFL_DIR' environment variable.\"\n "
},
{
"path": "barlibs/i3/fuzz_esc_json/gen_testcases.sh",
"chars": 358,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nluastatus_root=../../..\n\n\"$luastatus_roo"
},
{
"path": "barlibs/i3/fuzz_esc_json/harness.c",
"chars": 1632,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_000",
"chars": 6,
"preview": "\\\"/\u0002/\\"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_001",
"chars": 9,
"preview": "\"\u0006\u0005\b\u0001\"\u0010\\\u0015"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_003",
"chars": 5,
"preview": "/\u0002\u0015\\\n"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_004",
"chars": 15,
"preview": "\"\u0018/cb\\\"\ba\u0017c\"b\\\u0005"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_006",
"chars": 7,
"preview": "ba\u000ba߫\u0018\""
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_007",
"chars": 6,
"preview": "c\u0014\"bcc"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_008",
"chars": 8,
"preview": "cbcȂbab\\"
},
{
"path": "barlibs/i3/fuzz_esc_json/testcases/testcase_009",
"chars": 7,
"preview": "cbƐbccb"
},
{
"path": "barlibs/i3/fuzz_esc_pango/.gitignore",
"chars": 17,
"preview": "harness\nfindings\n"
},
{
"path": "barlibs/i3/fuzz_esc_pango/build.sh",
"chars": 651,
"preview": "#!/bin/sh\n\nif [ -z \"$CC\" ]; then\n echo >&2 \"You must set the 'CC' environment variable.\"\n echo >&2 \"Hint: you prob"
},
{
"path": "barlibs/i3/fuzz_esc_pango/clear.sh",
"chars": 98,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nrm -rf ./findings\n"
},
{
"path": "barlibs/i3/fuzz_esc_pango/fuzz.sh",
"chars": 349,
"preview": "#!/bin/sh\n\nset -e\n\nif [ -z \"$XXX_AFL_DIR\" ]; then\n echo >&2 \"You must set the 'XXX_AFL_DIR' environment variable.\"\n "
},
{
"path": "barlibs/i3/fuzz_esc_pango/gen_testcases.sh",
"chars": 307,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nluastatus_root=../../..\n\n\"$luastatus_roo"
},
{
"path": "barlibs/i3/fuzz_esc_pango/harness.c",
"chars": 1833,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_000",
"chars": 6,
"preview": "&<>\\\"&"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_001",
"chars": 17,
"preview": ">&&<&\\>&b\\\"\">\"\"c\\"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_002",
"chars": 18,
"preview": ">c>>\\&\\c\"<c\\<&>\\a&"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_003",
"chars": 16,
"preview": "&<\\<<cc>cbb\"\"<\\<"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_004",
"chars": 19,
"preview": "\">&aca\"\"><\"bb>\"baa&"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_005",
"chars": 20,
"preview": "&\\<b>bcbbb>b\\>cc>&ab"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_006",
"chars": 9,
"preview": "acb&\\ab\\a"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_007",
"chars": 5,
"preview": "ac>bc"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_008",
"chars": 7,
"preview": "bbccba<"
},
{
"path": "barlibs/i3/fuzz_esc_pango/testcases/testcase_009",
"chars": 12,
"preview": "ababbaabcbbb"
},
{
"path": "barlibs/i3/i3.c",
"chars": 11648,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/i3/luastatus-i3-wrapper",
"chars": 100,
"preview": "#!/bin/sh\nexec ${LUASTATUS:-luastatus} -b i3 -B in_fd=3 -B out_fd=4 \"$@\" 3<&0 0</dev/null 4>&1 1>&2\n"
},
{
"path": "barlibs/i3/pango_escape.c",
"chars": 1537,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/pango_escape.h",
"chars": 929,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/i3/priv.h",
"chars": 1199,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/lemonbar/CMakeLists.txt",
"chars": 520,
"preview": "file (GLOB sources \"*.c\")\nluastatus_add_barlib (\n barlib-lemonbar\n $<TARGET_OBJECTS:ls>\n $<TARGET_OBJECTS:safe>"
},
{
"path": "barlibs/lemonbar/README.rst",
"chars": 2155,
"preview": ".. :X-man-page-only: luastatus-barlib-lemonbar\n.. :X-man-page-only: #########################\n.. :X-man-page-only:\n.. :X"
},
{
"path": "barlibs/lemonbar/fuzz_esc/.gitignore",
"chars": 17,
"preview": "harness\nfindings\n"
},
{
"path": "barlibs/lemonbar/fuzz_esc/build.sh",
"chars": 696,
"preview": "#!/bin/sh\n\nif [ -z \"$CC\" ]; then\n echo >&2 \"You must set the 'CC' environment variable.\"\n echo >&2 \"Hint: you prob"
},
{
"path": "barlibs/lemonbar/fuzz_esc/clear.sh",
"chars": 98,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nrm -rf ./findings\n"
},
{
"path": "barlibs/lemonbar/fuzz_esc/fuzz.sh",
"chars": 349,
"preview": "#!/bin/sh\n\nset -e\n\nif [ -z \"$XXX_AFL_DIR\" ]; then\n echo >&2 \"You must set the 'XXX_AFL_DIR' environment variable.\"\n "
},
{
"path": "barlibs/lemonbar/fuzz_esc/gen_testcases.sh",
"chars": 280,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nluastatus_root=../../..\n\n\"$luastatus_roo"
},
{
"path": "barlibs/lemonbar/fuzz_esc/harness.c",
"chars": 1821,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_000",
"chars": 6,
"preview": "acabca"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_001",
"chars": 18,
"preview": "abbc%cccbbacacb%cc"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_002",
"chars": 15,
"preview": "ccacb%a%%aacbcc"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_003",
"chars": 17,
"preview": "%c%abb%%%ccb%abcb"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_004",
"chars": 8,
"preview": "%a%ca%b%"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_005",
"chars": 9,
"preview": "%a%cbc%%%"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_006",
"chars": 15,
"preview": "%b%b%b%%c%%%%b%"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_007",
"chars": 10,
"preview": "%%%%%%%%bb"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_008",
"chars": 16,
"preview": "%%%%b%%%%%%%%%c%"
},
{
"path": "barlibs/lemonbar/fuzz_esc/testcases/testcase_009",
"chars": 6,
"preview": "%%%%%%"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/.gitignore",
"chars": 17,
"preview": "harness\nfindings\n"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/build.sh",
"chars": 696,
"preview": "#!/bin/sh\n\nif [ -z \"$CC\" ]; then\n echo >&2 \"You must set the 'CC' environment variable.\"\n echo >&2 \"Hint: you prob"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/clear.sh",
"chars": 98,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nrm -rf ./findings\n"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/fuzz.sh",
"chars": 967,
"preview": "#!/bin/sh\n\nset -e\n\nif [ -z \"$XXX_AFL_DIR\" ]; then\n echo >&2 \"You must set the 'XXX_AFL_DIR' environment variable.\"\n "
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/gen_testcases.sh",
"chars": 939,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nluastatus_root=../../..\n\nnl=$(printf '\\n"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/harness.c",
"chars": 1692,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_000",
"chars": 11,
"preview": "xxxx\nxxxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_001",
"chars": 11,
"preview": "xxxxxxx}xxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_002",
"chars": 13,
"preview": "xxxxxxxxxx%{A"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_003",
"chars": 13,
"preview": "xxxxx%{xxxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_004",
"chars": 12,
"preview": "xxxxxxxx%xxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_005",
"chars": 12,
"preview": "xxxxxxxxx%%x"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/X_testcase_fps",
"chars": 2,
"preview": "x%"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_000",
"chars": 11,
"preview": "xxxx:xxxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_001",
"chars": 12,
"preview": "%xxxxxxx:xxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_002",
"chars": 13,
"preview": "%{xxxxxxxxxx:"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Y_testcase_003",
"chars": 14,
"preview": "%{Axxxxx:xxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_000",
"chars": 11,
"preview": "xxxx:xxxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_001",
"chars": 12,
"preview": "xxxxxxxx:xxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_002",
"chars": 13,
"preview": "x%xxxxxxxxxx:"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_003",
"chars": 14,
"preview": "x%{xxxxx:xxxxx"
},
{
"path": "barlibs/lemonbar/fuzz_sanitize/testcases/Z_testcase_004",
"chars": 15,
"preview": "x%{Axxxxxxxx:xx"
},
{
"path": "barlibs/lemonbar/lemonbar.c",
"chars": 8786,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/lemonbar/luastatus-lemonbar-launcher",
"chars": 1060,
"preview": "#!/usr/bin/env bash\n\nset -e\n\nif (( BASH_VERSINFO[0] < 4 )); then\n echo >&2 \"bash 4.0 or higher is required (this one "
},
{
"path": "barlibs/lemonbar/markup_utils.c",
"chars": 2976,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/lemonbar/markup_utils.h",
"chars": 1144,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/stdout/CMakeLists.txt",
"chars": 507,
"preview": "file (GLOB sources \"*.c\")\nluastatus_add_barlib (\n barlib-stdout\n $<TARGET_OBJECTS:ls>\n $<TARGET_OBJECTS:safe>\n "
},
{
"path": "barlibs/stdout/README.rst",
"chars": 2842,
"preview": ".. :X-man-page-only: luastatus-barlib-stdout\n.. :X-man-page-only: #######################\n.. :X-man-page-only:\n.. :X-man"
},
{
"path": "barlibs/stdout/fuzz/.gitignore",
"chars": 17,
"preview": "harness\nfindings\n"
},
{
"path": "barlibs/stdout/fuzz/build.sh",
"chars": 647,
"preview": "#!/bin/sh\n\nif [ -z \"$CC\" ]; then\n echo >&2 \"You must set the 'CC' environment variable.\"\n echo >&2 \"Hint: you prob"
},
{
"path": "barlibs/stdout/fuzz/clear.sh",
"chars": 98,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nrm -rf ./findings\n"
},
{
"path": "barlibs/stdout/fuzz/fuzz.sh",
"chars": 349,
"preview": "#!/bin/sh\n\nset -e\n\nif [ -z \"$XXX_AFL_DIR\" ]; then\n echo >&2 \"You must set the 'XXX_AFL_DIR' environment variable.\"\n "
},
{
"path": "barlibs/stdout/fuzz/gen_testcases.sh",
"chars": 336,
"preview": "#!/bin/sh\n\nset -e\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nluastatus_root=../../..\n\nnl=$(printf '\\n"
},
{
"path": "barlibs/stdout/fuzz/harness.c",
"chars": 1620,
"preview": "/*\n * Copyright (C) 2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_000",
"chars": 6,
"preview": "\n\n\n\n\n\n"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_001",
"chars": 10,
"preview": "\n\n\n\ny\n\n\n\n\n"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_002",
"chars": 20,
"preview": "\n\n\n\n\n\n\nz\n\n\n\n\n\ny\nx\n\nx"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_003",
"chars": 17,
"preview": "xz\n\n\n\nz\nz\ny\n\n\n\nz\n"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_004",
"chars": 8,
"preview": "y\nx\n\nz\nz"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_005",
"chars": 9,
"preview": "z\n\nxx\nz\ny"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_006",
"chars": 16,
"preview": "x\ny\nz\nyy\nyyy\nyxx"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_007",
"chars": 18,
"preview": "\nxyyxyx\nzy\nzy\nzxyy"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_008",
"chars": 8,
"preview": "xxxxzxx\n"
},
{
"path": "barlibs/stdout/fuzz/testcases/testcase_009",
"chars": 14,
"preview": "zyyyyzxyyxyxxx"
},
{
"path": "barlibs/stdout/luastatus-dvtm",
"chars": 233,
"preview": "#!/bin/sh\n\nFIFO=~/.luastatus-dvtm\n\nset -e\n\nrm -f \"$FIFO\"\nmkfifo -m600 \"$FIFO\"\n\nexec ${LUASTATUS:-luastatus} -b stdout -B"
},
{
"path": "barlibs/stdout/luastatus-stdout-wrapper",
"chars": 76,
"preview": "#!/bin/sh\nexec ${LUASTATUS:-luastatus} -b stdout -B out_fd=3 \"$@\" 3>&1 1>&2\n"
},
{
"path": "barlibs/stdout/open_stdio_file.c",
"chars": 2777,
"preview": "/*\n * Copyright (C) 2026 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/stdout/open_stdio_file.h",
"chars": 1094,
"preview": "/*\n * Copyright (C) 2026 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free software: y"
},
{
"path": "barlibs/stdout/sanitize.c",
"chars": 1263,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/stdout/sanitize.h",
"chars": 911,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "barlibs/stdout/stdout.c",
"chars": 8013,
"preview": "/*\n * Copyright (C) 2015-2025 luastatus developers\n *\n * This file is part of luastatus.\n *\n * luastatus is free softwa"
},
{
"path": "check_final_newline.py",
"chars": 770,
"preview": "#!/usr/bin/env python3\nimport os\nimport sys\n\n\ndef say(s: str) -> None:\n print(s, file=sys.stderr)\n\n\ndef main() -> Non"
},
{
"path": "check_includes.sh",
"chars": 1955,
"preview": "#!/usr/bin/env bash\n\n# USAGE: check_includes.sh DIRECTORY [EXTRA CFLAGS...]\n# Requires 'include-what-you-use' tool.\n\nset"
},
{
"path": "check_style.sh",
"chars": 1826,
"preview": "#!/usr/bin/env bash\n\nset -e\nset -o pipefail\n\ncd -- \"$(dirname \"$(readlink \"$0\" || printf '%s\\n' \"$0\")\")\"\n\nsay() {\n pr"
},
{
"path": "contrib/luastatus-9999.ebuild",
"chars": 3930,
"preview": "# Copyright 1999-2023 Gentoo Authors\n# Distributed under the terms of the GNU General Public License v2\n\nEAPI=8\nCMAKE_IN"
},
{
"path": "contrib/luastatus.spec",
"chars": 1063,
"preview": "Name: luastatus\nVersion: 0.3.0\nRelease: 1%{?dist}\nSummary: universal statusbar content ge"
},
{
"path": "debian/changelog",
"chars": 134,
"preview": "luastatus (1:9999) UNRELEASED; urgency=medium\n\n * local build\n\n -- Local User <localuser@localhost> Sat, 08 Feb 2014 0"
},
{
"path": "debian/compat",
"chars": 3,
"preview": "10\n"
},
{
"path": "debian/control",
"chars": 5831,
"preview": "Source: luastatus\nSection: misc\nPriority: optional\nMaintainer: Viktor Krapivensky <shdownnine@gmail.com>\nStandards-Versi"
},
{
"path": "debian/copyright",
"chars": 1095,
"preview": "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: luastatus\nUpstream-Contact: Vi"
},
{
"path": "debian/rules",
"chars": 2432,
"preview": "#! /usr/bin/make -f\n\nexport V:=1\nexport DEB_BUILD_MAINT_OPTIONS:=hardening=+all\n\nBUILD_DIR := _deb_build\n\noverride_dh_au"
},
{
"path": "examples/dwm/alsa-gauge.lua",
"chars": 467,
"preview": "local GAUGE_NCHARS = 10\n\nlocal function mk_gauge(level, full, empty)\n local nfull = math.floor(level * GAUGE_NCHARS +"
},
{
"path": "examples/dwm/alsa.lua",
"chars": 295,
"preview": "widget = {\n plugin = 'alsa',\n cb = function(t)\n if t.mute then\n return '[mute]'\n else\n "
},
{
"path": "examples/dwm/backlight.lua",
"chars": 265,
"preview": "-- Note that this widget only shows backlight level when it changes.\nwidget = luastatus.require_plugin('backlight-linux'"
},
{
"path": "examples/dwm/battery.lua",
"chars": 547,
"preview": "widget = luastatus.require_plugin('battery-linux').widget{\n period = 2,\n cb = function(t)\n local symbol = ("
},
{
"path": "examples/dwm/bluetooth.lua",
"chars": 5184,
"preview": "-- A widget to display currently connected and paired bluetooth devices.\n-- To change output format modify reprint_devic"
},
{
"path": "examples/dwm/btc-price.lua",
"chars": 1489,
"preview": "-- Bitcoin price widget.\n-- Updates on click and every 5 minutes.\n\nlocal custom_sleep_amt = nil\n\nlocal function check_er"
},
{
"path": "examples/dwm/cpu-freq.lua",
"chars": 996,
"preview": "local VBLOCKS = {'▂', '▃', '▄', '▅', '▆', '▇', '█'}\n\nlocal function make_chunk(entry)\n local num = entry.cur - entry."
},
{
"path": "examples/dwm/cpu-temperature.lua",
"chars": 538,
"preview": "local plugin_data = {}\n\nlocal plugin_params = {\n timer_opts = {\n period = 2,\n },\n cb = function(t)\n "
},
{
"path": "examples/dwm/cpu-usage.lua",
"chars": 197,
"preview": "widget = luastatus.require_plugin('cpu-usage-linux').widget{\n cb = function(usage)\n if usage ~= nil then\n "
},
{
"path": "examples/dwm/disk-io.lua",
"chars": 660,
"preview": "widget = luastatus.require_plugin('disk-io-linux').widget{\n period = 2,\n cb = function(t)\n -- Sort by name "
},
{
"path": "examples/dwm/file-contents.lua",
"chars": 218,
"preview": "widget = luastatus.require_plugin('file-contents-linux').widget{\n filename = os.getenv('HOME') .. '/status',\n cb ="
},
{
"path": "examples/dwm/fs.lua",
"chars": 567,
"preview": "local function sorted_keys(tbl)\n local keys = {}\n for k, _ in pairs(tbl) do\n keys[#keys + 1] = k\n end\n "
},
{
"path": "examples/dwm/gmail.lua",
"chars": 779,
"preview": "--[[\n-- Expects 'credentials.lua' to be present in the current directory; it may contain, e.g.,\n-- return {\n-- "
},
{
"path": "examples/dwm/ip.lua",
"chars": 660,
"preview": "widget = {\n plugin = 'network-linux',\n cb = function(t)\n local r = {}\n for iface, params in pairs(t)"
},
{
"path": "examples/dwm/loadavg-linux.lua",
"chars": 898,
"preview": "local function get_ncpus()\n local f = assert(io.open('/proc/cpuinfo', 'r'))\n local n = 0\n for line in f:lines()"
},
{
"path": "examples/dwm/media-player-mpris.lua",
"chars": 901,
"preview": "local PLAYER = 'clementine'\n\nlocal PLAYBACK_STATUS_ICONS = {\n Playing = '▶',\n Paused = '◆',\n Stopped = '—',\n}\n"
},
{
"path": "examples/dwm/mem-usage.lua",
"chars": 245,
"preview": "widget = luastatus.require_plugin('mem-usage-linux').widget{\n timer_opts = {period = 2},\n cb = function(t)\n "
},
{
"path": "examples/dwm/mpd.lua",
"chars": 901,
"preview": "local titlewidth = 40\n\nwidget = {\n plugin = 'mpd',\n cb = function(t)\n if t.what == 'update' then\n "
},
{
"path": "examples/dwm/network-rate.lua",
"chars": 491,
"preview": "local function make_segment(iface, R, S)\n return string.format('[%s %.0fk↓ %.0fk↑]', iface, R / 1000, S / 1000)\nend\n\n"
},
{
"path": "examples/dwm/pulse-gauge.lua",
"chars": 433,
"preview": "local GAUGE_NCHARS = 10\n\nlocal function mk_gauge(level, full, empty)\n local nfull = math.floor(level * GAUGE_NCHARS +"
},
{
"path": "examples/dwm/pulse.lua",
"chars": 242,
"preview": "widget = {\n plugin = 'pulse',\n cb = function(t)\n if t.mute then\n return '[mute]'\n end\n "
},
{
"path": "examples/dwm/systemd-unit.lua",
"chars": 617,
"preview": "local function make_output(text)\n return string.format('[Tor: %s]', text)\nend\n\nwidget = luastatus.require_plugin('sys"
},
{
"path": "examples/dwm/time-battery-combined.lua",
"chars": 589,
"preview": "local function get_bat_seg(t)\n if not t then\n return '[--×--]'\n end\n if t.status == 'Unknown' or t.statu"
},
{
"path": "examples/dwm/time-date.lua",
"chars": 423,
"preview": "local months = {\n 'января',\n 'февраля',\n 'марта',\n 'апреля',\n 'мая',\n 'июня',\n 'июля',\n 'августа"
},
{
"path": "examples/dwm/tor.lua",
"chars": 300,
"preview": "-- Trivial but somewhat useful widget showing if the Tor daemon is running.\n\nwidget = {\n plugin = 'timer',\n opts ="
},
{
"path": "examples/dwm/uptime-linux.lua",
"chars": 962,
"preview": "local SUFFIXES_AND_DIVISORS = {\n {'m', 60},\n {'h', 60},\n {'d', 24},\n {'W', 7},\n {'M', 30},\n {'Y', 365 "
},
{
"path": "examples/dwm/weather-rus.lua",
"chars": 3993,
"preview": "local LOCATION_NAME = 'Moscow'\n\nlocal TIMEOUT = 10\n\nlocal INTERVAL = 9\nlocal SLEEP_AFTER_INITIAL = 5\n\nlocal coordinates "
},
{
"path": "examples/dwm/weather.lua",
"chars": 3994,
"preview": "local LOCATION_NAME = 'Moscow'\n\nlocal TIMEOUT = 10\n\nlocal INTERVAL = 9\nlocal SLEEP_AFTER_INITIAL = 5\n\nlocal coordinates "
},
{
"path": "examples/dwm/wireless.lua",
"chars": 1390,
"preview": "local MIN_DBM, MAX_DBM = -90, -20\nlocal NGAUGE = 5\n\nlocal function round(x)\n return math.floor(x + 0.5)\nend\n\nlocal fu"
},
{
"path": "examples/dwm/xkb.lua",
"chars": 497,
"preview": "widget = {\n plugin = 'xkb',\n cb = function(t)\n if t.name then\n local base_layout = t.name:match("
},
{
"path": "examples/i3/alsa-gauge.lua",
"chars": 525,
"preview": "local GAUGE_NCHARS = 10\n\nlocal function mk_gauge(level, full, empty)\n local nfull = math.floor(level * GAUGE_NCHARS +"
},
{
"path": "examples/i3/alsa-interactive-gauge.lua",
"chars": 3739,
"preview": "-- So, it looks like this:\n--\n-- ••• | ██████████████ | [ 70%] | •••\n--\n-- ^ gauge block ^ "
},
{
"path": "examples/i3/alsa.lua",
"chars": 361,
"preview": "widget = {\n plugin = 'alsa',\n cb = function(t)\n if t.mute then\n return {full_text = '[mute]', co"
},
{
"path": "examples/i3/backlight.lua",
"chars": 279,
"preview": "-- Note that this widget only shows backlight level when it changes.\nwidget = luastatus.require_plugin('backlight-linux'"
},
{
"path": "examples/i3/battery.lua",
"chars": 594,
"preview": "widget = luastatus.require_plugin('battery-linux').widget{\n period = 2,\n cb = function(t)\n local symbol = ("
},
{
"path": "examples/i3/bluetooth.lua",
"chars": 5199,
"preview": "-- A widget to display currently connected and paired bluetooth devices.\n-- To change output format modify reprint_devic"
},
{
"path": "examples/i3/btc-price.lua",
"chars": 1693,
"preview": "-- Bitcoin price widget.\n-- Updates on click and every 5 minutes.\n\nlocal custom_sleep_amt = nil\n\nlocal function check_er"
},
{
"path": "examples/i3/cpu-freq.lua",
"chars": 1232,
"preview": "local VBLOCKS = {'▂', '▃', '▄', '▅', '▆', '▇', '█'}\n\nlocal function make_color(ratio)\n local red = math.floor(0.5 + 2"
},
{
"path": "examples/i3/cpu-temperature.lua",
"chars": 896,
"preview": "local COOL_TEMP = 50\nlocal HEAT_TEMP = 75\nlocal function getcolor(temp)\n local t = (temp - COOL_TEMP) / (HEAT_TEMP - "
},
{
"path": "examples/i3/cpu-usage.lua",
"chars": 211,
"preview": "widget = luastatus.require_plugin('cpu-usage-linux').widget{\n cb = function(usage)\n if usage ~= nil then\n "
},
{
"path": "examples/i3/disk-io.lua",
"chars": 829,
"preview": "widget = luastatus.require_plugin('disk-io-linux').widget{\n period = 2,\n cb = function(t)\n -- Sort by name "
},
{
"path": "examples/i3/file-contents.lua",
"chars": 232,
"preview": "widget = luastatus.require_plugin('file-contents-linux').widget{\n filename = os.getenv('HOME') .. '/status',\n cb ="
},
{
"path": "examples/i3/fs.lua",
"chars": 646,
"preview": "local function sorted_keys(tbl)\n local keys = {}\n for k, _ in pairs(tbl) do\n keys[#keys + 1] = k\n end\n "
},
{
"path": "examples/i3/gmail.lua",
"chars": 1010,
"preview": "--[[\n-- Expects 'credentials.lua' to be present in the current directory; it may contain, e.g.,\n-- return {\n-- "
},
{
"path": "examples/i3/ip.lua",
"chars": 764,
"preview": "widget = {\n plugin = 'network-linux',\n cb = function(t)\n local r = {}\n for iface, params in pairs(t)"
},
{
"path": "examples/i3/loadavg-linux.lua",
"chars": 912,
"preview": "local function get_ncpus()\n local f = assert(io.open('/proc/cpuinfo', 'r'))\n local n = 0\n for line in f:lines()"
},
{
"path": "examples/i3/media-player-mpris.lua",
"chars": 2145,
"preview": "local PLAYER = 'clementine'\n\nlocal PLAYBACK_STATUS_ICONS = {\n Playing = '▶',\n Paused = '◆',\n Stopped = '—',\n}\n"
},
{
"path": "examples/i3/mem-usage.lua",
"chars": 278,
"preview": "widget = luastatus.require_plugin('mem-usage-linux').widget{\n timer_opts = {period = 2},\n cb = function(t)\n "
},
{
"path": "examples/i3/mpd-progressbar.lua",
"chars": 2288,
"preview": "local text, time, total, is_playing = nil, nil, nil, false\nlocal timeout = 2\nlocal titlewidth = 40\n\nlocal function W_spl"
},
{
"path": "examples/i3/network-rate.lua",
"chars": 649,
"preview": "local function make_segment(iface, R, S)\n return {\n full_text = string.format('[%s <span color=\"#DCA3A3\">%.0fk"
},
{
"path": "examples/i3/pulse-gauge.lua",
"chars": 491,
"preview": "local GAUGE_NCHARS = 10\n\nlocal function mk_gauge(level, full, empty)\n local nfull = math.floor(level * GAUGE_NCHARS +"
},
{
"path": "examples/i3/pulse-interactive-gauge.lua",
"chars": 3590,
"preview": "-- So, it looks like this:\n--\n-- ••• | ██████████████ | [ 70%] | •••\n--\n-- ^ gauge block ^ "
},
{
"path": "examples/i3/pulse.lua",
"chars": 308,
"preview": "widget = {\n plugin = 'pulse',\n cb = function(t)\n if t.mute then\n return {full_text = '[mute]', c"
},
{
"path": "examples/i3/systemd-unit.lua",
"chars": 940,
"preview": "local COLORS = {\n pink = '#ec93d3',\n green = '#60b48a',\n yellow = '#dfaf8f',\n red = '#dca3a3',\n dim"
},
{
"path": "examples/i3/time-battery-combined.lua",
"chars": 735,
"preview": "local function get_bat_seg(t)\n if not t then\n return {full_text = '[--×--]'}\n end\n if t.status == 'Unkno"
},
{
"path": "examples/i3/time-date.lua",
"chars": 404,
"preview": "local months = {'января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября',\n 'октября', 'но"
},
{
"path": "examples/i3/tor.lua",
"chars": 350,
"preview": "-- Trivial but somewhat useful widget showing if the Tor daemon is running.\n\nwidget = {\n plugin = 'timer',\n opts ="
},
{
"path": "examples/i3/update-on-click.lua",
"chars": 351,
"preview": "widget = {\n plugin = 'timer',\n opts = {\n make_self_pipe = true,\n period = 2.0,\n },\n cb = funct"
},
{
"path": "examples/i3/uptime-linux.lua",
"chars": 1010,
"preview": "local SUFFIXES_AND_DIVISORS = {\n {'m', 60},\n {'h', 60},\n {'d', 24},\n {'W', 7},\n {'M', 30},\n {'Y', 365 "
},
{
"path": "examples/i3/weather-rus.lua",
"chars": 4126,
"preview": "local LOCATION_NAME = 'Moscow'\n\nlocal TIMEOUT = 10\n\nlocal INTERVAL = 9\nlocal SLEEP_AFTER_INITIAL = 5\n\nlocal coordinates "
},
{
"path": "examples/i3/weather.lua",
"chars": 4127,
"preview": "local LOCATION_NAME = 'Moscow'\n\nlocal TIMEOUT = 10\n\nlocal INTERVAL = 9\nlocal SLEEP_AFTER_INITIAL = 5\n\nlocal coordinates "
}
]
// ... and 605 more files (download for full content)
About this extraction
This page contains the full source code of the shdown/luastatus GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 805 files (1.2 MB), approximately 377.1k tokens, and a symbol index with 935 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.