@@ -38,16 +38,36 @@ Ui::Child appIcon(MenuIcon const &icon, isize size = 22) {
38
38
});
39
39
}
40
40
41
- Ui::Child appRow (MenuEntry const &entry) {
42
- return Ui::button (
43
- Ui::NOP,
44
- Ui::ButtonStyle::subtle (),
45
- Ui::hflow (
46
- 12 ,
47
- Layout::Align::START | Layout::Align::VCENTER,
48
- appIcon (entry.icon ),
49
- Ui::labelLarge (entry.name )) |
50
- Ui::spacing (6 ));
41
+ Ui::Child appRow (MenuEntry const &entry, usize i) {
42
+ return Ui::ButtonStyle::subtle (),
43
+ Ui::hflow (
44
+ 12 ,
45
+ Layout::Align::START | Layout::Align::VCENTER,
46
+ appIcon (entry.icon ),
47
+ Ui::labelLarge (entry.name )) |
48
+ Ui::spacing (6 ) | Ui::button (Model::bind<StartApp>(i), Ui::ButtonStyle::subtle ());
49
+ }
50
+
51
+ Ui::Child runningApp (Surface const &surface, usize i) {
52
+ return Ui::stack (
53
+ appIcon (surface.entry .icon ) |
54
+ Ui::bound () |
55
+ Ui::button (Model::bind<FocusApp>(i)),
56
+ Ui::button (Model::bind<CloseApp>(i), Ui::ButtonStyle::secondary (), Mdi::CLOSE) |
57
+ Ui::align (Layout::Align::TOP_END) |
58
+ Ui::spacing ({0 , 6 , 6 , 0 })) |
59
+ Ui::pinSize ({120 , 192 });
60
+ }
61
+
62
+ Ui::Child runningApps (State const &state) {
63
+ if (state.surfaces .len () == 0 )
64
+ return Ui::empty (64 );
65
+ return Ui::hflow (
66
+ 8 ,
67
+ iter (state.surfaces )
68
+ .mapi (runningApp)
69
+ .collect <Ui::Children>()) |
70
+ Ui::center () | Ui::spacing ({0 , 64 , 0 , 16 });
51
71
}
52
72
53
73
Ui::Child apps (Ui::Children apps) {
@@ -66,7 +86,7 @@ Ui::Child apps(Ui::Children apps) {
66
86
Ui::Child appsList (State const &state) {
67
87
return apps (
68
88
iter (state.entries )
69
- .map (appRow)
89
+ .mapi (appRow)
70
90
.collect <Ui::Children>());
71
91
}
72
92
@@ -76,22 +96,24 @@ Ui::Child appsPanel(State const &state) {
76
96
77
97
Ui::Child appsFlyout (State const &state) {
78
98
return Ui::vflow (
79
- Ui::dragHandle (),
80
- appsList (state) | Ui::grow ()) |
81
- Ui::box ({
82
- .margin = {8 , 8 + 64 , 8 , 8 },
83
- .padding = {12 , 0 },
84
- .borderRadius = 8 ,
85
- .borderWidth = 1 ,
86
- .borderPaint = Ui::GRAY800,
87
- .backgroundPaint = Ui::GRAY950,
88
- }) |
89
- Ui::bound () |
90
- Ui::dismisable (
91
- Model::bind<Activate>(Panel::NIL),
92
- Ui::DismisDir::DOWN,
93
- 0.3 ) |
94
- Ui::slideIn (Ui::SlideFrom::BOTTOM);
99
+ runningApps (state),
100
+ Ui::vflow (
101
+ Ui::dragHandle (),
102
+ appsList (state) | Ui::grow ()) |
103
+ Ui::box ({
104
+ .margin = {8 , 8 , 8 , 8 },
105
+ .padding = {12 , 0 },
106
+ .borderRadius = 8 ,
107
+ .borderWidth = 1 ,
108
+ .borderPaint = Ui::GRAY800,
109
+ .backgroundPaint = Ui::GRAY950,
110
+ }) |
111
+ Ui::bound () |
112
+ Ui::dismisable (
113
+ Model::bind<Activate>(Panel::NIL),
114
+ Ui::DismisDir::DOWN,
115
+ 0.3 ) |
116
+ Ui::slideIn (Ui::SlideFrom::BOTTOM) | Ui::grow ());
95
117
}
96
118
97
119
} // namespace Shell
0 commit comments