@@ -98,17 +98,6 @@ FocusScope {
9898 }
9999 }
100100
101− onCurrentFocusedAppIdChanged: {
102− // If any app is focused when greeter is open, it's due to a user action
103− // like a snap decision (say, an incoming call).
104− // TODO: this should be protected to only unlock for certain applications / certain usecases
105− // potentially only in connection with a notification.
106− if (greeter.shown && currentFocusedAppId) {
107− greeter.hide()
108− }
109− hud.hide()
110− }
111−
112101 function activateApplication(desktopFile, argument) {
113102 if (applicationManager) {
114103 // For newly started applications, as it takes them time to draw their first frame
@@ -476,17 +465,17 @@ FocusScope {
476465
477466 function setFocused(focused) {
478467 if (!focused) {
479− previousMainApp = applicationManager.mainStageFocusedApplication;
480− previousSideApp = applicationManager.sideStageFocusedApplication;
468+ greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
469+ greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
481470 applicationManager.unfocusCurrentApplication();
482471 } else {
483− if (previousMainApp) {
484− applicationManager.focusApplication(previousMainApp);
485− previousMainApp = null;
472+ if (greeter.previousMainApp) {
473+ applicationManager.focusApplication(greeter.previousMainApp);
474+ greeter.previousMainApp = null;
486475 }
487− if (previousSideApp) {
488− applicationManager.focusApplication(previousSideApp);
489− previousSideApp = null;
476+ if (greeter.previousSideApp) {
477+ applicationManager.focusApplication(greeter.previousSideApp);
478+ greeter.previousSideApp = null;
490479 }
491480 }
492481 }
@@ -520,6 +509,29 @@ FocusScope {
520509 launcher.tease();
521510 }
522511 }
512+
513+ Connections {
514+ target: applicationManager
515+ ignoreUnknownSignals: true
516+ // If any app is focused when greeter is open, it's due to a user action
517+ // like a snap decision (say, an incoming call).
518+ // TODO: these should be protected to only unlock for certain applications / certain usecases
519+ // potentially only in connection with a notification.
520+ onMainStageFocusedApplicationChanged: {
521+ if (greeter.shown && applicationManager.mainStageFocusedApplication) {
522+ greeter.previousMainApp = null // make way for new focused app
523+ greeter.previousSideApp = null
524+ greeter.hide()
525+ }
526+ }
527+ onSideStageFocusedApplicationChanged: {
528+ if (greeter.shown && applicationManager.sideStageFocusedApplication) {
529+ greeter.previousMainApp = null // make way for new focused app
530+ greeter.previousSideApp = null
531+ greeter.hide()
532+ }
533+ }
534+ }
523535 }
524536
525537 InputFilterArea {
@@ -597,6 +609,12 @@ FocusScope {
597609 shown: false
598610 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
599611 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
612+
613+ Connections {
614+ target: shell.applicationManager
615+ onMainStageFocusedApplicationChanged: hud.hide()
616+ onSideStageFocusedApplicationChanged: hud.hide()
617+ }
600618 }
601619
602620 Revealer {