Merge branch 'Alexays:master' into master
This commit is contained in:
@ -704,7 +704,7 @@ auto waybar::modules::Battery::update() -> void {
|
||||
} else if (config_["tooltip-format"].isString()) {
|
||||
tooltip_format = config_["tooltip-format"].asString();
|
||||
}
|
||||
label_.set_tooltip_text(
|
||||
label_.set_tooltip_markup(
|
||||
fmt::format(fmt::runtime(tooltip_format), fmt::arg("timeTo", tooltip_text_default),
|
||||
fmt::arg("power", power), fmt::arg("capacity", capacity),
|
||||
fmt::arg("time", time_remaining_formatted), fmt::arg("cycles", cycles),
|
||||
|
||||
@ -65,11 +65,15 @@ Json::Value Workspaces::createMonitorWorkspaceData(std::string const &name,
|
||||
void Workspaces::createWorkspace(Json::Value const &workspace_data,
|
||||
Json::Value const &clients_data) {
|
||||
auto workspaceName = workspace_data["name"].asString();
|
||||
auto workspaceId = workspace_data["id"].asInt();
|
||||
spdlog::debug("Creating workspace {}", workspaceName);
|
||||
|
||||
// avoid recreating existing workspaces
|
||||
auto workspace =
|
||||
std::ranges::find_if(m_workspaces, [workspaceName](std::unique_ptr<Workspace> const &w) {
|
||||
std::ranges::find_if(m_workspaces, [&](std::unique_ptr<Workspace> const &w) {
|
||||
if (workspaceId > 0) {
|
||||
return w->id() == workspaceId;
|
||||
}
|
||||
return (workspaceName.starts_with("special:") && workspaceName.substr(8) == w->name()) ||
|
||||
workspaceName == w->name();
|
||||
});
|
||||
@ -253,10 +257,8 @@ void Workspaces::loadPersistentWorkspacesFromConfig(Json::Value const &clientsJs
|
||||
// value is an array => create defined workspaces for this monitor
|
||||
if (canCreate) {
|
||||
for (const Json::Value &workspace : value) {
|
||||
if (workspace.isInt()) {
|
||||
spdlog::debug("Creating workspace {} on monitor {}", workspace, currentMonitor);
|
||||
persistentWorkspacesToCreate.emplace_back(std::to_string(workspace.asInt()));
|
||||
}
|
||||
spdlog::debug("Creating workspace {} on monitor {}", workspace, currentMonitor);
|
||||
persistentWorkspacesToCreate.emplace_back(workspace.asString());
|
||||
}
|
||||
} else {
|
||||
// key is the workspace and value is array of monitors to create on
|
||||
@ -944,9 +946,17 @@ bool Workspaces::updateWindowsToCreate() {
|
||||
void Workspaces::updateWorkspaceStates() {
|
||||
const std::vector<int> visibleWorkspaces = getVisibleWorkspaces();
|
||||
auto updatedWorkspaces = m_ipc.getSocket1JsonReply("workspaces");
|
||||
|
||||
auto currentWorkspace = m_ipc.getSocket1JsonReply("activeworkspace");
|
||||
std::string currentWorkspaceName =
|
||||
currentWorkspace.isMember("name") ? currentWorkspace["name"].asString() : "";
|
||||
|
||||
for (auto &workspace : m_workspaces) {
|
||||
bool isActiveByName =
|
||||
!currentWorkspaceName.empty() && workspace->name() == currentWorkspaceName;
|
||||
|
||||
workspace->setActive(
|
||||
workspace->id() == m_activeWorkspaceId ||
|
||||
workspace->id() == m_activeWorkspaceId || isActiveByName ||
|
||||
(workspace->isSpecial() && workspace->name() == m_activeSpecialWorkspaceName));
|
||||
if (workspace->isActive() && workspace->isUrgent()) {
|
||||
workspace->setUrgent(false);
|
||||
|
||||
@ -132,7 +132,7 @@ auto waybar::modules::Pulseaudio::update() -> void {
|
||||
tooltip_format = config_["tooltip-format"].asString();
|
||||
}
|
||||
if (!tooltip_format.empty()) {
|
||||
label_.set_tooltip_text(fmt::format(
|
||||
label_.set_tooltip_markup(fmt::format(
|
||||
fmt::runtime(tooltip_format), fmt::arg("desc", sink_desc),
|
||||
fmt::arg("volume", sink_volume), fmt::arg("format_source", format_source),
|
||||
fmt::arg("source_volume", source_volume), fmt::arg("source_desc", source_desc),
|
||||
|
||||
Reference in New Issue
Block a user