2018-08-15 18:17:17 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
2022-04-06 06:37:19 +00:00
|
|
|
|
2018-09-18 19:16:35 +00:00
|
|
|
#include <tuple>
|
2021-10-17 18:08:16 +00:00
|
|
|
|
2023-07-10 20:55:46 +00:00
|
|
|
#include "AAppIconLabel.hpp"
|
2018-08-15 18:17:17 +00:00
|
|
|
#include "bar.hpp"
|
|
|
|
#include "client.hpp"
|
2018-08-20 12:50:45 +00:00
|
|
|
#include "modules/sway/ipc/client.hpp"
|
2019-05-07 11:43:48 +00:00
|
|
|
#include "util/json.hpp"
|
2018-08-15 18:17:17 +00:00
|
|
|
|
|
|
|
namespace waybar::modules::sway {
|
|
|
|
|
2023-07-10 20:55:46 +00:00
|
|
|
class Window : public AAppIconLabel, public sigc::trackable {
|
2019-04-18 15:52:00 +00:00
|
|
|
public:
|
|
|
|
Window(const std::string&, const waybar::Bar&, const Json::Value&);
|
2023-03-02 13:57:07 +00:00
|
|
|
virtual ~Window() = default;
|
|
|
|
auto update() -> void override;
|
2019-04-18 15:52:00 +00:00
|
|
|
|
|
|
|
private:
|
sway-window, Issue 1399: new style classes
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.
Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.
Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.
Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.
Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
2022-04-17 05:13:35 +00:00
|
|
|
void setClass(std::string classname, bool enable);
|
2022-04-06 06:37:19 +00:00
|
|
|
void onEvent(const struct Ipc::ipc_response&);
|
|
|
|
void onCmd(const struct Ipc::ipc_response&);
|
sway-window, Issue 1399: new style classes
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.
Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.
Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.
Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.
Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
2022-04-17 05:13:35 +00:00
|
|
|
std::tuple<std::size_t, int, int, std::string, std::string, std::string, std::string, std::string>
|
|
|
|
getFocusedNode(const Json::Value& nodes, std::string& output);
|
2022-04-06 06:37:19 +00:00
|
|
|
void getTree();
|
|
|
|
|
|
|
|
const Bar& bar_;
|
|
|
|
std::string window_;
|
|
|
|
int windowId_;
|
|
|
|
std::string app_id_;
|
2022-04-18 01:09:25 +00:00
|
|
|
std::string app_class_;
|
sway-window, Issue 1399: new style classes
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.
Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.
Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.
Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.
Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
2022-04-17 05:13:35 +00:00
|
|
|
std::string layout_;
|
2022-04-06 06:37:19 +00:00
|
|
|
std::string old_app_id_;
|
|
|
|
std::size_t app_nb_;
|
2022-08-10 08:34:51 +00:00
|
|
|
std::string shell_;
|
sway-window, Issue 1399: new style classes
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.
Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.
Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.
Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.
Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
2022-04-17 05:13:35 +00:00
|
|
|
int floating_count_;
|
2019-05-29 15:53:22 +00:00
|
|
|
util::JsonParser parser_;
|
2022-04-06 06:37:19 +00:00
|
|
|
std::mutex mutex_;
|
|
|
|
Ipc ipc_;
|
2018-08-16 12:29:41 +00:00
|
|
|
};
|
2018-08-15 18:17:17 +00:00
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
} // namespace waybar::modules::sway
|