Change default workspace format

This commit is contained in:
Marshall Moats 2023-08-02 16:02:50 -05:00 committed by GitHub
parent 94c34a29c4
commit 2bcd0eb09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0) { box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0) {
Json::Value config_format = config["format"]; Json::Value config_format = config["format"];
format_ = config_format.isString() ? config_format.asString() : "{id}"; format_ = config_format.isString() ? config_format.asString() : "{name}";
with_icon_ = format_.find("{icon}") != std::string::npos; with_icon_ = format_.find("{icon}") != std::string::npos;
if (with_icon_ && icons_map_.empty()) { if (with_icon_ && icons_map_.empty()) {
@ -325,8 +325,7 @@ void Workspace::update(const std::string &format, const std::string &icon) {
add_or_remove_class(style_context, is_empty(), "persistent"); add_or_remove_class(style_context, is_empty(), "persistent");
label_.set_markup( label_.set_markup(
fmt::format(fmt::runtime(format), fmt::arg("id", id()), fmt::format(fmt::runtime(format), fmt::arg("name", name()), fmt::arg("icon", icon)));
fmt::arg("name", name()), fmt::arg("icon", icon)));
} }
void Workspaces::sort_workspaces() { void Workspaces::sort_workspaces() {