river-status: expose current layout name

This commit is contained in:
Leon Henrik Plickat
2022-08-14 17:16:38 +02:00
committed by Isaac Freund
parent 8036ae2bd1
commit b8e2ee2a0c
4 changed files with 60 additions and 2 deletions

View File

@ -161,6 +161,12 @@ fn handleRequest(layout: *river.LayoutV3, request: river.LayoutV3.Request, self:
// Therefore, simply ignore requests with old/wrong serials.
if (layout_demand.serial == req.serial) layout_demand.apply(self);
}
if (self.output.layout_name) |name| {
util.gpa.free(name);
}
self.output.layout_name = util.gpa.dupeZ(u8, mem.span(req.layout_name)) catch null;
self.output.sendLayoutName();
},
}
}
@ -187,6 +193,12 @@ pub fn destroy(self: *Self) void {
self.output.layout_demand = null;
server.root.notifyLayoutDemandDone();
}
if (self.output.layout_name) |name| {
util.gpa.free(name);
self.output.layout_name = null;
self.output.sendLayoutNameClear();
}
}
self.layout.setHandler(?*anyopaque, handleRequestInert, null, null);