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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
|
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/metadata/cube.xml b/metadata/cube.xml
--- a/metadata/cube.xml 2026-07-27 03:26:17.000000000 -0500
+++ b/metadata/cube.xml 2026-08-16 19:07:42.961288683 -0500
@@ -49,6 +49,22 @@
<_long>Specifies whether to use lighting.</_long>
<default>true</default>
</option>
+ <option name="dim" type="double">
+ <_short>Cube dim</_short>
+ <_long>Darkens only the cube faces before they are blended over the output background.</_long>
+ <default>0.0</default>
+ <min>0.0</min>
+ <max>1.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="resting_yaw" type="double">
+ <_short>Resting yaw</_short>
+ <_long>Sets the initial cube turn used when interactive mouse rotation begins from rest.</_long>
+ <default>0.15</default>
+ <min>0.0</min>
+ <max>0.5</max>
+ <precision>0.01</precision>
+ </option>
<!-- Zoom -->
<option name="zoom" type="double">
<_short>Zoom</_short>
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/metadata/vswitch.xml b/metadata/vswitch.xml
--- a/metadata/vswitch.xml 2026-07-27 03:26:17.000000000 -0500
+++ b/metadata/vswitch.xml 2026-08-16 19:07:42.962288689 -0500
@@ -54,6 +54,19 @@
<_long>Switches to the last active workspace with the focused window with the specified activator.</_long>
<default></default>
</option>
+ <option name="with_win_modifier" type="activator">
+ <_short>Hold window modifier</_short>
+ <_long>Highlights the focused window while the window workspace-switch modifier is held.</_long>
+ <default></default>
+ </option>
+ <option name="window_move_alpha" type="double">
+ <_short>Window move alpha</_short>
+ <_long>Opacity used for the focused window while it is being held or moved between workspaces.</_long>
+ <default>0.65</default>
+ <min>0.0</min>
+ <max>1.0</max>
+ <precision>0.01</precision>
+ </option>
<option name="send_win_left" type="activator">
<_short>Send window to the left</_short>
<_long>Send the focused window to the workspace on the left.</_long>
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/cube-control-signal.hpp b/plugins/cube/cube-control-signal.hpp
--- a/plugins/cube/cube-control-signal.hpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/cube-control-signal.hpp 2026-08-16 19:07:42.962288689 -0500
@@ -1,7 +1,9 @@
#ifndef CUBE_CONTROL_SIGNAL
#define CUBE_CONTROL_SIGNAL
+#include <wayfire/geometry.hpp>
#include <wayfire/signal-definitions.hpp>
+#include <wayfire/toplevel-view.hpp>
/* A private signal, currently shared by idle & cube
*
@@ -18,4 +20,18 @@
bool carried_out; // false if cube is disabled
};
+struct cube_workspace_animation_signal
+{
+ wf::point_t delta;
+ wf::point_t anchor_workspace;
+ wayfire_toplevel_view fixed_view = nullptr;
+ bool carried_out = false;
+};
+
+struct cube_render_pause_signal
+{
+ bool pause = false;
+ bool carried_out = false;
+};
+
#endif /* end of include guard: CUBE_CONTROL_SIGNAL */
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/cube.cpp b/plugins/cube/cube.cpp
--- a/plugins/cube/cube.cpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/cube.cpp 2026-08-16 19:07:52.511342641 -0500
@@ -1,15 +1,22 @@
#include <wayfire/per-output-plugin.hpp>
#include <memory>
+#include <optional>
#include <wayfire/plugin.hpp>
#include <wayfire/opengl.hpp>
#include <wayfire/output.hpp>
#include <wayfire/core.hpp>
+#include <wayfire/window-manager.hpp>
+#include <wayfire/seat.hpp>
#include <wayfire/workspace-stream.hpp>
#include <wayfire/render-manager.hpp>
#include <wayfire/workspace-set.hpp>
#include <wayfire/scene-operations.hpp>
+#include <wayfire/unstable/translation-node.hpp>
+#include <wayfire/view-transform.hpp>
+#include <wayfire/nonstd/wlroots.hpp>
#include <wayfire/plugins/common/input-grab.hpp>
#include "wayfire/plugins/ipc/ipc-activator.hpp"
+#include <wlr/types/wlr_keyboard.h>
#include <glm/gtc/matrix_transform.hpp>
#include <wayfire/img.hpp>
@@ -39,6 +46,38 @@
class wayfire_cube : public wf::per_output_plugin_instance_t, public wf::pointer_interaction_t
{
+ class fixed_view_overlay_node_t : public wf::scene::node_t
+ {
+ std::weak_ptr<wf::toplevel_view_interface_t> view;
+
+ public:
+ fixed_view_overlay_node_t(wayfire_toplevel_view view) : node_t(false)
+ {
+ this->view = view->weak_from_this();
+ }
+
+ void gen_render_instances(
+ std::vector<wf::scene::render_instance_uptr>& instances,
+ wf::scene::damage_callback push_damage, wf::output_t *shown_on) override
+ {
+ if (auto view = this->view.lock())
+ {
+ view->get_transformed_node()->gen_render_instances(
+ instances, push_damage, shown_on);
+ }
+ }
+
+ wf::geometry_t get_bounding_box() override
+ {
+ if (auto view = this->view.lock())
+ {
+ return view->get_transformed_node()->get_bounding_box();
+ }
+
+ return {0, 0, 0, 0};
+ }
+ };
+
class cube_render_node_t : public wf::scene::node_t
{
class cube_render_instance_t : public wf::scene::render_instance_t
@@ -46,6 +85,8 @@
std::shared_ptr<cube_render_node_t> self;
wf::scene::damage_callback push_damage;
+ std::shared_ptr<wf::workspace_stream_node_t> output_background;
+ std::vector<wf::scene::render_instance_uptr> output_background_instances;
std::vector<std::vector<wf::scene::render_instance_uptr>> ws_instances;
std::vector<wf::regionf_t> ws_damage;
std::vector<wf::auxilliary_buffer_t> framebuffers;
@@ -61,6 +102,19 @@
{
this->self = std::dynamic_pointer_cast<cube_render_node_t>(self->shared_from_this());
this->push_damage = push_damage;
+
+ auto cws = self->cube->output->wset()->get_current_workspace();
+ output_background = std::make_shared<wf::workspace_stream_node_t>(
+ self->cube->output, cws);
+ output_background->background = wf::color_t{0.0, 0.0, 0.0, 0.0};
+ output_background->include_workspace_views = false;
+ auto push_background_damage = [=] (const wf::regionf_t& damage)
+ {
+ push_damage(self->get_bounding_box());
+ };
+ output_background->gen_render_instances(output_background_instances,
+ push_background_damage, self->cube->output);
+
self->connect(&on_cube_damage);
ws_damage.resize(self->workspaces.size());
@@ -94,18 +148,25 @@
.damage = damage & self->get_bounding_box(),
});
+ wf::regionf_t background_damage =
+ output_background->get_bounding_box();
+ auto background_target =
+ target.translated(-wf::origin(self->get_bounding_box()));
+ for (auto& instance : output_background_instances)
+ {
+ instance->schedule_instructions(
+ instructions, background_target, background_damage);
+ }
+
auto bbox = self->get_bounding_box();
damage ^= bbox;
- const bool is_hdr = self->cube->output && self->cube->output->is_hdr();
-
for (int i = 0; i < (int)ws_instances.size(); i++)
{
const float scale = self->cube->output->handle->scale;
auto bbox = self->workspaces[i]->get_bounding_box();
- framebuffers[i].allocate(wf::dimensions(bbox), scale,
- wf::buffer_allocation_hints_t{.hdr_linear = is_hdr});
+ framebuffers[i].allocate(wf::dimensions(bbox), scale);
wf::render_target_t target{framebuffers[i]};
target.geometry = self->workspaces[i]->get_bounding_box();
@@ -113,9 +174,10 @@
wf::render_pass_params_t params;
params.instances = &ws_instances[i];
- params.damage = ws_damage[i];
+ params.damage = self->workspaces[i]->get_bounding_box();
params.reference_output = self->cube->output;
params.target = target;
+ params.background_color = wf::color_t{0.0, 0.0, 0.0, 0.0};
params.flags = wf::RPASS_CLEAR_BACKGROUND | wf::RPASS_EMIT_SIGNALS;
wf::render_pass_t::run(params);
@@ -149,7 +211,10 @@
auto y = cube->output->wset()->get_current_workspace().y;
for (int i = 0; i < w; i++)
{
- auto node = std::make_shared<wf::workspace_stream_node_t>(cube->output, wf::point_t{i, y});
+ auto node = std::make_shared<wf::workspace_stream_node_t>(
+ cube->output, wf::point_t{i, y});
+ node->background = wf::color_t{0.0, 0.0, 0.0, 0.0};
+ node->include_desktop_environment = false;
workspaces.push_back(node);
}
}
@@ -179,10 +244,24 @@
std::unique_ptr<wf::input_grab_t> input_grab;
std::shared_ptr<cube_render_node_t> render_node;
+ std::shared_ptr<wf::scene::translation_node_t> fixed_overlay_node;
+ wayfire_toplevel_view fixed_overlay_view = nullptr;
+ wayfire_toplevel_view post_move_dim_view = nullptr;
+ std::optional<wf::point_t> workspace_animation_anchor;
+ const std::string held_dim_transformer_name = "workspace-move-window-dim";
+ bool fixed_overlay_added_transformer = false;
+ static constexpr uint32_t held_window_modifiers =
+ WLR_MODIFIER_CTRL | WLR_MODIFIER_ALT | WLR_MODIFIER_LOGO;
wf::option_wrapper_t<double> XVelocity{"cube/speed_spin_horiz"},
YVelocity{"cube/speed_spin_vert"}, ZVelocity{"cube/speed_zoom"};
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<double> window_move_alpha{"vswitch/window_move_alpha"};
+ bool input_is_grabbed = false;
+ wayfire_toplevel_view fixed_workspace_view = nullptr;
+ bool cube_render_paused = false;
/* the Z camera distance so that (-1, 1) is mapped to the whole screen
* for the given FOV */
@@ -234,7 +313,7 @@
wf::plugin_activation_data_t grab_interface{
.name = "cube",
- .capabilities = wf::CAPABILITY_MANAGE_COMPOSITOR,
+ .capabilities = 0,
.cancel = [=] () { deactivate(); },
};
@@ -255,6 +334,13 @@
reload_background();
output->connect(&on_cube_control);
+ output->connect(&on_cube_workspace_animation);
+ output->connect(&on_cube_render_pause);
+ output->connect(&on_fixed_view_disappeared);
+ output->connect(&on_view_geometry_changed);
+ wf::get_core().connect(&on_fixed_view_set_output);
+ wf::get_core().connect(&on_key_release);
+ wf::get_core().connect(&on_modifier_change);
wf::gles::run_in_context([&]
{
load_program();
@@ -358,6 +444,266 @@
output->render->schedule_redraw();
}
+ void animate_workspace_delta(wf::point_t delta,
+ wf::point_t anchor_workspace,
+ wayfire_toplevel_view fixed_view)
+ {
+ if (!activate())
+ {
+ return;
+ }
+
+ if (fixed_view && (fixed_view->get_output() != output))
+ {
+ fixed_view = nullptr;
+ }
+
+ workspace_animation_anchor = anchor_workspace;
+ fixed_workspace_view = fixed_view;
+ show_fixed_workspace_overlay(fixed_view);
+ rebuild_cube_render_node();
+
+ animation.in_exit = false;
+ animation.cube_animation.zoom.set(1.0, 1.0);
+ animation.cube_animation.offset_z.set(
+ identity_z_offset + Z_OFFSET_NEAR,
+ identity_z_offset + Z_OFFSET_NEAR);
+ animation.cube_animation.offset_y.set(0, 0);
+ animation.cube_animation.ease_deformation.set(0, 0);
+
+ if (delta.x != 0)
+ {
+ animation.cube_animation.rotation.set(
+ delta.x * animation.side_angle,
+ delta.x * animation.side_angle);
+ animation.cube_animation.rotation.restart_with_end(0);
+ } else
+ {
+ animation.cube_animation.rotation.set(0, 0);
+ }
+
+ animation.cube_animation.start();
+ update_view_matrix();
+ output->render->schedule_redraw();
+ }
+
+ wf::signal::connection_t<cube_workspace_animation_signal>
+ on_cube_workspace_animation = [=] (cube_workspace_animation_signal *ev)
+ {
+ animate_workspace_delta(ev->delta, ev->anchor_workspace,
+ ev->fixed_view);
+ ev->carried_out = true;
+ };
+
+ wf::signal::connection_t<cube_render_pause_signal>
+ on_cube_render_pause = [=] (cube_render_pause_signal *ev)
+ {
+ pause_cube_render(ev->pause);
+ ev->carried_out = true;
+ };
+
+ void grab_cube_input()
+ {
+ if (input_is_grabbed)
+ {
+ return;
+ }
+
+ wf::get_core().connect(&on_motion_event);
+ wf::get_core().hide_cursor();
+ input_grab->grab_input(wf::scene::layer::OVERLAY);
+ input_is_grabbed = true;
+ }
+
+ void release_cube_input()
+ {
+ if (!input_is_grabbed)
+ {
+ return;
+ }
+
+ input_grab->ungrab_input();
+ wf::get_core().unhide_cursor();
+ on_motion_event.disconnect();
+ input_is_grabbed = false;
+ }
+
+ void add_cube_render_node()
+ {
+ auto root = wf::get_core().scene();
+ auto children = root->get_children();
+ auto workspace_layer =
+ root->layers[(int)wf::scene::layer::WORKSPACE];
+
+ std::vector<wf::scene::node_ptr> updated;
+ updated.reserve(children.size() + 1);
+ bool inserted = false;
+ for (auto& child : children)
+ {
+ if (!inserted && (child == workspace_layer))
+ {
+ updated.push_back(render_node);
+ inserted = true;
+ }
+
+ updated.push_back(child);
+ }
+
+ if (!inserted)
+ {
+ updated.insert(updated.begin(), render_node);
+ }
+
+ root->set_children_list(updated);
+ wf::scene::update(root, wf::scene::update_flag::CHILDREN_LIST);
+ }
+
+ void rebuild_cube_render_node()
+ {
+ if (!render_node)
+ {
+ return;
+ }
+
+ wf::scene::remove_child(render_node);
+ render_node = std::make_shared<cube_render_node_t>(this);
+ add_cube_render_node();
+ }
+
+ void pause_cube_render(bool pause)
+ {
+ if (pause)
+ {
+ if (render_node)
+ {
+ wf::scene::remove_child(render_node);
+ render_node = nullptr;
+ cube_render_paused = true;
+ output->render->damage_whole();
+ }
+
+ return;
+ }
+
+ if (cube_render_paused && !render_node)
+ {
+ render_node = std::make_shared<cube_render_node_t>(this);
+ add_cube_render_node();
+ cube_render_paused = false;
+ output->render->damage_whole();
+ }
+ }
+
+ void remove_held_dim_transformers(wayfire_toplevel_view view)
+ {
+ if (!view)
+ {
+ return;
+ }
+
+ auto node = view->get_transformed_node();
+ while (node->get_transformer(held_dim_transformer_name))
+ {
+ node->rem_transformer(held_dim_transformer_name);
+ }
+ }
+
+ bool has_held_dim_transformer(wayfire_toplevel_view view)
+ {
+ if (!view)
+ {
+ return false;
+ }
+
+ return view->get_transformed_node()->get_transformer(
+ held_dim_transformer_name) != nullptr;
+ }
+
+ void clear_fixed_workspace_overlay(bool keep_post_move_dim = true)
+ {
+ if (!fixed_overlay_node)
+ {
+ return;
+ }
+
+ if (fixed_overlay_view)
+ {
+ if (keep_post_move_dim &&
+ ((wf::get_core().seat->get_keyboard_modifiers() &
+ held_window_modifiers) == held_window_modifiers))
+ {
+ post_move_dim_view = fixed_overlay_view;
+ fixed_overlay_view = nullptr;
+ return;
+ } else
+ {
+ if (fixed_overlay_added_transformer)
+ {
+ remove_held_dim_transformers(fixed_overlay_view);
+ }
+
+ post_move_dim_view = nullptr;
+ }
+
+ wf::scene::set_node_enabled(
+ fixed_overlay_view->get_transformed_node(), true);
+ fixed_overlay_view = nullptr;
+ fixed_overlay_added_transformer = false;
+ }
+
+ wf::scene::remove_child(fixed_overlay_node);
+ fixed_overlay_node = nullptr;
+ }
+
+ void clear_post_move_window_dim()
+ {
+ if (!post_move_dim_view)
+ {
+ return;
+ }
+
+ remove_held_dim_transformers(post_move_dim_view);
+ wf::scene::set_node_enabled(
+ post_move_dim_view->get_transformed_node(), true);
+ if (fixed_overlay_node)
+ {
+ wf::scene::remove_child(fixed_overlay_node);
+ fixed_overlay_node = nullptr;
+ }
+
+ post_move_dim_view = nullptr;
+ fixed_overlay_added_transformer = false;
+ }
+
+ void show_fixed_workspace_overlay(wayfire_toplevel_view view)
+ {
+ clear_post_move_window_dim();
+ clear_fixed_workspace_overlay(false);
+ if (!view)
+ {
+ return;
+ }
+
+ auto overlay = std::make_shared<fixed_view_overlay_node_t>(view);
+ fixed_overlay_added_transformer = false;
+ if (!has_held_dim_transformer(view))
+ {
+ auto transformer = std::make_shared<wf::scene::view_2d_transformer_t>(view);
+ transformer->alpha = wf::clamp((double)window_move_alpha, 0.0, 1.0);
+ view->get_transformed_node()->add_transformer(transformer,
+ wf::TRANSFORMER_2D, held_dim_transformer_name);
+ fixed_overlay_added_transformer = true;
+ }
+
+ wf::scene::set_node_enabled(view->get_transformed_node(), false);
+ fixed_overlay_view = view;
+
+ fixed_overlay_node = std::make_shared<wf::scene::translation_node_t>();
+ fixed_overlay_node->set_children_list({overlay});
+ fixed_overlay_node->set_offset(wf::origin(output->get_layout_geometry()));
+ wf::scene::add_front(wf::get_core().scene(), fixed_overlay_node);
+ }
+
/* Tries to initialize renderer, activate plugin, etc. */
bool activate()
{
@@ -371,16 +717,11 @@
return false;
}
- wf::get_core().connect(&on_motion_event);
-
render_node = std::make_shared<cube_render_node_t>(this);
- wf::scene::add_front(wf::get_core().scene(), render_node);
+ add_cube_render_node();
output->render->add_effect(&pre_hook, wf::OUTPUT_EFFECT_PRE);
output->render->set_require_depth_buffer(true);
- wf::get_core().hide_cursor();
- input_grab->grab_input(wf::scene::layer::OVERLAY);
-
auto wsize = output->wset()->get_workspace_grid_size();
animation.side_angle = 2 * M_PI / float(wsize.width);
identity_z_offset = 0.5 / std::tan(animation.side_angle / 2);
@@ -418,19 +759,21 @@
output->render->rem_effect(&pre_hook);
output->render->set_require_depth_buffer(false);
- input_grab->ungrab_input();
- output->deactivate_plugin(&grab_interface);
- wf::get_core().unhide_cursor();
- on_motion_event.disconnect();
-
/* Figure out how much we have rotated and switch workspace */
int size = get_num_faces();
int dvx = calculate_viewport_dx_from_rotation();
- auto cws = output->wset()->get_current_workspace();
+ auto cws = workspace_animation_anchor.value_or(
+ output->wset()->get_current_workspace());
int nvx = (cws.x + (dvx % size) + size) % size;
output->wset()->set_workspace({nvx, cws.y});
+ fixed_workspace_view = nullptr;
+ workspace_animation_anchor.reset();
+ clear_fixed_workspace_overlay();
+ release_cube_input();
+ output->deactivate_plugin(&grab_interface);
+
/* We are finished with rotation, make sure the next time cube is used
* it is properly reset */
animation.cube_animation.rotation.set(0, 0);
@@ -460,13 +803,36 @@
/* After the rotation is done, we want to exit cube and focus the target
* workspace */
- animation.in_exit = true;
+ animation.in_exit = false;
/* Set up rotation target to the next workspace in the given direction,
* and reset other attribs */
- reset_attribs();
- animation.cube_animation.rotation.restart_with_end(
- animation.cube_animation.rotation.end - dir * animation.side_angle);
+ animation.cube_animation.zoom.set(1.0, 1.0);
+ animation.cube_animation.offset_z.set(
+ identity_z_offset + Z_OFFSET_NEAR,
+ identity_z_offset + Z_OFFSET_NEAR);
+ animation.cube_animation.offset_y.set(0, 0);
+ animation.cube_animation.ease_deformation.set(0, 0);
+ auto cws = output->wset()->get_current_workspace();
+ int size = get_num_faces();
+ int nvx = (cws.x + dir + size) % size;
+ output->wset()->set_workspace({nvx, cws.y});
+ wf::get_core().seat->focus_output(output);
+
+ auto views = output->wset()->get_views(
+ wf::WSET_MAPPED_ONLY | wf::WSET_EXCLUDE_MINIMIZED |
+ wf::WSET_SORT_STACKING, wf::point_t{nvx, cws.y});
+ for (auto it = views.rbegin(); it != views.rend(); ++it)
+ {
+ if ((*it)->is_focusable() && (*it)->get_keyboard_focus_surface())
+ {
+ wf::get_core().default_wm->focus_raise_view(*it, false);
+ break;
+ }
+ }
+ animation.cube_animation.rotation.set(
+ dir * animation.side_angle, dir * animation.side_angle);
+ animation.cube_animation.rotation.restart_with_end(0);
animation.cube_animation.start();
update_view_matrix();
@@ -493,6 +859,14 @@
float current_offset_y = animation.cube_animation.offset_y;
float current_zoom = animation.cube_animation.zoom;
+ grab_cube_input();
+
+ if ((current_rotation > -1e-6) && (current_rotation < 1e-6))
+ {
+ current_rotation = animation.side_angle *
+ wf::clamp((double)resting_yaw, 0.0, 0.5);
+ }
+
animation.cube_animation.rotation.set(current_rotation, current_rotation);
animation.cube_animation.offset_y.set(current_offset_y, current_offset_y);
animation.cube_animation.offset_z.restart_with_end(
@@ -513,19 +887,47 @@
/* Mouse grab was released */
void input_ungrabbed()
{
- animation.in_exit = true;
+ release_cube_input();
+ animation.in_exit = false;
- /* Rotate cube so that selected workspace aligns with the output */
float current_rotation = animation.cube_animation.rotation;
- int dvx = calculate_viewport_dx_from_rotation();
- animation.cube_animation.rotation.set(current_rotation,
- -dvx * animation.side_angle);
- /* And reset other attributes, again to align the workspace with the output
- * */
- reset_attribs();
+ int size = get_num_faces();
+ int dvx = calculate_viewport_dx_from_rotation();
+ auto cws = output->wset()->get_current_workspace();
+ int nvx = (cws.x + (dvx % size) + size) % size;
+ output->wset()->set_workspace({nvx, cws.y});
+ wf::get_core().seat->focus_output(output);
- animation.cube_animation.start();
+ auto views = output->wset()->get_views(
+ wf::WSET_MAPPED_ONLY | wf::WSET_EXCLUDE_MINIMIZED |
+ wf::WSET_SORT_STACKING, wf::point_t{nvx, cws.y});
+ for (auto it = views.rbegin(); it != views.rend(); ++it)
+ {
+ if ((*it)->is_focusable() && (*it)->get_keyboard_focus_surface())
+ {
+ wf::get_core().default_wm->focus_raise_view(*it, false);
+ break;
+ }
+ }
+
+ if (render_node)
+ {
+ wf::scene::remove_child(render_node);
+ render_node = std::make_shared<cube_render_node_t>(this);
+ add_cube_render_node();
+ }
+
+ current_rotation = 0;
+ animation.cube_animation.rotation.set(current_rotation, current_rotation);
+ animation.cube_animation.offset_y.set(0, 0);
+ animation.cube_animation.offset_z.set(
+ identity_z_offset + Z_OFFSET_NEAR,
+ identity_z_offset + Z_OFFSET_NEAR);
+ animation.cube_animation.zoom.set(1.0, 1.0);
+ animation.cube_animation.ease_deformation.set(0, 0);
+
+ animation.cube_animation.start();
update_view_matrix();
output->render->schedule_redraw();
}
@@ -596,7 +998,6 @@
{
int index = (cws.x + i) % get_num_faces();
GL_CALL(glBindTexture(GL_TEXTURE_2D, wf::gles_texture_t::from_aux(buffers[index]).tex_id));
-
auto model = calculate_model_matrix(i);
program.uniformMatrix4f("model", model);
@@ -623,7 +1024,7 @@
}
GL_CALL(glClear(GL_DEPTH_BUFFER_BIT));
- background->render_frame(data.target, animation);
+ /* The fixed output background is scheduled behind the cube. */
auto vp = calculate_vp_matrix(data.target);
@@ -648,6 +1049,8 @@
program.attrib_pointer("position", 2, 0, vertexData);
program.attrib_pointer("uvPosition", 2, 0, coordData);
program.uniformMatrix4f("VP", vp);
+ program.uniform1f("cube_brightness",
+ 1.0 - wf::clamp((double)face_dim, 0.0, 1.0));
if (tessellation_support)
{
program.uniform1i("deform", use_deform);
@@ -660,10 +1063,13 @@
* By using two stages, we ensure that we first render the cube sides
* that are on the back, and then we render those at the front, so we
* don't have to use depth testing and we also can support alpha cube. */
+ GL_CALL(glEnable(GL_BLEND));
+ GL_CALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
GL_CALL(glEnable(GL_CULL_FACE));
render_cube(GL_CCW, buffers);
render_cube(GL_CW, buffers);
GL_CALL(glDisable(GL_CULL_FACE));
+ GL_CALL(glDisable(GL_BLEND));
GL_CALL(glDisable(GL_DEPTH_TEST));
program.deactivate();
@@ -680,6 +1086,16 @@
} else if (animation.in_exit)
{
deactivate();
+ } else {
+ if (fixed_workspace_view)
+ {
+ fixed_workspace_view = nullptr;
+ workspace_animation_anchor.reset();
+ clear_fixed_workspace_overlay();
+ rebuild_cube_render_node();
+ }
+
+ output->render->schedule_redraw();
}
};
@@ -754,8 +1170,83 @@
output->render->schedule_redraw();
}
+ wf::signal::connection_t<wf::input_event_signal<mwlr_keyboard_modifiers_event>>
+ on_modifier_change =
+ [=] (wf::input_event_signal<mwlr_keyboard_modifiers_event> *ev)
+ {
+ (void)ev;
+ auto modifiers = wf::get_core().seat->get_keyboard_modifiers();
+ if ((modifiers & held_window_modifiers) != held_window_modifiers)
+ {
+ clear_post_move_window_dim();
+ }
+ };
+
+ wf::signal::connection_t<wf::input_event_signal<wlr_keyboard_key_event>>
+ on_key_release =
+ [=] (wf::input_event_signal<wlr_keyboard_key_event> *ev)
+ {
+ if (!post_move_dim_view || (ev->event->state != WLR_KEY_RELEASED))
+ {
+ return;
+ }
+
+ auto mod = wf::get_core().seat->modifier_from_keycode(ev->event->keycode);
+ if (mod & held_window_modifiers)
+ {
+ clear_post_move_window_dim();
+ }
+ };
+
+ void clear_if_fixed_view(wayfire_view view)
+ {
+ if ((view == fixed_overlay_view) || (view == post_move_dim_view) ||
+ (view == fixed_workspace_view))
+ {
+ fixed_workspace_view = nullptr;
+ workspace_animation_anchor.reset();
+ clear_post_move_window_dim();
+ clear_fixed_workspace_overlay(false);
+ rebuild_cube_render_node();
+ output->render->schedule_redraw();
+ }
+ }
+
+ wf::signal::connection_t<wf::view_disappeared_signal>
+ on_fixed_view_disappeared = [=] (wf::view_disappeared_signal *ev)
+ {
+ clear_if_fixed_view(ev->view);
+ };
+
+ wf::signal::connection_t<wf::view_set_output_signal>
+ on_fixed_view_set_output = [=] (wf::view_set_output_signal *ev)
+ {
+ if ((ev->view == fixed_overlay_view) || (ev->view == post_move_dim_view) ||
+ (ev->view == fixed_workspace_view))
+ {
+ if (ev->view->get_output() != output)
+ {
+ clear_if_fixed_view(ev->view);
+ }
+ }
+ };
+
+ wf::signal::connection_t<wf::view_geometry_changed_signal>
+ on_view_geometry_changed = [=] (wf::view_geometry_changed_signal *ev)
+ {
+ (void)ev;
+ if (!fixed_workspace_view || !render_node)
+ {
+ return;
+ }
+
+ rebuild_cube_render_node();
+ output->render->schedule_redraw();
+ };
+
void fini() override
{
+ clear_post_move_window_dim();
if (output->is_plugin_active(grab_interface.name))
{
deactivate();
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/cubemap.cpp b/plugins/cube/cubemap.cpp
--- a/plugins/cube/cubemap.cpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/cubemap.cpp 2026-08-16 19:07:42.962288689 -0500
@@ -84,6 +84,12 @@
void wf_cube_background_cubemap::render_frame(const wf::render_target_t& fb,
wf_cube_animation_attribs& attribs)
{
+ render_frame(fb, attribs, true);
+}
+
+void wf_cube_background_cubemap::render_frame(const wf::render_target_t& fb,
+ wf_cube_animation_attribs& attribs, bool follow_cube)
+{
reload_texture();
if (tex == (uint32_t)-1)
@@ -136,13 +142,17 @@
glEnableVertexAttribArray(vertex);
glVertexAttribPointer(vertex, 3, GL_FLOAT, GL_FALSE, 0, 0);
- auto model = glm::rotate(glm::mat4(1.0),
- float(attribs.cube_animation.rotation),
- glm::vec3(0, 1, 0));
-
- glm::vec3 look_at{0.,
- (double)-attribs.cube_animation.offset_y,
- (double)attribs.cube_animation.offset_z};
+ auto model = follow_cube ?
+ glm::rotate(glm::mat4(1.0),
+ float(attribs.cube_animation.rotation),
+ glm::vec3(0, 1, 0)) :
+ glm::mat4(1.0);
+
+ glm::vec3 look_at = follow_cube ?
+ glm::vec3{0.,
+ (double)-attribs.cube_animation.offset_y,
+ (double)attribs.cube_animation.offset_z} :
+ glm::vec3{0., 0., 1.};
auto view = glm::lookAt(glm::vec3(0., 0., 0.), look_at, glm::vec3(0., 1., 0.));
auto vp = wf::gles::output_transform(fb) * attribs.projection * view;
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/cubemap.hpp b/plugins/cube/cubemap.hpp
--- a/plugins/cube/cubemap.hpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/cubemap.hpp 2026-08-16 19:07:42.962288689 -0500
@@ -13,6 +13,8 @@
~wf_cube_background_cubemap();
private:
+ void render_frame(const wf::render_target_t& fb,
+ wf_cube_animation_attribs& attribs, bool follow_cube);
void reload_texture();
void create_program();
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/shaders-3-2.tpp b/plugins/cube/shaders-3-2.tpp
--- a/plugins/cube/shaders-3-2.tpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/shaders-3-2.tpp 2026-08-16 19:07:42.962288689 -0500
@@ -131,7 +131,7 @@
float d = distance(center, lightSource);
float ambient_coeff = pow(clamp(2.0 / d, 0.0, 1.0), 10.0);
- float value = clamp(pow(abs(dot(N, lightNormal)), 1.5), 0.0, 1.0);
+ float value = clamp(pow(max(dot(N, lightNormal), 0.0), 1.5), 0.0, 1.0);
float df = AL * ambient_coeff + DL * value;
colorFactor = vec3(df, df, df);
@@ -160,7 +160,9 @@
layout(location = 0) out highp vec4 outColor;
uniform sampler2D smp;
+uniform highp float cube_brightness;
void main() {
- outColor = vec4(texture(smp, guv).xyz * colorFactor, 1.0);
+ highp vec4 tex = texture(smp, guv);
+ outColor = vec4(tex.xyz * cube_brightness, tex.a);
})";
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/shaders.tpp b/plugins/cube/shaders.tpp
--- a/plugins/cube/shaders.tpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/shaders.tpp 2026-08-16 19:07:42.962288689 -0500
@@ -19,7 +19,9 @@
R"(#version 100
varying highp vec2 uvpos;
uniform sampler2D smp;
+uniform highp float cube_brightness;
void main() {
- gl_FragColor = vec4(texture2D(smp, uvpos).xyz, 1);
+ highp vec4 tex = texture2D(smp, uvpos);
+ gl_FragColor = vec4(tex.xyz * cube_brightness, tex.a);
})";
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/skydome.cpp b/plugins/cube/skydome.cpp
--- a/plugins/cube/skydome.cpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/skydome.cpp 2026-08-16 19:07:42.962288689 -0500
@@ -129,6 +129,12 @@
void wf_cube_background_skydome::render_frame(const wf::render_target_t& fb,
wf_cube_animation_attribs& attribs)
{
+ render_frame(fb, attribs, true);
+}
+
+void wf_cube_background_skydome::render_frame(const wf::render_target_t& fb,
+ wf_cube_animation_attribs& attribs, bool follow_cube)
+{
fill_vertices();
reload_texture();
@@ -143,13 +149,19 @@
wf::gles::bind_render_buffer(fb);
program.use(wf::TEXTURE_TYPE_RGBA);
- auto rotation = glm::rotate(glm::mat4(1.0),
- (float)(attribs.cube_animation.offset_y * 0.5),
- glm::vec3(1., 0., 0.));
-
- auto view = glm::lookAt(glm::vec3(0., 0., 0.),
- glm::vec3(0., 0., -attribs.cube_animation.offset_z),
- glm::vec3(0., 1., 0.));
+ auto rotation = follow_cube ?
+ glm::rotate(glm::mat4(1.0),
+ (float)(attribs.cube_animation.offset_y * 0.5),
+ glm::vec3(1., 0., 0.)) :
+ glm::mat4(1.0);
+
+ auto view = follow_cube ?
+ glm::lookAt(glm::vec3(0., 0., 0.),
+ glm::vec3(0., 0., -attribs.cube_animation.offset_z),
+ glm::vec3(0., 1., 0.)) :
+ glm::lookAt(glm::vec3(0., 0., 0.),
+ glm::vec3(0., 0., -1.),
+ glm::vec3(0., 1., 0.));
auto vp = wf::gles::output_transform(fb) * attribs.projection * view * rotation;
program.uniformMatrix4f("VP", vp);
@@ -158,9 +170,13 @@
program.attrib_pointer("uvPosition", 2, 0, coords.data());
auto cws = output->wset()->get_current_workspace();
- auto model = glm::rotate(glm::mat4(1.0),
- float(attribs.cube_animation.rotation) - cws.x * attribs.side_angle,
- glm::vec3(0, 1, 0));
+ auto model = follow_cube ?
+ glm::rotate(glm::mat4(1.0),
+ float(attribs.cube_animation.rotation) - cws.x * attribs.side_angle,
+ glm::vec3(0, 1, 0)) :
+ glm::rotate(glm::mat4(1.0),
+ float(-cws.x * attribs.side_angle),
+ glm::vec3(0, 1, 0));
program.uniformMatrix4f("model", model);
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/cube/skydome.hpp b/plugins/cube/skydome.hpp
--- a/plugins/cube/skydome.hpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/cube/skydome.hpp 2026-08-16 19:07:42.962288689 -0500
@@ -17,6 +17,8 @@
private:
wf::output_t *output;
+ void render_frame(const wf::render_target_t& fb,
+ wf_cube_animation_attribs& attribs, bool follow_cube);
void load_program();
void fill_vertices();
void reload_texture();
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/vswitch/vswitch.cpp b/plugins/vswitch/vswitch.cpp
--- a/plugins/vswitch/vswitch.cpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/vswitch/vswitch.cpp 2026-08-16 19:07:42.962288689 -0500
@@ -10,6 +10,10 @@
#include "wayfire/unstable/translation-node.hpp"
#include "wayfire/scene-operations.hpp"
#include "wayfire/render-manager.hpp"
+#include <wayfire/view-transform.hpp>
+#include <wayfire/nonstd/wlroots.hpp>
+#include <wlr/types/wlr_keyboard.h>
+#include "../cube/cube-control-signal.hpp"
namespace wf
{
@@ -178,7 +182,7 @@
/**
* Set the overlay view. It will be hidden from the normal workspace layers
* and shown on top of the workspace wall. The overlay view's position is
- * not animated together with the workspace transition, but its alpha is.
+ * not animated together with the workspace transition.
*
* Note: if the view disappears, the caller is responsible for resetting the
* overlay view.
@@ -280,28 +284,12 @@
return;
}
- double progress = animation.progress();
-
auto tmanager = overlay_view->get_transformed_node();
auto tr = tmanager->get_transformer<wf::scene::view_2d_transformer_t>(
vswitch_view_transformer_name);
- static constexpr double smoothing_in = 0.4;
- static constexpr double smoothing_out = 0.2;
- static constexpr double smoothing_amount = 0.5;
-
tmanager->begin_transform_update();
- if (progress <= smoothing_in)
- {
- tr->alpha = 1.0 - (smoothing_amount / smoothing_in) * progress;
- } else if (progress >= 1.0 - smoothing_out)
- {
- tr->alpha = 1.0 - (smoothing_amount / smoothing_out) * (1.0 - progress);
- } else
- {
- tr->alpha = smoothing_amount;
- }
-
+ tr->alpha = 1.0;
tmanager->end_transform_update();
}
@@ -380,6 +368,13 @@
std::unique_ptr<vswitch_basic_plugin> algorithm;
std::unique_ptr<wf::vswitch::control_bindings_t> bindings;
+ wayfire_toplevel_view held_dim_view = nullptr;
+ std::shared_ptr<wf::scene::translation_node_t> held_dim_overlay_node;
+ uint32_t held_dim_modifiers = 0;
+ const std::string held_dim_transformer_name = "workspace-move-window-dim";
+ wf::option_wrapper_t<double> window_move_alpha{"vswitch/window_move_alpha"};
+ static constexpr uint32_t held_window_modifiers =
+ WLR_MODIFIER_CTRL | WLR_MODIFIER_ALT | WLR_MODIFIER_LOGO;
// Capabilities which are always required for vswitch, for now wall needs
// a custom renderer.
@@ -387,7 +382,11 @@
wf::plugin_activation_data_t grab_interface = {
.name = "vswitch",
- .cancel = [=] () { algorithm->stop_switch(false); },
+ .cancel = [=] ()
+ {
+ clear_held_window_dim();
+ algorithm->stop_switch(false);
+ },
};
public:
@@ -395,9 +394,15 @@
{
output->connect(&on_set_workspace_request);
output->connect(&on_grabbed_view_disappear);
+ wf::get_core().connect(&on_key_release);
+ wf::get_core().connect(&on_modifier_change);
algorithm = std::make_unique<vswitch_basic_plugin>(output,
- [=] () { output->deactivate_plugin(&grab_interface); });
+ [=] ()
+ {
+ clear_held_window_dim();
+ output->deactivate_plugin(&grab_interface);
+ });
bindings = std::make_unique<wf::vswitch::control_bindings_t>(output);
bindings->setup([this] (wf::point_t delta, wayfire_toplevel_view view, bool only_view)
@@ -413,6 +418,11 @@
{
if (delta == wf::point_t{0, 0})
{
+ if (view)
+ {
+ show_held_window_dim(view);
+ }
+
// Consume input event
return true;
}
@@ -446,6 +456,91 @@
return is_active() || output->can_activate_plugin(&grab_interface);
}
+ void remove_held_dim_transformers(wayfire_toplevel_view view)
+ {
+ if (!view)
+ {
+ return;
+ }
+
+ auto node = view->get_transformed_node();
+ while (node->get_transformer(held_dim_transformer_name))
+ {
+ node->rem_transformer(held_dim_transformer_name);
+ }
+ }
+
+ void clear_held_window_dim()
+ {
+ if (held_dim_view)
+ {
+ remove_held_dim_transformers(held_dim_view);
+ wf::scene::set_node_enabled(held_dim_view->get_transformed_node(), true);
+ }
+
+ if (held_dim_overlay_node)
+ {
+ wf::scene::remove_child(held_dim_overlay_node);
+ held_dim_overlay_node = nullptr;
+ }
+
+ held_dim_view = nullptr;
+ held_dim_modifiers = 0;
+ }
+
+ wayfire_toplevel_view get_held_window_target_view()
+ {
+ auto view = find_topmost_parent(
+ toplevel_cast(wf::get_core().seat->get_active_view()));
+ if (!view || (view->role != wf::VIEW_ROLE_TOPLEVEL))
+ {
+ return nullptr;
+ }
+
+ return view;
+ }
+
+ void show_held_window_dim(wayfire_toplevel_view view)
+ {
+ if (!view || (view->role != wf::VIEW_ROLE_TOPLEVEL) || !view->is_mapped())
+ {
+ clear_held_window_dim();
+ return;
+ }
+
+ if (view->get_output() != output)
+ {
+ clear_held_window_dim();
+ return;
+ }
+
+ if (held_dim_view == view)
+ {
+ return;
+ }
+
+ clear_held_window_dim();
+
+ auto transformer = std::make_shared<wf::scene::view_2d_transformer_t>(view);
+ transformer->alpha = wf::clamp((double)window_move_alpha, 0.0, 1.0);
+ remove_held_dim_transformers(view);
+ view->get_transformed_node()->add_transformer(transformer,
+ wf::TRANSFORMER_2D, held_dim_transformer_name);
+ wf::scene::set_node_enabled(view->get_transformed_node(), false);
+
+ auto overlay = std::make_shared<wf::vswitch::vswitch_overlay_node_t>(view);
+ held_dim_overlay_node =
+ std::make_shared<wf::scene::translation_node_t>();
+ held_dim_overlay_node->set_children_list({overlay});
+ held_dim_overlay_node->set_offset(wf::origin(output->get_layout_geometry()));
+ wf::scene::add_front(wf::get_core().scene(), held_dim_overlay_node);
+
+ held_dim_view = view;
+ held_dim_modifiers = wf::get_core().seat->get_keyboard_modifiers();
+ wf::scene::damage_node(held_dim_overlay_node,
+ held_dim_overlay_node->get_bounding_box());
+ }
+
/**
* Check if we can switch the plugin capabilities.
* This makes sense only if the plugin is already active, otherwise,
@@ -486,12 +581,62 @@
bool add_direction(wf::point_t delta, wayfire_view view = nullptr)
{
- if (!is_active() && !start_switch())
+ auto cws = output->wset()->get_current_workspace();
+ auto grid = output->wset()->get_workspace_grid_size();
+ auto target_ws = cws + delta;
+ target_ws.x = (target_ws.x % grid.width + grid.width) % grid.width;
+ target_ws.y = (target_ws.y % grid.height + grid.height) % grid.height;
+ auto animation_delta = target_ws - cws;
+ if (animation_delta.x > grid.width / 2)
{
- return false;
+ animation_delta.x -= grid.width;
+ } else if (animation_delta.x < -grid.width / 2)
+ {
+ animation_delta.x += grid.width;
}
- if (view && ((view->role != wf::VIEW_ROLE_TOPLEVEL) || !view->is_mapped()))
+ if (animation_delta.y > grid.height / 2)
+ {
+ animation_delta.y -= grid.height;
+ } else if (animation_delta.y < -grid.height / 2)
+ {
+ animation_delta.y += grid.height;
+ }
+
+ wayfire_toplevel_view fixed_view = nullptr;
+ if (view && (view->role == wf::VIEW_ROLE_TOPLEVEL) && view->is_mapped() &&
+ (view->get_output() == output))
+ {
+ fixed_view = toplevel_cast(view);
+ }
+
+ if (!is_active())
+ {
+ if (fixed_view)
+ {
+ clear_held_window_dim();
+ wf::vswitch::move_view(fixed_view, target_ws);
+ output->wset()->set_workspace(target_ws);
+ wf::get_core().seat->focus_view(view);
+
+ cube_workspace_animation_signal ev;
+ ev.delta = animation_delta;
+ ev.anchor_workspace = cws;
+ ev.fixed_view = fixed_view;
+ output->emit(&ev);
+ return true;
+ }
+
+ output->wset()->set_workspace(target_ws);
+ cube_workspace_animation_signal ev;
+ ev.delta = animation_delta;
+ ev.anchor_workspace = cws;
+ ev.fixed_view = nullptr;
+ output->emit(&ev);
+ return true;
+ }
+
+ if (!fixed_view)
{
view = nullptr;
}
@@ -506,12 +651,47 @@
wf::signal::connection_t<wf::view_disappeared_signal> on_grabbed_view_disappear =
[=] (wf::view_disappeared_signal *ev)
{
+ if (ev->view == held_dim_view)
+ {
+ clear_held_window_dim();
+ }
+
if (ev->view == algorithm->get_overlay_view())
{
algorithm->set_overlay_view(nullptr);
}
};
+ wf::signal::connection_t<wf::input_event_signal<mwlr_keyboard_modifiers_event>>
+ on_modifier_change =
+ [=] (wf::input_event_signal<mwlr_keyboard_modifiers_event> *ev)
+ {
+ (void)ev;
+ auto modifiers = wf::get_core().seat->get_keyboard_modifiers();
+ if ((modifiers & held_window_modifiers) == held_window_modifiers)
+ {
+ show_held_window_dim(get_held_window_target_view());
+ } else if (held_dim_view)
+ {
+ clear_held_window_dim();
+ }
+ };
+
+ wf::signal::connection_t<wf::input_event_signal<wlr_keyboard_key_event>> on_key_release =
+ [=] (wf::input_event_signal<wlr_keyboard_key_event> *ev)
+ {
+ if (!held_dim_view || (ev->event->state != WLR_KEY_RELEASED))
+ {
+ return;
+ }
+
+ auto mod = wf::get_core().seat->modifier_from_keycode(ev->event->keycode);
+ if (mod & held_dim_modifiers)
+ {
+ clear_held_window_dim();
+ }
+ };
+
wf::signal::connection_t<wf::workspace_change_request_signal> on_set_workspace_request =
[=] (wf::workspace_change_request_signal *ev)
{
@@ -523,6 +703,15 @@
return;
}
+ if (!ev->fixed_views.empty())
+ {
+ cube_workspace_animation_signal cube_ev;
+ cube_ev.delta = ev->new_viewport - ev->old_viewport;
+ cube_ev.anchor_workspace = ev->old_viewport;
+ cube_ev.fixed_view = ev->fixed_views[0];
+ output->emit(&cube_ev);
+ }
+
if (is_active())
{
ev->carried_out = add_direction(ev->new_viewport - ev->old_viewport);
@@ -556,6 +745,7 @@
void fini()
{
+ clear_held_window_dim();
if (is_active())
{
algorithm->stop_switch(false);
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/plugins/vswitch/wayfire/plugins/vswitch.hpp b/plugins/vswitch/wayfire/plugins/vswitch.hpp
--- a/plugins/vswitch/wayfire/plugins/vswitch.hpp 2026-07-27 03:26:17.000000000 -0500
+++ b/plugins/vswitch/wayfire/plugins/vswitch.hpp 2026-08-16 19:07:42.962288689 -0500
@@ -102,6 +102,8 @@
SETUP4(with_win, get_target_view(), false);
SETUP4(send_win, get_target_view(), true);
+ SETUP(with_win_modifier, 0, 0, get_target_view(), false);
+
#undef SETUP4
#undef SETUP
/* *INDENT-ON* */
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/src/api/wayfire/workspace-stream.hpp b/src/api/wayfire/workspace-stream.hpp
--- a/src/api/wayfire/workspace-stream.hpp 2026-07-27 03:26:17.000000000 -0500
+++ b/src/api/wayfire/workspace-stream.hpp 2026-08-16 19:07:42.963288695 -0500
@@ -21,6 +21,14 @@
// of Wayfire is used.
std::optional<wf::color_t> background;
+ // Whether desktop environment views, such as wallpapers and panels,
+ // should be included in the workspace stream.
+ bool include_desktop_environment = true;
+
+ // Whether regular workspace views should be included in the workspace
+ // stream.
+ bool include_workspace_views = true;
+
wf::output_t*const output;
const wf::point_t ws;
diff -ruN '--exclude=*.orig' '--exclude=*.rej' '--exclude=build' a/src/output/workspace-stream.cpp b/src/output/workspace-stream.cpp
--- a/src/output/workspace-stream.cpp 2026-07-27 03:26:17.000000000 -0500
+++ b/src/output/workspace-stream.cpp 2026-08-16 19:07:42.963288695 -0500
@@ -56,6 +56,16 @@
const bool is_de = (view && (view->role == wf::VIEW_ROLE_DESKTOP_ENVIRONMENT));
size_t num_generated = this->instances.size();
+ if (is_de && !self->include_desktop_environment)
+ {
+ continue;
+ }
+
+ if (!is_de && !self->include_workspace_views)
+ {
+ continue;
+ }
+
// We push the damage as-is for desktop environment views, because they are visible on
// every workspace.
ch->gen_render_instances(this->instances,
|