Skip to content

Commit

Permalink
fix title not showing for special workspaces (seperate outputs: false
Browse files Browse the repository at this point in the history
  • Loading branch information
jramrath committed Feb 24, 2024
1 parent 0cbb280 commit 9f5c27c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion include/modules/hyprland/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
};

auto getActiveWorkspace(const std::string&) -> Workspace;
auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string&) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
Expand Down
13 changes: 4 additions & 9 deletions src/modules/hyprland/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,12 @@ auto Window::update() -> void {
AAppIconLabel::update();
}

auto Window::getActiveWorkspace() -> Workspace {
const auto workspace = gIPC->getSocket1JsonReply("activeworkspace");
assert(workspace.isObject());
return Workspace::parse(workspace);
}

auto Window::getActiveWorkspace(const std::string& monitorName) -> Workspace {
auto Window::getActiveWorkspace(const std::string& monitorName = "") -> Workspace {

Check warning on line 87 in src/modules/hyprland/window.cpp

View workflow job for this annotation

GitHub Actions / build

src/modules/hyprland/window.cpp:87:14 [readability-convert-member-functions-to-static]

method 'getActiveWorkspace' can be made static
const auto monitors = gIPC->getSocket1JsonReply("monitors");
assert(monitors.isArray());
auto monitor = std::find_if(monitors.begin(), monitors.end(),
[&](Json::Value monitor) { return monitor["name"] == monitorName; });
auto monitor = std::find_if(monitors.begin(), monitors.end(), [&](Json::Value monitor) {
return monitorName == "" ? monitor["focused"].asBool() : monitor["name"] == monitorName;

Check warning on line 91 in src/modules/hyprland/window.cpp

View workflow job for this annotation

GitHub Actions / build

src/modules/hyprland/window.cpp:91:12 [readability-container-size-empty]

the 'empty' method should be used to check for emptiness instead of comparing to an empty object
});
if (monitor == std::end(monitors)) {
spdlog::warn("Monitor not found: {}", monitorName);
return Workspace{-1, 0, "", ""};
Expand Down

0 comments on commit 9f5c27c

Please sign in to comment.