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

ipc-rules: Include role in view list information #2027

Merged
merged 1 commit into from
Nov 26, 2023
Merged
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
19 changes: 19 additions & 0 deletions plugins/single_plugins/ipc-rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@
#include <wayfire/nonstd/wlroots-full.hpp>


static std::string role_to_string(enum wf::view_role_t role)
{
switch (role)
{
case wf::VIEW_ROLE_TOPLEVEL:
return "toplevel";

case wf::VIEW_ROLE_UNMANAGED:
return "unmanaged";

case wf::VIEW_ROLE_DESKTOP_ENVIRONMENT:
return "desktop-environment";

default:
return "unknown";
}
}

static std::string layer_to_string(std::optional<wf::scene::layer> layer)
{
if (!layer.has_value())
Expand Down Expand Up @@ -168,6 +186,7 @@ class ipc_rules_t : public wf::plugin_interface_t, public wf::per_output_tracker
v["bbox"] = wf::ipc::geometry_to_json(view->get_bounding_box());
v["output"] = view->get_output() ? view->get_output()->to_string() : "null";
v["last-focus-timestamp"] = wf::get_focus_timestamp(view);
v["role"] = role_to_string(view->role);

v["state"] = {};
v["state"]["mapped"] = view->is_mapped();
Expand Down
Loading