@@ -19,7 +19,7 @@ static void toggle_visibility(void *data, zdwl_ipc_output_v2 *zdwl_output_v2) {
19
19
}
20
20
21
21
static void active (void *data, zdwl_ipc_output_v2 *zdwl_output_v2, uint32_t active) {
22
- // Intentionally empty
22
+ static_cast <Window *>(data)-> handle_active (active);
23
23
}
24
24
25
25
static void set_tag (void *data, zdwl_ipc_output_v2 *zdwl_output_v2, uint32_t tag, uint32_t state,
@@ -74,7 +74,9 @@ static const wl_registry_listener registry_listener_impl = {.global = handle_glo
74
74
.global_remove = handle_global_remove};
75
75
76
76
Window::Window (const std::string &id, const Bar &bar, const Json::Value &config)
77
- : AAppIconLabel(config, " window" , id, " {}" , 0 , true ), bar_(bar) {
77
+ : AAppIconLabel(config, " window" , id, " {}" , 0 , true ),
78
+ bar_ (bar),
79
+ active_(false ) {
78
80
struct wl_display *display = Client::inst ()->wl_display ;
79
81
struct wl_registry *registry = wl_display_get_registry (display);
80
82
@@ -102,6 +104,8 @@ void Window::handle_title(const char *title) { title_ = Glib::Markup::escape_tex
102
104
103
105
void Window::handle_appid (const char *appid) { appid_ = Glib::Markup::escape_text (appid); }
104
106
107
+ void Window::handle_active (const uint32_t active) { active_ = active != 0 ; }
108
+
105
109
void Window::handle_layout_symbol (const char *layout_symbol) {
106
110
layout_symbol_ = Glib::Markup::escape_text (layout_symbol);
107
111
}
@@ -118,6 +122,11 @@ void Window::handle_frame() {
118
122
if (tooltipEnabled ()) {
119
123
label_.set_tooltip_text (title_);
120
124
}
125
+ if (active_) {
126
+ box_.get_style_context ()->add_class (" active" );
127
+ } else {
128
+ box_.get_style_context ()->remove_class (" active" );
129
+ }
121
130
}
122
131
123
132
} // namespace waybar::modules::dwl
0 commit comments