mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
e3700b924e
Add a second reason to show the bar besides visible by modifier. Update the visibility based on changes in the workspace urgency. Check all workspaces for urgency and keep the bar visible if at least one has an urgency hint.
54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#pragma once
|
|
#include <string>
|
|
|
|
#include "modules/sway/ipc/client.hpp"
|
|
#include "util/SafeSignal.hpp"
|
|
#include "util/json.hpp"
|
|
|
|
namespace waybar {
|
|
|
|
class Bar;
|
|
|
|
namespace modules::sway {
|
|
|
|
/*
|
|
* Supported subset of i3/sway IPC barconfig object
|
|
*/
|
|
struct swaybar_config {
|
|
std::string id;
|
|
std::string mode;
|
|
std::string hidden_state;
|
|
};
|
|
|
|
/**
|
|
* swaybar IPC client
|
|
*/
|
|
class BarIpcClient {
|
|
public:
|
|
BarIpcClient(waybar::Bar& bar);
|
|
|
|
private:
|
|
void onInitialConfig(const struct Ipc::ipc_response& res);
|
|
void onIpcEvent(const struct Ipc::ipc_response&);
|
|
void onCmd(const struct Ipc::ipc_response&);
|
|
void onConfigUpdate(const swaybar_config& config);
|
|
void onVisibilityUpdate(bool visible_by_modifier);
|
|
void onUrgencyUpdate(bool visible_by_urgency);
|
|
void update();
|
|
|
|
Bar& bar_;
|
|
util::JsonParser parser_;
|
|
Ipc ipc_;
|
|
|
|
swaybar_config bar_config_;
|
|
bool visible_by_modifier_ = false;
|
|
bool visible_by_urgency_ = false;
|
|
|
|
SafeSignal<bool> signal_visible_;
|
|
SafeSignal<bool> signal_urgency_;
|
|
SafeSignal<swaybar_config> signal_config_;
|
|
};
|
|
|
|
} // namespace modules::sway
|
|
} // namespace waybar
|