1919import meteordevelopment .meteorclient .systems .modules .Module ;
2020import meteordevelopment .meteorclient .systems .modules .Modules ;
2121import meteordevelopment .meteorclient .utils .misc .NbtUtils ;
22+ import net .minecraft .client .input .KeyInput ;
23+ import net .minecraft .client .util .MacWindowUtil ;
2224import net .minecraft .item .Items ;
2325import net .minecraft .util .Pair ;
2426
2830
2931import static meteordevelopment .meteorclient .utils .Utils .getWindowHeight ;
3032import static meteordevelopment .meteorclient .utils .Utils .getWindowWidth ;
33+ import static org .lwjgl .glfw .GLFW .*;
3134
3235public class ModulesScreen extends TabScreen {
3336 private WCategoryController controller ;
37+ private WWindow searchWindow ;
38+ private WTextBox searchTextBox ;
3439
3540 public ModulesScreen (GuiTheme theme ) {
3641 super (theme , Tabs .get ().getFirst ());
@@ -115,6 +120,7 @@ protected void createSearchW(WContainer w, String text) {
115120 protected WWindow createSearch (WContainer c ) {
116121 WWindow w = theme .window ("Search" );
117122 w .id = "search" ;
123+ searchWindow = w ;
118124
119125 if (theme .categoryIcons ()) {
120126 w .beforeHeaderInit = wContainer -> wContainer .add (theme .item (Items .COMPASS .getDefaultStack ())).pad (2 );
@@ -129,6 +135,7 @@ protected WWindow createSearch(WContainer c) {
129135
130136 WTextBox text = w .add (theme .textBox ("" )).minWidth (140 ).expandX ().widget ();
131137 text .setFocused (true );
138+ searchTextBox = text ;
132139 text .action = () -> {
133140 l .clear ();
134141 createSearchW (l , text .get ());
@@ -140,6 +147,25 @@ protected WWindow createSearch(WContainer c) {
140147 return w ;
141148 }
142149
150+ @ Override
151+ public boolean keyPressed (KeyInput value ) {
152+ if (locked ) return false ;
153+
154+ boolean cntrl = MacWindowUtil .IS_MAC ? value .modifiers () == GLFW_MOD_SUPER : value .modifiers () == GLFW_MOD_CONTROL ;
155+
156+ if (cntrl && value .key () == GLFW_KEY_F ) {
157+ if (searchWindow != null ) searchWindow .setExpanded (true );
158+ if (searchTextBox != null ) {
159+ searchTextBox .setFocused (true );
160+ searchTextBox .setCursorMax ();
161+ }
162+
163+ return true ;
164+ }
165+
166+ return super .keyPressed (value );
167+ }
168+
143169 // Favorites
144170
145171 protected Cell <WWindow > createFavorites (WContainer c ) {
@@ -193,7 +219,8 @@ public boolean fromClipboard() {
193219 }
194220
195221 @ Override
196- public void reload () {}
222+ public void reload () {
223+ }
197224
198225 // Stuff
199226
@@ -227,8 +254,7 @@ protected void refresh() {
227254 if (favorites == null ) {
228255 favorites = createFavorites (this );
229256 if (favorites != null ) windows .add (favorites .widget ());
230- }
231- else {
257+ } else {
232258 favorites .widget ().clear ();
233259
234260 if (!createFavoritesW (favorites .widget ())) {
0 commit comments