summaryrefslogtreecommitdiff
path: root/gui-wm/wayfire/files/wayfire-0.11.0-rotate-layer-shell.patch
blob: 596fdc7f6d5295c1627f0ad1bd9d2b0d3e8e8601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
diff -ruN wayfire-desktop-a3/metadata/cube.xml wayfire-desktop-b4/metadata/cube.xml
--- wayfire-desktop-a3/metadata/cube.xml	2026-09-18 18:32:36.218903728 -0500
+++ wayfire-desktop-b4/metadata/cube.xml	2026-09-18 18:25:52.135123050 -0500
@@ -131,6 +131,11 @@
 			<hint>file</hint>
 			<default></default>
 		</option>
+		<option name="rotate_layer_shell" type="string">
+			<_short>Rotate layer-shell namespace</_short>
+			<_long>Transforms a matching layer-shell namespace with the cube, for example waybar. Leave empty to keep layer-shell surfaces fixed.</_long>
+			<default></default>
+		</option>
 		<!-- Cubemap -->
 		<option name="cubemap_image" type="string">
 			<_short>Cubemap image</_short>
diff -ruN wayfire-desktop-a3/plugins/cube/cube.cpp wayfire-desktop-b4/plugins/cube/cube.cpp
--- wayfire-desktop-a3/plugins/cube/cube.cpp	2026-09-18 18:32:36.218903728 -0500
+++ wayfire-desktop-b4/plugins/cube/cube.cpp	2026-09-18 19:30:37.240755830 -0500
@@ -108,6 +108,7 @@
                     self->cube->output, cws);
                 output_background->background = wf::color_t{0.0, 0.0, 0.0, 0.0};
                 output_background->include_workspace_views = false;
+                output_background->exclude_desktop_environment = self->cube->rotate_layer_shell;
                 auto push_background_damage = [=] (const wf::regionf_t& damage)
                 {
                     push_damage(self->get_bounding_box());
@@ -258,6 +259,7 @@
     wf::option_wrapper_t<double> zoom_opt{"cube/zoom"};
     wf::option_wrapper_t<double> face_dim{"cube/dim"};
     wf::option_wrapper_t<double> resting_yaw{"cube/resting_yaw"};
+    wf::option_wrapper_t<std::string> rotate_layer_shell{"cube/rotate_layer_shell"};
     wf::option_wrapper_t<double> window_move_alpha{"vswitch/window_move_alpha"};
     bool input_is_grabbed = false;
     wayfire_toplevel_view fixed_workspace_view = nullptr;
@@ -532,15 +534,15 @@
     {
         auto root = wf::get_core().scene();
         auto children = root->get_children();
-        auto workspace_layer =
-            root->layers[(int)wf::scene::layer::WORKSPACE];
+        auto overlay_layer =
+            root->layers[(int)wf::scene::layer::OVERLAY];
 
         std::vector<wf::scene::node_ptr> updated;
         updated.reserve(children.size() + 1);
         bool inserted = false;
         for (auto& child : children)
         {
-            if (!inserted && (child == workspace_layer))
+            if (!inserted && (child == overlay_layer))
             {
                 updated.push_back(render_node);
                 inserted = true;
@@ -1082,6 +1084,7 @@
         wf::scene::damage_node(render_node, render_node->get_bounding_box());
         if (animation.cube_animation.running())
         {
+            output->render->damage_whole();
             output->render->schedule_redraw();
         } else if (animation.in_exit)
         {
diff -ruN wayfire-desktop-a3/src/api/wayfire/workspace-stream.hpp wayfire-desktop-b4/src/api/wayfire/workspace-stream.hpp
--- wayfire-desktop-a3/src/api/wayfire/workspace-stream.hpp	2026-09-18 18:32:36.219903732 -0500
+++ wayfire-desktop-b4/src/api/wayfire/workspace-stream.hpp	2026-09-18 19:05:44.189920528 -0500
@@ -25,6 +25,9 @@
     // should be included in the workspace stream.
     bool include_desktop_environment = true;
 
+    // Optional layer-shell namespace to omit from the fixed desktop pass.
+    std::string exclude_desktop_environment;
+
     // Whether regular workspace views should be included in the workspace
     // stream.
     bool include_workspace_views = true;
diff -ruN wayfire-desktop-a3/src/output/workspace-stream.cpp wayfire-desktop-b4/src/output/workspace-stream.cpp
--- wayfire-desktop-a3/src/output/workspace-stream.cpp	2026-09-18 18:32:36.219903732 -0500
+++ wayfire-desktop-b4/src/output/workspace-stream.cpp	2026-09-18 19:30:52.482843865 -0500
@@ -54,9 +54,28 @@
                 {
                     auto view = node_to_view(ch);
                     const bool is_de     = (view && (view->role == wf::VIEW_ROLE_DESKTOP_ENVIRONMENT));
+                    static wf::option_wrapper_t<std::string> rotate_layer_shell{
+                        "cube/rotate_layer_shell"};
+                    const std::string rotate_namespace = rotate_layer_shell;
+                    const bool rotate_this_de = is_de && view &&
+                        !rotate_namespace.empty() &&
+                        (rotate_namespace == "*" ||
+                         view->get_app_id() == rotate_namespace);
+                    const bool render_as_desktop_environment = is_de && !rotate_this_de;
+                    const auto excluded_namespace =
+                        self->exclude_desktop_environment;
+                    const auto app_id = view ? view->get_app_id() : std::string{};
+                    const bool excluded_de = is_de &&
+                        !excluded_namespace.empty() &&
+                        (app_id == excluded_namespace ||
+                         app_id.rfind(excluded_namespace + "-", 0) == 0);
+                    if (excluded_de)
+                    {
+                        continue;
+                    }
                     size_t num_generated = this->instances.size();
 
-                    if (is_de && !self->include_desktop_environment)
+                    if (is_de && !self->include_desktop_environment && !rotate_this_de)
                     {
                         continue;
                     }
@@ -69,13 +88,13 @@
                     // We push the damage as-is for desktop environment views, because they are visible on
                     // every workspace.
                     ch->gen_render_instances(this->instances,
-                        is_de ? push_damage : translate_and_push_damage, self->output);
+                        render_as_desktop_environment ? push_damage : translate_and_push_damage, self->output);
 
                     // Mark whether the instances were generated from a desktop environment view
                     num_generated = this->instances.size() - num_generated;
                     for (size_t i = 0; i < num_generated; i++)
                     {
-                        is_desktop_environment.push_back(is_de);
+                        is_desktop_environment.push_back(render_as_desktop_environment);
                     }
                 }
             }