fixing workspaces
This commit is contained in:
@@ -270,13 +270,23 @@ void Workspace::update(const std::string &workspace_icon) {
|
|||||||
|
|
||||||
bool Workspace::isEmpty() const {
|
bool Workspace::isEmpty() const {
|
||||||
auto ignore_list = m_workspaceManager.getIgnoredWindows();
|
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(
|
return std::all_of(
|
||||||
m_windowMap.begin(), m_windowMap.end(),
|
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) {
|
void Workspace::updateTaskbar(const std::string &workspace_icon) {
|
||||||
|
|||||||
@@ -158,7 +158,15 @@ void waybar::modules::MPD::setLabel() {
|
|||||||
if (title == "n/a" || artist == "n/a") {
|
if (title == "n/a" || artist == "n/a") {
|
||||||
titleSmart = std::regex_replace(filename, std::regex(R"((\s*$$.*?$$)|(\.(mp3|m4a|opus|ogx))$)"), "");
|
titleSmart = std::regex_replace(filename, std::regex(R"((\s*$$.*?$$)|(\.(mp3|m4a|opus|ogx))$)"), "");
|
||||||
} else {
|
} 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;
|
song_pos = mpd_status_get_song_pos(status_.get()) + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user