fixing workspaces

This commit is contained in:
2026-02-23 15:38:11 +03:00
parent 9af70bfe42
commit 688197c8c8
2 changed files with 23 additions and 5 deletions

View File

@@ -270,13 +270,23 @@ void Workspace::update(const std::string &workspace_icon) {
bool Workspace::isEmpty() const {
auto ignore_list = m_workspaceManager.getIgnoredWindows();
if (ignore_list.empty()) {
return m_windows == 0;
// If there are no windows at all, the workspace is empty
if (m_windowMap.empty()) {
return true;
}
// If there are windows but they are all ignored, consider the workspace empty
// If no windows are ignored, any window means the workspace is not empty
if (ignore_list.empty()) {
return false;
}
// Otherwise, check if every window in the map should be skipped (ignored)
return std::all_of(
m_windowMap.begin(), m_windowMap.end(),
[this, &ignore_list](const auto &window_repr) { return shouldSkipWindow(window_repr); });
[this, &ignore_list](const auto &window_repr) {
return shouldSkipWindow(window_repr);
});
}
void Workspace::updateTaskbar(const std::string &workspace_icon) {

View File

@@ -158,7 +158,15 @@ void waybar::modules::MPD::setLabel() {
if (title == "n/a" || artist == "n/a") {
titleSmart = std::regex_replace(filename, std::regex(R"((\s*$$.*?$$)|(\.(mp3|m4a|opus|ogx))$)"), "");
} else {
titleSmart = static_cast<std::string>(artist) + " - " + static_cast<std::string>(title);
// Remove content within parentheses from the title
std::string cleanedTitle = std::regex_replace(static_cast<std::string>(title),
std::regex(R"(\([^)]*\))"),
"");
// Also trim any trailing spaces that might be left after removing parentheses
cleanedTitle = std::regex_replace(cleanedTitle, std::regex(R"(\s+$)"), "");
titleSmart = static_cast<std::string>(artist) + " - " + cleanedTitle;
}
song_pos = mpd_status_get_song_pos(status_.get()) + 1;