2018-08-09 12:05:48 +02:00
|
|
|
#include "factory.hpp"
|
|
|
|
|
|
2024-02-18 23:28:35 -08:00
|
|
|
#include "bar.hpp"
|
2023-10-15 11:32:05 -03:00
|
|
|
|
2024-02-18 23:28:35 -08:00
|
|
|
#if defined(HAVE_CHRONO_TIMEZONES) || defined(HAVE_LIBDATE)
|
|
|
|
|
#include "modules/clock.hpp"
|
|
|
|
|
#else
|
|
|
|
|
#include "modules/simpleclock.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SWAY
|
|
|
|
|
#include "modules/sway/language.hpp"
|
|
|
|
|
#include "modules/sway/mode.hpp"
|
|
|
|
|
#include "modules/sway/scratchpad.hpp"
|
|
|
|
|
#include "modules/sway/window.hpp"
|
|
|
|
|
#include "modules/sway/workspaces.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_WLR_TASKBAR
|
|
|
|
|
#include "modules/wlr/taskbar.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_WLR_WORKSPACES
|
|
|
|
|
#include "modules/wlr/workspace_manager.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_RIVER
|
|
|
|
|
#include "modules/river/layout.hpp"
|
|
|
|
|
#include "modules/river/mode.hpp"
|
|
|
|
|
#include "modules/river/tags.hpp"
|
|
|
|
|
#include "modules/river/window.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_DWL
|
|
|
|
|
#include "modules/dwl/tags.hpp"
|
2024-03-14 23:07:45 +03:00
|
|
|
#include "modules/dwl/window.hpp"
|
2024-02-18 23:28:35 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_HYPRLAND
|
|
|
|
|
#include "modules/hyprland/language.hpp"
|
|
|
|
|
#include "modules/hyprland/submap.hpp"
|
|
|
|
|
#include "modules/hyprland/window.hpp"
|
2024-08-24 00:06:24 +10:00
|
|
|
#include "modules/hyprland/windowcount.hpp"
|
2024-02-18 23:28:35 -08:00
|
|
|
#include "modules/hyprland/workspaces.hpp"
|
|
|
|
|
#endif
|
2024-08-29 11:45:17 +03:00
|
|
|
#ifdef HAVE_NIRI
|
|
|
|
|
#include "modules/niri/language.hpp"
|
|
|
|
|
#include "modules/niri/window.hpp"
|
|
|
|
|
#include "modules/niri/workspaces.hpp"
|
|
|
|
|
#endif
|
2024-02-18 23:28:35 -08:00
|
|
|
#if defined(__FreeBSD__) || defined(__linux__)
|
|
|
|
|
#include "modules/battery.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
|
|
|
|
|
#include "modules/cpu.hpp"
|
|
|
|
|
#include "modules/cpu_frequency.hpp"
|
|
|
|
|
#include "modules/cpu_usage.hpp"
|
|
|
|
|
#include "modules/load.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#include "modules/idle_inhibitor.hpp"
|
|
|
|
|
#if defined(HAVE_MEMORY_LINUX) || defined(HAVE_MEMORY_BSD)
|
|
|
|
|
#include "modules/memory.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#include "modules/disk.hpp"
|
|
|
|
|
#ifdef HAVE_DBUSMENU
|
|
|
|
|
#include "modules/sni/tray.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_MPRIS
|
|
|
|
|
#include "modules/mpris/mpris.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBNL
|
|
|
|
|
#include "modules/network.hpp"
|
|
|
|
|
#endif
|
2023-10-15 17:42:19 -03:00
|
|
|
#ifdef HAVE_LIBUDEV
|
2024-02-18 23:28:35 -08:00
|
|
|
#include "modules/backlight.hpp"
|
2023-10-15 17:42:19 -03:00
|
|
|
#include "modules/backlight_slider.hpp"
|
|
|
|
|
#endif
|
2024-02-18 23:28:35 -08:00
|
|
|
#ifdef HAVE_LIBEVDEV
|
|
|
|
|
#include "modules/keyboard_state.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_GAMEMODE
|
|
|
|
|
#include "modules/gamemode.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_UPOWER
|
2024-05-07 11:29:52 +03:00
|
|
|
#include "modules/upower.hpp"
|
2024-02-18 23:28:35 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_PIPEWIRE
|
|
|
|
|
#include "modules/privacy/privacy.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBPULSE
|
|
|
|
|
#include "modules/pulseaudio.hpp"
|
|
|
|
|
#include "modules/pulseaudio_slider.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBMPDCLIENT
|
|
|
|
|
#include "modules/mpd/mpd.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBSNDIO
|
|
|
|
|
#include "modules/sndio.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(__linux__)
|
|
|
|
|
#include "modules/bluetooth.hpp"
|
2024-02-18 22:06:21 +01:00
|
|
|
#include "modules/power_profiles_daemon.hpp"
|
2024-02-18 23:28:35 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LOGIND_INHIBITOR
|
|
|
|
|
#include "modules/inhibitor.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBJACK
|
|
|
|
|
#include "modules/jack.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBWIREPLUMBER
|
|
|
|
|
#include "modules/wireplumber.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBCAVA
|
|
|
|
|
#include "modules/cava.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SYSTEMD_MONITOR
|
|
|
|
|
#include "modules/systemd_failed_units.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#include "modules/cffi.hpp"
|
|
|
|
|
#include "modules/custom.hpp"
|
|
|
|
|
#include "modules/image.hpp"
|
|
|
|
|
#include "modules/temperature.hpp"
|
|
|
|
|
#include "modules/user.hpp"
|
2023-10-15 17:42:19 -03:00
|
|
|
|
2019-04-18 17:52:00 +02:00
|
|
|
waybar::Factory::Factory(const Bar& bar, const Json::Value& config) : bar_(bar), config_(config) {}
|
2018-08-09 12:05:48 +02:00
|
|
|
|
2023-10-26 23:08:57 +02:00
|
|
|
waybar::AModule* waybar::Factory::makeModule(const std::string& name,
|
|
|
|
|
const std::string& pos) const {
|
2018-08-13 14:05:13 +02:00
|
|
|
try {
|
2019-04-24 12:37:24 +02:00
|
|
|
auto hash_pos = name.find('#');
|
2018-12-18 17:30:54 +01:00
|
|
|
auto ref = name.substr(0, hash_pos);
|
|
|
|
|
auto id = hash_pos != std::string::npos ? name.substr(hash_pos + 1) : "";
|
2024-02-16 15:29:32 -08:00
|
|
|
#if defined(__FreeBSD__) || defined(__linux__)
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "battery") {
|
2024-01-07 17:09:31 +05:30
|
|
|
return new waybar::modules::Battery(id, bar_, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2019-05-12 19:53:14 +02:00
|
|
|
#endif
|
2022-05-13 21:30:45 +02:00
|
|
|
#ifdef HAVE_GAMEMODE
|
|
|
|
|
if (ref == "gamemode") {
|
|
|
|
|
return new waybar::modules::Gamemode(id, config_[name]);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2022-03-15 17:54:06 +01:00
|
|
|
#ifdef HAVE_UPOWER
|
|
|
|
|
if (ref == "upower") {
|
2024-05-07 11:29:52 +03:00
|
|
|
return new waybar::modules::UPower(id, config_[name]);
|
2022-03-15 17:54:06 +01:00
|
|
|
}
|
|
|
|
|
#endif
|
2023-10-26 23:08:57 +02:00
|
|
|
#ifdef HAVE_PIPEWIRE
|
|
|
|
|
if (ref == "privacy") {
|
|
|
|
|
return new waybar::modules::privacy::Privacy(id, config_[name], pos);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2021-11-01 19:17:29 +01:00
|
|
|
#ifdef HAVE_MPRIS
|
|
|
|
|
if (ref == "mpris") {
|
|
|
|
|
return new waybar::modules::mpris::Mpris(id, config_[name]);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2019-04-18 17:52:00 +02:00
|
|
|
#ifdef HAVE_SWAY
|
2018-10-30 13:39:30 +01:00
|
|
|
if (ref == "sway/mode") {
|
2019-05-07 13:21:18 +02:00
|
|
|
return new waybar::modules::sway::Mode(id, config_[name]);
|
2018-10-30 13:39:30 +01:00
|
|
|
}
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "sway/workspaces") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::sway::Workspaces(id, bar_, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "sway/window") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::sway::Window(id, bar_, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2020-10-10 19:09:18 +03:00
|
|
|
if (ref == "sway/language") {
|
2022-04-06 08:37:19 +02:00
|
|
|
return new waybar::modules::sway::Language(id, config_[name]);
|
2020-10-10 19:09:18 +03:00
|
|
|
}
|
2022-08-29 04:55:48 +08:00
|
|
|
if (ref == "sway/scratchpad") {
|
2022-08-31 01:54:19 +08:00
|
|
|
return new waybar::modules::sway::Scratchpad(id, config_[name]);
|
2022-08-29 04:55:48 +08:00
|
|
|
}
|
2020-05-30 12:07:38 +02:00
|
|
|
#endif
|
2024-02-17 08:17:42 -08:00
|
|
|
#ifdef HAVE_WLR_TASKBAR
|
2020-05-30 12:07:38 +02:00
|
|
|
if (ref == "wlr/taskbar") {
|
2020-06-06 15:41:37 +02:00
|
|
|
return new waybar::modules::wlr::Taskbar(id, bar_, config_[name]);
|
|
|
|
|
}
|
2024-02-17 08:17:42 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_WLR_WORKSPACES
|
2020-08-05 02:17:38 +03:00
|
|
|
if (ref == "wlr/workspaces") {
|
|
|
|
|
return new waybar::modules::wlr::WorkspaceManager(id, bar_, config_[name]);
|
|
|
|
|
}
|
2020-06-06 15:41:37 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_RIVER
|
2022-05-31 20:28:09 +00:00
|
|
|
if (ref == "river/mode") {
|
|
|
|
|
return new waybar::modules::river::Mode(id, bar_, config_[name]);
|
|
|
|
|
}
|
2020-06-06 15:41:37 +02:00
|
|
|
if (ref == "river/tags") {
|
|
|
|
|
return new waybar::modules::river::Tags(id, bar_, config_[name]);
|
2020-05-30 12:07:38 +02:00
|
|
|
}
|
2022-05-19 15:20:04 -04:00
|
|
|
if (ref == "river/window") {
|
|
|
|
|
return new waybar::modules::river::Window(id, bar_, config_[name]);
|
|
|
|
|
}
|
2023-01-31 16:34:38 +11:00
|
|
|
if (ref == "river/layout") {
|
|
|
|
|
return new waybar::modules::river::Layout(id, bar_, config_[name]);
|
|
|
|
|
}
|
2022-07-01 12:46:28 +02:00
|
|
|
#endif
|
2023-04-11 04:50:21 +03:00
|
|
|
#ifdef HAVE_DWL
|
|
|
|
|
if (ref == "dwl/tags") {
|
|
|
|
|
return new waybar::modules::dwl::Tags(id, bar_, config_[name]);
|
|
|
|
|
}
|
2024-03-14 23:07:45 +03:00
|
|
|
if (ref == "dwl/window") {
|
|
|
|
|
return new waybar::modules::dwl::Window(id, bar_, config_[name]);
|
|
|
|
|
}
|
2023-04-11 04:50:21 +03:00
|
|
|
#endif
|
2022-07-01 12:46:28 +02:00
|
|
|
#ifdef HAVE_HYPRLAND
|
|
|
|
|
if (ref == "hyprland/window") {
|
|
|
|
|
return new waybar::modules::hyprland::Window(id, bar_, config_[name]);
|
|
|
|
|
}
|
2024-08-24 00:06:24 +10:00
|
|
|
if (ref == "hyprland/windowcount") {
|
|
|
|
|
return new waybar::modules::hyprland::WindowCount(id, bar_, config_[name]);
|
|
|
|
|
}
|
2022-08-18 18:00:27 +02:00
|
|
|
if (ref == "hyprland/language") {
|
|
|
|
|
return new waybar::modules::hyprland::Language(id, bar_, config_[name]);
|
|
|
|
|
}
|
2022-12-21 01:45:57 +01:00
|
|
|
if (ref == "hyprland/submap") {
|
|
|
|
|
return new waybar::modules::hyprland::Submap(id, bar_, config_[name]);
|
|
|
|
|
}
|
2023-06-28 02:52:01 +03:00
|
|
|
if (ref == "hyprland/workspaces") {
|
|
|
|
|
return new waybar::modules::hyprland::Workspaces(id, bar_, config_[name]);
|
|
|
|
|
}
|
2024-08-29 11:45:17 +03:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_NIRI
|
|
|
|
|
if (ref == "niri/language") {
|
|
|
|
|
return new waybar::modules::niri::Language(id, bar_, config_[name]);
|
|
|
|
|
}
|
|
|
|
|
if (ref == "niri/window") {
|
|
|
|
|
return new waybar::modules::niri::Window(id, bar_, config_[name]);
|
|
|
|
|
}
|
|
|
|
|
if (ref == "niri/workspaces") {
|
|
|
|
|
return new waybar::modules::niri::Workspaces(id, bar_, config_[name]);
|
|
|
|
|
}
|
2019-04-18 17:52:00 +02:00
|
|
|
#endif
|
2019-02-17 15:27:54 +01:00
|
|
|
if (ref == "idle_inhibitor") {
|
|
|
|
|
return new waybar::modules::IdleInhibitor(id, bar_, config_[name]);
|
|
|
|
|
}
|
2019-08-09 10:40:33 +00:00
|
|
|
#if defined(HAVE_MEMORY_LINUX) || defined(HAVE_MEMORY_BSD)
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "memory") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::Memory(id, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2019-08-09 10:40:33 +00:00
|
|
|
#endif
|
2019-08-11 13:10:37 +00:00
|
|
|
#if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "cpu") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::Cpu(id, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2023-09-13 23:12:35 +02:00
|
|
|
#if defined(HAVE_CPU_LINUX)
|
2022-12-21 17:45:53 +01:00
|
|
|
if (ref == "cpu_frequency") {
|
|
|
|
|
return new waybar::modules::CpuFrequency(id, config_[name]);
|
|
|
|
|
}
|
2023-09-13 23:12:35 +02:00
|
|
|
#endif
|
2022-12-21 17:47:06 +01:00
|
|
|
if (ref == "cpu_usage") {
|
|
|
|
|
return new waybar::modules::CpuUsage(id, config_[name]);
|
|
|
|
|
}
|
2022-12-21 17:44:11 +01:00
|
|
|
if (ref == "load") {
|
|
|
|
|
return new waybar::modules::Load(id, config_[name]);
|
|
|
|
|
}
|
2019-08-11 13:10:37 +00:00
|
|
|
#endif
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "clock") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::Clock(id, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2022-09-30 14:33:23 +03:00
|
|
|
if (ref == "user") {
|
|
|
|
|
return new waybar::modules::User(id, config_[name]);
|
|
|
|
|
}
|
2019-09-23 22:25:54 +02:00
|
|
|
if (ref == "disk") {
|
|
|
|
|
return new waybar::modules::Disk(id, config_[name]);
|
|
|
|
|
}
|
2023-01-24 14:34:02 -05:00
|
|
|
if (ref == "image") {
|
|
|
|
|
return new waybar::modules::Image(id, config_[name]);
|
2019-09-23 22:25:54 +02:00
|
|
|
}
|
2019-08-11 15:23:37 +00:00
|
|
|
#ifdef HAVE_DBUSMENU
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "tray") {
|
2019-03-22 12:25:05 +01:00
|
|
|
return new waybar::modules::SNI::Tray(id, bar_, config_[name]);
|
2018-08-29 20:36:39 +02:00
|
|
|
}
|
2019-04-18 17:52:00 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBNL
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "network") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::Network(id, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2019-04-18 17:52:00 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBUDEV
|
2019-02-18 21:11:18 -07:00
|
|
|
if (ref == "backlight") {
|
|
|
|
|
return new waybar::modules::Backlight(id, config_[name]);
|
|
|
|
|
}
|
2023-10-15 17:42:19 -03:00
|
|
|
if (ref == "backlight/slider") {
|
|
|
|
|
return new waybar::modules::BacklightSlider(id, config_[name]);
|
|
|
|
|
}
|
2019-04-18 17:52:00 +02:00
|
|
|
#endif
|
2021-02-07 15:05:11 -05:00
|
|
|
#ifdef HAVE_LIBEVDEV
|
2021-07-23 09:45:07 -04:00
|
|
|
if (ref == "keyboard-state") {
|
2021-02-07 18:46:39 -05:00
|
|
|
return new waybar::modules::KeyboardState(id, bar_, config_[name]);
|
2021-02-07 15:05:11 -05:00
|
|
|
}
|
|
|
|
|
#endif
|
2019-04-18 17:52:00 +02:00
|
|
|
#ifdef HAVE_LIBPULSE
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref == "pulseaudio") {
|
2018-12-18 17:30:54 +01:00
|
|
|
return new waybar::modules::Pulseaudio(id, config_[name]);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2023-10-15 11:32:05 -03:00
|
|
|
if (ref == "pulseaudio/slider") {
|
|
|
|
|
return new waybar::modules::PulseaudioSlider(id, config_[name]);
|
|
|
|
|
}
|
2019-04-18 17:52:00 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBMPDCLIENT
|
2019-04-16 16:34:37 +02:00
|
|
|
if (ref == "mpd") {
|
|
|
|
|
return new waybar::modules::MPD(id, config_[name]);
|
|
|
|
|
}
|
2020-09-06 14:44:13 -03:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBSNDIO
|
|
|
|
|
if (ref == "sndio") {
|
|
|
|
|
return new waybar::modules::Sndio(id, config_[name]);
|
|
|
|
|
}
|
2021-12-03 23:32:53 +01:00
|
|
|
#endif
|
2024-02-19 13:54:46 -08:00
|
|
|
#if defined(__linux__)
|
2020-01-21 15:46:08 +01:00
|
|
|
if (ref == "bluetooth") {
|
|
|
|
|
return new waybar::modules::Bluetooth(id, config_[name]);
|
|
|
|
|
}
|
2024-03-02 18:37:32 +01:00
|
|
|
if (ref == "power-profiles-daemon") {
|
2024-02-18 22:06:21 +01:00
|
|
|
return new waybar::modules::PowerProfilesDaemon(id, config_[name]);
|
|
|
|
|
}
|
2024-02-19 13:54:46 -08:00
|
|
|
#endif
|
2024-02-16 23:30:00 -08:00
|
|
|
#ifdef HAVE_LOGIND_INHIBITOR
|
2022-05-06 17:01:43 +02:00
|
|
|
if (ref == "inhibitor") {
|
|
|
|
|
return new waybar::modules::Inhibitor(id, bar_, config_[name]);
|
|
|
|
|
}
|
2022-07-19 19:40:23 -04:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBJACK
|
|
|
|
|
if (ref == "jack") {
|
|
|
|
|
return new waybar::modules::JACK(id, config_[name]);
|
|
|
|
|
}
|
2022-11-16 12:23:12 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBWIREPLUMBER
|
|
|
|
|
if (ref == "wireplumber") {
|
|
|
|
|
return new waybar::modules::Wireplumber(id, config_[name]);
|
|
|
|
|
}
|
2023-04-15 02:36:15 +03:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LIBCAVA
|
|
|
|
|
if (ref == "cava") {
|
|
|
|
|
return new waybar::modules::Cava(id, config_[name]);
|
|
|
|
|
}
|
2024-01-09 18:05:17 +08:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SYSTEMD_MONITOR
|
|
|
|
|
if (ref == "systemd-failed-units") {
|
|
|
|
|
return new waybar::modules::SystemdFailedUnits(id, config_[name]);
|
|
|
|
|
}
|
2022-04-06 08:37:19 +02:00
|
|
|
#endif
|
2022-05-02 18:11:21 +02:00
|
|
|
if (ref == "temperature") {
|
|
|
|
|
return new waybar::modules::Temperature(id, config_[name]);
|
|
|
|
|
}
|
2018-10-25 17:30:26 +02:00
|
|
|
if (ref.compare(0, 7, "custom/") == 0 && ref.size() > 7) {
|
2023-12-19 22:54:12 +02:00
|
|
|
return new waybar::modules::Custom(ref.substr(7), id, config_[name], bar_.output->name);
|
2018-08-16 14:29:41 +02:00
|
|
|
}
|
2023-10-16 22:13:51 +02:00
|
|
|
if (ref.compare(0, 5, "cffi/") == 0 && ref.size() > 5) {
|
|
|
|
|
return new waybar::modules::CFFI(ref.substr(5), id, config_[name]);
|
2023-10-14 19:14:46 +02:00
|
|
|
}
|
2018-08-13 14:05:13 +02:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
|
auto err = fmt::format("Disabling module \"{}\", {}", name, e.what());
|
2018-08-19 13:39:57 +02:00
|
|
|
throw std::runtime_error(err);
|
2018-08-13 14:05:13 +02:00
|
|
|
} catch (...) {
|
|
|
|
|
auto err = fmt::format("Disabling module \"{}\", Unknown reason", name);
|
2018-08-19 13:39:57 +02:00
|
|
|
throw std::runtime_error(err);
|
2018-08-13 14:05:13 +02:00
|
|
|
}
|
2018-08-19 13:39:57 +02:00
|
|
|
throw std::runtime_error("Unknown module: " + name);
|
2018-08-09 12:05:48 +02:00
|
|
|
}
|