From 31bdacb3d7d44b8d7f97b0cddfecc619ff55459e Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 16 Oct 2022 21:16:13 +0200
Subject: [PATCH] Remove never used systray module
Not the same as the new tray module
---
include/modules/meta/all.hpp | 3 --
include/modules/systray.hpp | 41 -----------------------
include/x11/tray_manager.hpp | 2 --
src/CMakeLists.txt | 1 -
src/modules/meta/factory.cpp | 3 --
src/modules/systray.cpp | 65 ------------------------------------
6 files changed, 115 deletions(-)
delete mode 100644 include/modules/systray.hpp
delete mode 100644 src/modules/systray.cpp
diff --git a/include/modules/meta/all.hpp b/include/modules/meta/all.hpp
index c604bd4e..38e92b42 100644
--- a/include/modules/meta/all.hpp
+++ b/include/modules/meta/all.hpp
@@ -16,9 +16,6 @@
#include "modules/menu.hpp"
#include "modules/meta/base.hpp"
#include "modules/script.hpp"
-#if DEBUG
-#include "modules/systray.hpp"
-#endif
#include "modules/temperature.hpp"
#include "modules/text.hpp"
#include "modules/tray.hpp"
diff --git a/include/modules/systray.hpp b/include/modules/systray.hpp
deleted file mode 100644
index d58bffd5..00000000
--- a/include/modules/systray.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#if DEBUG
-#pragma once
-
-#include "modules/meta/static_module.hpp"
-
-POLYBAR_NS
-
-class connection;
-
-namespace modules {
- /**
- * Module used to display information about the
- * currently active X window.
- */
- class systray_module : public static_module {
- public:
- explicit systray_module(const bar_settings&, string);
-
- void update();
- bool build(builder* builder, const string& tag) const;
-
- static constexpr auto TYPE = "internal/systray";
-
- static constexpr auto EVENT_TOGGLE = "toggle";
-
- protected:
- void action_toggle();
-
- private:
- static constexpr const char* TAG_LABEL_TOGGLE{""};
- static constexpr const char* TAG_TRAY_CLIENTS{""};
-
- connection& m_connection;
- label_t m_label;
-
- bool m_hidden{false};
- };
-} // namespace modules
-
-POLYBAR_NS_END
-#endif
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index 7a7ebcbc..838d3251 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -26,8 +26,6 @@
#define TRAY_WM_NAME "Polybar tray window"
#define TRAY_WM_CLASS "tray\0Polybar"
-#define TRAY_PLACEHOLDER ""
-
POLYBAR_NS
namespace chrono = std::chrono;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02d37bac..d879ae43 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -96,7 +96,6 @@ set(POLY_SOURCES
${src_dir}/modules/meta/base.cpp
${src_dir}/modules/meta/factory.cpp
${src_dir}/modules/script.cpp
- ${src_dir}/modules/systray.cpp
${src_dir}/modules/temperature.cpp
${src_dir}/modules/text.cpp
${src_dir}/modules/xbacklight.cpp
diff --git a/src/modules/meta/factory.cpp b/src/modules/meta/factory.cpp
index 40503a55..07a52710 100644
--- a/src/modules/meta/factory.cpp
+++ b/src/modules/meta/factory.cpp
@@ -54,9 +54,6 @@ namespace modules {
map_entry(),
map_entry(),
map_entry(),
-#if DEBUG
- map_entry(),
-#endif
map_entry(),
map_entry(),
map_entry(),
diff --git a/src/modules/systray.cpp b/src/modules/systray.cpp
deleted file mode 100644
index 6ffa732f..00000000
--- a/src/modules/systray.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#if DEBUG
-#include "modules/systray.hpp"
-
-#include "drawtypes/label.hpp"
-#include "modules/meta/base.inl"
-#include "x11/connection.hpp"
-#include "x11/tray_manager.hpp"
-
-POLYBAR_NS
-
-namespace modules {
- template class module;
-
- /**
- * Construct module
- */
- systray_module::systray_module(const bar_settings& bar, string name_)
- : static_module(bar, move(name_)), m_connection(connection::make()) {
- m_router->register_action(EVENT_TOGGLE, [this]() { action_toggle(); });
-
- // Add formats and elements
- m_formatter->add(DEFAULT_FORMAT, TAG_LABEL_TOGGLE, {TAG_LABEL_TOGGLE, TAG_TRAY_CLIENTS});
-
- if (m_formatter->has(TAG_LABEL_TOGGLE)) {
- m_label = load_label(m_conf, name(), TAG_LABEL_TOGGLE);
- }
- }
-
- /**
- * Update
- */
- void systray_module::update() {
- if (m_label) {
- m_label->reset_tokens();
- m_label->replace_token("%title%", "");
- }
-
- broadcast();
- }
-
- /**
- * Build output
- */
- bool systray_module::build(builder* builder, const string& tag) const {
- if (tag == TAG_LABEL_TOGGLE) {
- builder->action(mousebtn::LEFT, *this, EVENT_TOGGLE, "", m_label);
- } else if (tag == TAG_TRAY_CLIENTS && !m_hidden) {
- builder->node(TRAY_PLACEHOLDER);
- } else {
- return false;
- }
- return true;
- }
-
- /**
- * Handle input event
- */
- void systray_module::action_toggle() {
- m_hidden = !m_hidden;
- broadcast();
- }
-} // namespace modules
-
-POLYBAR_NS_END
-#endif