Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sway ipc fixes: wrong workspace highlighted with waybar #275

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/floating_window_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ nlohmann::json FloatingWindowContainer::to_json() const
{ "width", logical_area.size.width.as_int() },
{ "height", logical_area.size.height.as_int() },
} },
{ "focused", is_focused() },
{ "focused", visible && is_focused() },
{ "focus", std::vector<int>() },
{ "border", "normal" },
{ "current_border_width", config->get_border_config().size },
Expand Down
2 changes: 1 addition & 1 deletion src/leaf_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ nlohmann::json LeafContainer::to_json() const
{ "width", logical_area.size.width.as_int() },
{ "height", logical_area.size.height.as_int() },
} },
{ "focused", is_focused() },
{ "focused", visible && is_focused() },
{ "focus", std::vector<int>() },
{ "border", "normal" },
{ "current_border_width", config->get_border_config().size },
Expand Down
2 changes: 1 addition & 1 deletion src/parent_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ nlohmann::json ParentContainer::to_json() const
{ "width", logical_area.size.width.as_int() },
{ "height", logical_area.size.height.as_int() },
} },
{ "focused", is_focused() },
{ "focused", visible && is_focused() },
{ "focus", std::vector<int>() },
{ "border", "none" },
{ "current_border_width", 0 },
Expand Down
5 changes: 4 additions & 1 deletion src/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ void Policy::advise_output_create(miral::Output const& output)
floating_window_manager, state, config, window_controller, animator);
workspace_manager.request_first_available_workspace(output_content);
output_list.push_back(output_content);
if (state.active_output == nullptr)
if (state.active_output == nullptr) {
state.active_output = output_content;
state.active_output->set_is_active(true);
}

// Let's rehome some orphan windows if we need to
if (!orphaned_window_list.empty())
Expand Down Expand Up @@ -525,6 +527,7 @@ void Policy::advise_output_delete(miral::Output const& output)
else
{
state.active_output = output_list.front();
state.active_output->set_is_active(true);
for (auto& window : other_output->collect_all_windows())
{
state.active_output->add_immediately(window);
Expand Down
2 changes: 1 addition & 1 deletion src/workspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ nlohmann::json Workspace::to_json() const
{ "type", "workspace" },
{ "name", std::to_string(workspace) },
{ "visible", output->is_active() && is_focused },
{ "focused", output->is_active() && is_focused && root->is_focused() },
{ "focused", output->is_active() && is_focused },
{ "urgent", false },
{ "output", output->get_output().name() },
{ "border", "none" },
Expand Down
6 changes: 3 additions & 3 deletions src/workspace_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,17 @@ std::shared_ptr<Output> WorkspaceManager::request_focus(int key)
return nullptr;

auto active_screen = get_active_screen();
int previous_workspace = -1;
if (active_screen)
{
int previous_workspace = active_screen->get_active_workspace_num();
previous_workspace = active_screen->get_active_workspace_num();
last_selected = { previous_workspace, output_to_workspace_mapping[previous_workspace] };
}
output_to_workspace_mapping[key]->advise_workspace_active(key);

if (active_screen != nullptr)
{
auto active_workspace = active_screen->get_active_workspace_num();
registry.advise_focused(active_screen, active_workspace, output_to_workspace_mapping[key].get(), key);
registry.advise_focused(output_to_workspace_mapping[previous_workspace].get(), previous_workspace, output_to_workspace_mapping[key].get(), key);
}
else
registry.advise_focused(nullptr, -1, output_to_workspace_mapping[key].get(), key);
Expand Down
Loading