Skip to content

Commit 157ea44

Browse files
committedDec 14, 2024
Escape markup characters in dwl/window
Without this, markup characters like [&><] will be injected directly into the Label. Escaping them makes sure that the values will be printed exactly as they appear in the window title or layout symbol. Signed-off-by: K. Adam Christensen <pope@shifteleven.com>
1 parent e959f1d commit 157ea44

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

‎src/modules/dwl/window.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "client.hpp"
1111
#include "dwl-ipc-unstable-v2-client-protocol.h"
12+
#include "glibmm/markup.h"
1213
#include "util/rewrite_string.hpp"
1314

1415
namespace waybar::modules::dwl {
@@ -97,11 +98,17 @@ Window::~Window() {
9798
}
9899
}
99100

100-
void Window::handle_title(const char *title) { title_ = title; }
101+
void Window::handle_title(const char *title) {
102+
title_ = Glib::Markup::escape_text(title);
103+
}
101104

102-
void Window::handle_appid(const char *appid) { appid_ = appid; }
105+
void Window::handle_appid(const char *appid) {
106+
appid_ = Glib::Markup::escape_text(appid);
107+
}
103108

104-
void Window::handle_layout_symbol(const char *layout_symbol) { layout_symbol_ = layout_symbol; }
109+
void Window::handle_layout_symbol(const char *layout_symbol) {
110+
layout_symbol_ = Glib::Markup::escape_text(layout_symbol);
111+
}
105112

106113
void Window::handle_layout(const uint32_t layout) { layout_ = layout; }
107114

0 commit comments

Comments
 (0)
Failed to load comments.