Files
polybar/include/utils/plugin.hpp
Chase Geigle 42fda5b105 feat(plugin): Add initial draft plugin architecture.
Modules and other features that require optional libraries are now
dynamically loaded on the construction of the controller via dlopen().
This allows polybar to be built with support for all of the features on
one machine, but gracefully fall back and disable those features on
machines where the required optional shared libraries are not found.
2018-09-20 15:50:51 -05:00

38 lines
798 B
C++

#pragma once
#include <array>
#include "common.hpp"
#include "components/logger.hpp"
POLYBAR_NS
class plugin_handle {
public:
plugin_handle(const char* libname);
~plugin_handle();
plugin_handle(const plugin_handle&) = delete;
plugin_handle& operator=(const plugin_handle&) = delete;
plugin_handle(plugin_handle&&);
plugin_handle& operator=(plugin_handle&&);
private:
void* m_handle = nullptr;
};
// clang-format off
const static std::array<const char*, 8> plugin_names = {
"libpolybar-utils-i3.so",
"libpolybar-modules-alsa.so",
"libpolybar-modules-github.so",
"libpolybar-modules-i3.so",
"libpolybar-modules-mpd.so",
"libpolybar-modules-network.so",
"libpolybar-modules-pulseaudio.so",
"libpolybar-modules-xkeyboard.so"
};
// clang-format on
POLYBAR_NS_END