MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / execute

Method execute

plugins/window-rules/view-action-interface.cpp:26–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24{}
25
26bool view_action_interface_t::execute(const std::string & name,
27 const std::vector<variant_t> & args)
28{
29 const auto& execute_set_alpha = [&]
30 {
31 auto alpha = _validate_alpha(args);
32 if (std::get<0>(alpha))
33 {
34 _set_alpha(std::get<1>(alpha));
35 }
36 };
37
38 if (!_view)
39 {
40 // We have a non-toplevel view. We can only adjust alpha for it ...
41
42 if ((name != "set") || (args.size() != 2) || (wf::get_string(args[0]) != "alpha"))
43 {
44 LOGW("The only allowed action for non-toplevel views is",
45 " set alpha <double>, matched ", _nontoplevel);
46 return true;
47 }
48
49 execute_set_alpha();
50 return false;
51 }
52
53 if (name == "set")
54 {
55 auto id = wf::get_string(args.at(0));
56
57 if (id == "sticky")
58 {
59 _make_sticky();
60 return false;
61 } else if (id == "always_on_top")
62 {
63 _always_on_top();
64 return false;
65 }
66
67 if ((args.size() < 2) || (wf::is_string(args.at(0)) == false))
68 {
69 LOGE(
70 "View action interface: Set execution requires at least 2 arguments, the first of which should be an identifier.");
71
72 return true;
73 }
74
75 if (id == "alpha")
76 {
77 execute_set_alpha();
78 } else if (id == "geometry")
79 {
80 auto geometry = _validate_geometry(args);
81 if (std::get<0>(geometry))
82 {
83 _set_geometry(std::get<1>(geometry), std::get<2>(geometry),

Callers

nothing calls this directly

Calls 4

get_tiled_edges_for_slotFunction · 0.85
tile_requestMethod · 0.80
sizeMethod · 0.45
get_outputMethod · 0.45

Tested by

no test coverage detected