homescreens: only close search widget and action drawer without opening the menu

This commit is contained in:
Yari Polla 2022-09-27 17:25:43 +02:00 committed by Devin Lin
parent 838826b4fd
commit f03cf4aa68
2 changed files with 30 additions and 24 deletions

View file

@ -40,22 +40,25 @@ MobileShell.HomeScreen {
forceActiveFocus(); forceActiveFocus();
} }
Plasmoid.onActivated: { Plasmoid.onActivated: {
// Always close action drawer
if (MobileShell.TopPanelControls.actionDrawerVisible) {
MobileShell.TopPanelControls.closeActionDrawer();
}
// Always close the search widget as well
if (searchWidget.isOpen) {
searchWidget.close();
}
// there's a couple of steps: // there's a couple of steps:
// - minimize windows (only if we are in an app) // - minimize windows (only if we are in an app)
// - open app drawer // - open app drawer
// - close app drawer and, if necessary, restore windows // - close app drawer and, if necessary, restore windows
if (!plasmoid.nativeInterface.showingDesktop && !MobileShell.HomeScreenControls.homeScreenVisible) { if (!plasmoid.nativeInterface.showingDesktop && !MobileShell.HomeScreenControls.homeScreenVisible
|| MobileShell.TopPanelControls.actionDrawerVisible
|| searchWidget.isOpen
) {
// Always close action drawer
if (MobileShell.TopPanelControls.actionDrawerVisible) {
MobileShell.TopPanelControls.closeActionDrawer();
}
// Always close the search widget as well
if (searchWidget.isOpen) {
searchWidget.close();
}
plasmoid.nativeInterface.showingDesktop = true; plasmoid.nativeInterface.showingDesktop = true;
} else if (homescreen.homeScreenState.currentView === HomeScreenState.PageView) { } else if (homescreen.homeScreenState.currentView === HomeScreenState.PageView) {
homescreen.homeScreenState.openAppDrawer(); homescreen.homeScreenState.openAppDrawer();

View file

@ -39,22 +39,25 @@ MobileShell.HomeScreen {
} }
} }
Plasmoid.onActivated: { Plasmoid.onActivated: {
// Always close action drawer
if (MobileShell.TopPanelControls.actionDrawerVisible) {
MobileShell.TopPanelControls.closeActionDrawer();
}
// Always close the search widget as well
if (search.isOpen) {
search.close();
}
// there's a couple of steps: // there's a couple of steps:
// - minimize windows (only if we are in an app) // - minimize windows (only if we are in an app)
// - open app drawer // - open app drawer
// - close app drawer and, if necessary, restore windows // - close app drawer and, if necessary, restore windows
if (!plasmoid.nativeInterface.showingDesktop && !MobileShell.HomeScreenControls.homeScreenVisible) { if (!plasmoid.nativeInterface.showingDesktop && !MobileShell.HomeScreenControls.homeScreenVisible
|| MobileShell.TopPanelControls.actionDrawerVisible
|| search.isOpen
) {
// Always close action drawer
if (MobileShell.TopPanelControls.actionDrawerVisible) {
MobileShell.TopPanelControls.closeActionDrawer();
}
// Always close the search widget as well
if (search.isOpen) {
search.close();
}
plasmoid.nativeInterface.showingDesktop = true; plasmoid.nativeInterface.showingDesktop = true;
} else if (homescreen.page == 0) { } else if (homescreen.page == 0) {
homescreen.page = 1; homescreen.page = 1;