@@ -26,6 +26,7 @@ Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
26
26
ipc_.handleEvent ();
27
27
} catch (const std::exception & e) {
28
28
spdlog::error (" Window: {}" , e.what ());
29
+ spdlog::trace (" Window::Window exception" );
29
30
}
30
31
});
31
32
}
@@ -42,6 +43,7 @@ void Window::onCmd(const struct Ipc::ipc_response& res) {
42
43
dp.emit ();
43
44
} catch (const std::exception & e) {
44
45
spdlog::error (" Window: {}" , e.what ());
46
+ spdlog::trace (" Window::onCmd exception" );
45
47
}
46
48
}
47
49
@@ -161,9 +163,9 @@ std::pair<int, int> leafNodesInWorkspace(const Json::Value& node) {
161
163
auto const & nodes = node[" nodes" ];
162
164
auto const & floating_nodes = node[" floating_nodes" ];
163
165
if (nodes.empty () && floating_nodes.empty ()) {
164
- if (node[" type" ] == " workspace" )
166
+ if (node[" type" ]. asString () == " workspace" )
165
167
return {0 ,0 };
166
- else if (node[" type" ] == " floating_con" ) {
168
+ else if (node[" type" ]. asString () == " floating_con" ) {
167
169
return {0 ,1 };
168
170
} else {
169
171
return {1 ,0 };
@@ -189,21 +191,24 @@ std::tuple<std::size_t, int, int, std::string, std::string, std::string> gfnWith
189
191
const Bar& bar_, Json::Value& parentWorkspace, Json::Value& filterWorkspace, const Json::Value& immediateParent) {
190
192
bool found_visible = false ;
191
193
for (auto const & node : nodes) {
192
- if (node[" type" ] == " output" ) {
194
+ if (node[" type" ]. asString () == " output" ) {
193
195
if (!config_[" all-outputs" ].asBool () && node[" name" ].asString () != bar_.output ->name ) {
194
196
continue ;
195
197
}
196
198
filterWorkspace = node[" current_workspace" ];
197
199
output = node[" name" ].asString ();
198
200
}
199
- else if (node[" type" ] == " workspace" ) {
201
+ else if (node[" type" ].asString () == " workspace" ) {
202
+ if (!filterWorkspace.isString ()) {
203
+ continue ;
204
+ }
200
205
// needs to be a string comparison, because filterWorkspace is the current_workspace
201
206
if (node[" name" ].asString () != filterWorkspace.asString ()) {
202
207
continue ;
203
208
}
204
209
parentWorkspace = node;
205
210
}
206
- else if (node[" type" ] == " con" || node[" type" ] == " floating_con" ) {
211
+ else if (node[" type" ]. asString () == " con" || node[" type" ]. asString () == " floating_con" ) {
207
212
// found node
208
213
if (node[" focused" ].asBool ()) {
209
214
spdlog::trace (" actual output {}, output found {}, node (focused) found {}" , bar_.output ->name , output, node[" name" ].asString ());
@@ -216,16 +221,15 @@ std::tuple<std::size_t, int, int, std::string, std::string, std::string> gfnWith
216
221
std::pair all_leaf_nodes = leafNodesInWorkspace (parentWorkspace);
217
222
nb = all_leaf_nodes.first ;
218
223
floating_count = all_leaf_nodes.second ;
219
- if (parentWorkspace[" layout" ].isString ()) {
220
- workspace_layout = parentWorkspace[" layout" ].asString ();
221
- }
224
+ workspace_layout = parentWorkspace[" layout" ].asString ();
222
225
}
223
226
return {nb,
224
227
floating_count,
225
228
node[" id" ].asInt (),
226
229
Glib::Markup::escape_text (node[" name" ].asString ()),
227
230
app_id,
228
231
workspace_layout};
232
+
229
233
}
230
234
// record visible nodes, but since we don't know if a focused node is yet found, we can't return anything yet
231
235
else if (!config_[" all-outputs" ].asBool () && node[" visible" ].asBool ()) {
@@ -245,6 +249,7 @@ std::tuple<std::size_t, int, int, std::string, std::string, std::string> gfnWith
245
249
return {nb2, f2, id2, name2, app_id2,workspace_layout2};
246
250
}
247
251
}
252
+
248
253
// This is needed so the recursion isn't finished early before finding a focused node when using offscreen-text
249
254
if (found_visible && immediateParent[" type" ].asString () == " workspace" ) {
250
255
int tiled_count = 0 ;
@@ -254,13 +259,12 @@ std::tuple<std::size_t, int, int, std::string, std::string, std::string> gfnWith
254
259
std::pair all_leaf_nodes = leafNodesInWorkspace (parentWorkspace);
255
260
tiled_count = all_leaf_nodes.first ;
256
261
floating_count = all_leaf_nodes.second ;
257
- if (parentWorkspace[" layout" ].isString ()) {
258
- workspace_layout = parentWorkspace[" layout" ].asString ();
259
- }
262
+ workspace_layout = parentWorkspace[" layout" ].asString ();
260
263
}
261
264
// using an empty string as default ensures that no window depending styles are set due to the checks above for !name.empty()
262
- return {tiled_count, floating_count, 0 , config_[" offscreen-text" ].isString () ? config_[ " offscreen-text " ]. asString () : " " , " " , workspace_layout};
265
+ return {tiled_count, floating_count, 0 , config_[" offscreen-text" ].asString (), " " , workspace_layout};
263
266
}
267
+
264
268
return {0 , 0 , -1 , " " , " " , " " };
265
269
}
266
270
@@ -275,6 +279,7 @@ void Window::getTree() {
275
279
ipc_.sendCmd (IPC_GET_TREE);
276
280
} catch (const std::exception & e) {
277
281
spdlog::error (" Window: {}" , e.what ());
282
+ spdlog::trace (" Window::getTree exception" );
278
283
}
279
284
}
280
285
0 commit comments