mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
niri: fix exit anims on overview launcher
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Spotlight
|
import qs.Modals.Spotlight
|
||||||
import qs.Modules.AppDrawer
|
import qs.Modules.AppDrawer
|
||||||
@@ -17,33 +16,33 @@ Item {
|
|||||||
|
|
||||||
function resetScroll() {
|
function resetScroll() {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
resultsView.resetScroll()
|
resultsView.resetScroll();
|
||||||
} else {
|
} else {
|
||||||
fileSearchResults.resetScroll()
|
fileSearchResults.resetScroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSearchMode() {
|
function updateSearchMode() {
|
||||||
if (searchField.text.startsWith("/")) {
|
if (searchField.text.startsWith("/")) {
|
||||||
if (searchMode !== "files") {
|
if (searchMode !== "files") {
|
||||||
searchMode = "files"
|
searchMode = "files";
|
||||||
}
|
}
|
||||||
const query = searchField.text.substring(1)
|
const query = searchField.text.substring(1);
|
||||||
fileSearchController.searchQuery = query
|
fileSearchController.searchQuery = query;
|
||||||
} else {
|
} else {
|
||||||
if (searchMode !== "apps") {
|
if (searchMode !== "apps") {
|
||||||
searchMode = "apps"
|
searchMode = "apps";
|
||||||
fileSearchController.reset()
|
fileSearchController.reset();
|
||||||
appLauncher.searchQuery = searchField.text
|
appLauncher.searchQuery = searchField.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchModeChanged: {
|
onSearchModeChanged: {
|
||||||
if (searchMode === "files") {
|
if (searchMode === "files") {
|
||||||
appLauncher.keyboardNavigationActive = false
|
appLauncher.keyboardNavigationActive = false;
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.keyboardNavigationActive = false
|
fileSearchController.keyboardNavigationActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,104 +50,104 @@ Item {
|
|||||||
focus: true
|
focus: true
|
||||||
clip: false
|
clip: false
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide()
|
parentModal.hide();
|
||||||
|
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Down) {
|
} else if (event.key === Qt.Key_Down) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.selectNext()
|
appLauncher.selectNext();
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectNext()
|
fileSearchController.selectNext();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Up) {
|
} else if (event.key === Qt.Key_Up) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.selectPrevious()
|
appLauncher.selectPrevious();
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectPrevious()
|
fileSearchController.selectPrevious();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Right && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
} else if (event.key === Qt.Key_Right && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectNextInRow()
|
appLauncher.selectNextInRow();
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Left && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
} else if (event.key === Qt.Key_Left && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectPreviousInRow()
|
appLauncher.selectPreviousInRow();
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key == Qt.Key_J && event.modifiers & Qt.ControlModifier) {
|
} else if (event.key == Qt.Key_J && event.modifiers & Qt.ControlModifier) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.selectNext()
|
appLauncher.selectNext();
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectNext()
|
fileSearchController.selectNext();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key == Qt.Key_K && event.modifiers & Qt.ControlModifier) {
|
} else if (event.key == Qt.Key_K && event.modifiers & Qt.ControlModifier) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.selectPrevious()
|
appLauncher.selectPrevious();
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectPrevious()
|
fileSearchController.selectPrevious();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key == Qt.Key_L && event.modifiers & Qt.ControlModifier && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
} else if (event.key == Qt.Key_L && event.modifiers & Qt.ControlModifier && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectNextInRow()
|
appLauncher.selectNextInRow();
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key == Qt.Key_H && event.modifiers & Qt.ControlModifier && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
} else if (event.key == Qt.Key_H && event.modifiers & Qt.ControlModifier && searchMode === "apps" && appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectPreviousInRow()
|
appLauncher.selectPreviousInRow();
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Tab) {
|
} else if (event.key === Qt.Key_Tab) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
if (appLauncher.viewMode === "grid") {
|
if (appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectNextInRow()
|
appLauncher.selectNextInRow();
|
||||||
} else {
|
} else {
|
||||||
appLauncher.selectNext()
|
appLauncher.selectNext();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectNext()
|
fileSearchController.selectNext();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Backtab) {
|
} else if (event.key === Qt.Key_Backtab) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
if (appLauncher.viewMode === "grid") {
|
if (appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectPreviousInRow()
|
appLauncher.selectPreviousInRow();
|
||||||
} else {
|
} else {
|
||||||
appLauncher.selectPrevious()
|
appLauncher.selectPrevious();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectPrevious()
|
fileSearchController.selectPrevious();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_N && event.modifiers & Qt.ControlModifier) {
|
} else if (event.key === Qt.Key_N && event.modifiers & Qt.ControlModifier) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
if (appLauncher.viewMode === "grid") {
|
if (appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectNextInRow()
|
appLauncher.selectNextInRow();
|
||||||
} else {
|
} else {
|
||||||
appLauncher.selectNext()
|
appLauncher.selectNext();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectNext()
|
fileSearchController.selectNext();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_P && event.modifiers & Qt.ControlModifier) {
|
} else if (event.key === Qt.Key_P && event.modifiers & Qt.ControlModifier) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
if (appLauncher.viewMode === "grid") {
|
if (appLauncher.viewMode === "grid") {
|
||||||
appLauncher.selectPreviousInRow()
|
appLauncher.selectPreviousInRow();
|
||||||
} else {
|
} else {
|
||||||
appLauncher.selectPrevious()
|
appLauncher.selectPrevious();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileSearchController.selectPrevious()
|
fileSearchController.selectPrevious();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.launchSelected()
|
appLauncher.launchSelected();
|
||||||
} else if (searchMode === "files") {
|
} else if (searchMode === "files") {
|
||||||
fileSearchController.openSelected()
|
fileSearchController.openSelected();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLauncher {
|
AppLauncher {
|
||||||
id: appLauncher
|
id: appLauncher
|
||||||
@@ -156,29 +155,27 @@ Item {
|
|||||||
viewMode: SettingsData.spotlightModalViewMode
|
viewMode: SettingsData.spotlightModalViewMode
|
||||||
gridColumns: SettingsData.appLauncherGridColumns
|
gridColumns: SettingsData.appLauncherGridColumns
|
||||||
onAppLaunched: () => {
|
onAppLaunched: () => {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide()
|
parentModal.hide();
|
||||||
|
if (SettingsData.spotlightCloseNiriOverview && NiriService.inOverview) {
|
||||||
if (SettingsData.spotlightCloseNiriOverview && NiriService.inOverview) {
|
NiriService.toggleOverview();
|
||||||
NiriService.toggleOverview()
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
onViewModeSelected: mode => {
|
onViewModeSelected: mode => {
|
||||||
SettingsData.set("spotlightModalViewMode", mode)
|
SettingsData.set("spotlightModalViewMode", mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSearchController {
|
FileSearchController {
|
||||||
id: fileSearchController
|
id: fileSearchController
|
||||||
|
|
||||||
onFileOpened: () => {
|
onFileOpened: () => {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide()
|
parentModal.hide();
|
||||||
|
if (SettingsData.spotlightCloseNiriOverview && NiriService.inOverview) {
|
||||||
if (SettingsData.spotlightCloseNiriOverview && NiriService.inOverview) {
|
NiriService.toggleOverview();
|
||||||
NiriService.toggleOverview()
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -216,34 +213,33 @@ Item {
|
|||||||
keyForwardTargets: [spotlightKeyHandler]
|
keyForwardTargets: [spotlightKeyHandler]
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
appLauncher.searchQuery = text
|
appLauncher.searchQuery = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTextEdited: {
|
onTextEdited: {
|
||||||
updateSearchMode()
|
updateSearchMode();
|
||||||
}
|
}
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide()
|
parentModal.hide();
|
||||||
|
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length > 0) {
|
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length > 0) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
if (appLauncher.keyboardNavigationActive && appLauncher.model.count > 0)
|
if (appLauncher.keyboardNavigationActive && appLauncher.model.count > 0)
|
||||||
appLauncher.launchSelected()
|
appLauncher.launchSelected();
|
||||||
else if (appLauncher.model.count > 0)
|
else if (appLauncher.model.count > 0)
|
||||||
appLauncher.launchApp(appLauncher.model.get(0))
|
appLauncher.launchApp(appLauncher.model.get(0));
|
||||||
} else if (searchMode === "files") {
|
} else if (searchMode === "files") {
|
||||||
if (fileSearchController.model.count > 0)
|
if (fileSearchController.model.count > 0)
|
||||||
fileSearchController.openSelected()
|
fileSearchController.openSelected();
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Tab || event.key
|
} else if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) {
|
||||||
=== Qt.Key_Backtab || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) {
|
event.accepted = false;
|
||||||
event.accepted = false
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -271,8 +267,8 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
appLauncher.setViewMode("list")
|
appLauncher.setViewMode("list");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,8 +292,8 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
appLauncher.setViewMode("grid")
|
appLauncher.setViewMode("grid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,22 +325,22 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
fileSearchController.searchField = "filename"
|
fileSearchController.searchField = "filename";
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
filenameTooltipLoader.active = true
|
filenameTooltipLoader.active = true;
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (filenameTooltipLoader.item) {
|
if (filenameTooltipLoader.item) {
|
||||||
const p = mapToItem(null, width / 2, height + Theme.spacingXS)
|
const p = mapToItem(null, width / 2, height + Theme.spacingXS);
|
||||||
filenameTooltipLoader.item.show(I18n.tr("Search filenames"), p.x, p.y, null)
|
filenameTooltipLoader.item.show(I18n.tr("Search filenames"), p.x, p.y, null);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
if (filenameTooltipLoader.item)
|
if (filenameTooltipLoader.item)
|
||||||
filenameTooltipLoader.item.hide()
|
filenameTooltipLoader.item.hide();
|
||||||
|
|
||||||
filenameTooltipLoader.active = false
|
filenameTooltipLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,22 +367,22 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
fileSearchController.searchField = "body"
|
fileSearchController.searchField = "body";
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
contentTooltipLoader.active = true
|
contentTooltipLoader.active = true;
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (contentTooltipLoader.item) {
|
if (contentTooltipLoader.item) {
|
||||||
const p = mapToItem(null, width / 2, height + Theme.spacingXS)
|
const p = mapToItem(null, width / 2, height + Theme.spacingXS);
|
||||||
contentTooltipLoader.item.show(I18n.tr("Search file contents"), p.x, p.y, null)
|
contentTooltipLoader.item.show(I18n.tr("Search file contents"), p.x, p.y, null);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
if (contentTooltipLoader.item)
|
if (contentTooltipLoader.item)
|
||||||
contentTooltipLoader.item.hide()
|
contentTooltipLoader.item.hide();
|
||||||
|
|
||||||
contentTooltipLoader.active = false
|
contentTooltipLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,8 +422,8 @@ Item {
|
|||||||
visible: contextMenu.visible
|
visible: contextMenu.visible
|
||||||
z: 999
|
z: 999
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
contextMenu.hide()
|
contextMenu.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
||||||
|
|||||||
@@ -11,48 +11,65 @@ Scope {
|
|||||||
|
|
||||||
property bool searchActive: false
|
property bool searchActive: false
|
||||||
property string searchActiveScreen: ""
|
property string searchActiveScreen: ""
|
||||||
property bool overlayActive: NiriService.inOverview && !(PopoutService.spotlightModal?.spotlightOpen ?? false)
|
property bool isClosing: false
|
||||||
|
property bool overlayActive: (NiriService.inOverview && !(PopoutService.spotlightModal?.spotlightOpen ?? false)) || searchActive
|
||||||
|
|
||||||
function showSpotlight(screenName) {
|
function showSpotlight(screenName) {
|
||||||
searchActive = true
|
isClosing = false;
|
||||||
searchActiveScreen = screenName
|
searchActive = true;
|
||||||
|
searchActiveScreen = screenName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSpotlight() {
|
function hideSpotlight() {
|
||||||
searchActive = false
|
if (!searchActive)
|
||||||
searchActiveScreen = ""
|
return;
|
||||||
|
isClosing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function completeHide() {
|
||||||
|
searchActive = false;
|
||||||
|
searchActiveScreen = "";
|
||||||
|
isClosing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: NiriService
|
target: NiriService
|
||||||
function onInOverviewChanged() {
|
function onInOverviewChanged() {
|
||||||
if (!NiriService.inOverview) {
|
if (!NiriService.inOverview) {
|
||||||
hideSpotlight()
|
if (searchActive) {
|
||||||
} else {
|
isClosing = true;
|
||||||
searchActive = false
|
return;
|
||||||
searchActiveScreen = ""
|
}
|
||||||
|
closeOverviewAfterAnim = false;
|
||||||
|
searchActive = false;
|
||||||
|
searchActiveScreen = "";
|
||||||
|
isClosing = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
searchActive = false;
|
||||||
|
searchActiveScreen = "";
|
||||||
|
isClosing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCurrentOutputChanged() {
|
function onCurrentOutputChanged() {
|
||||||
if (NiriService.inOverview && searchActive && searchActiveScreen !== "" && searchActiveScreen !== NiriService.currentOutput) {
|
if (!NiriService.inOverview || !searchActive || searchActiveScreen === "" || searchActiveScreen === NiriService.currentOutput)
|
||||||
hideSpotlight()
|
return;
|
||||||
}
|
hideSpotlight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: PopoutService.spotlightModal
|
target: PopoutService.spotlightModal
|
||||||
function onSpotlightOpenChanged() {
|
function onSpotlightOpenChanged() {
|
||||||
if (PopoutService.spotlightModal?.spotlightOpen && searchActive) {
|
if (!PopoutService.spotlightModal?.spotlightOpen || !searchActive)
|
||||||
hideSpotlight()
|
return;
|
||||||
}
|
hideSpotlight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: niriOverlayLoader
|
id: niriOverlayLoader
|
||||||
active: overlayActive
|
active: overlayActive || isClosing
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
sourceComponent: Variants {
|
sourceComponent: Variants {
|
||||||
@@ -65,29 +82,34 @@ Scope {
|
|||||||
|
|
||||||
readonly property real dpr: CompositorService.getScreenScale(screen)
|
readonly property real dpr: CompositorService.getScreenScale(screen)
|
||||||
readonly property bool isActiveScreen: screen.name === NiriService.currentOutput
|
readonly property bool isActiveScreen: screen.name === NiriService.currentOutput
|
||||||
readonly property bool shouldShowSpotlight: niriOverviewScope.searchActive && screen.name === niriOverviewScope.searchActiveScreen
|
readonly property bool shouldShowSpotlight: niriOverviewScope.searchActive && screen.name === niriOverviewScope.searchActiveScreen && !niriOverviewScope.isClosing
|
||||||
|
readonly property bool isSpotlightScreen: screen.name === niriOverviewScope.searchActiveScreen
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
visible: NiriService.inOverview
|
visible: NiriService.inOverview || niriOverviewScope.isClosing
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
WlrLayershell.namespace: "dms:niri-overview-spotlight"
|
WlrLayershell.namespace: "dms:niri-overview-spotlight"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: {
|
WlrLayershell.keyboardFocus: {
|
||||||
if (!NiriService.inOverview) return WlrKeyboardFocus.None
|
if (!NiriService.inOverview)
|
||||||
if (!isActiveScreen) return WlrKeyboardFocus.None
|
return WlrKeyboardFocus.None;
|
||||||
return WlrKeyboardFocus.Exclusive
|
if (!isActiveScreen)
|
||||||
|
return WlrKeyboardFocus.None;
|
||||||
|
if (niriOverviewScope.isClosing)
|
||||||
|
return WlrKeyboardFocus.None;
|
||||||
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: shouldShowSpotlight ? spotlightContainer : null
|
item: spotlightContainer.visible ? spotlightContainer : null
|
||||||
}
|
}
|
||||||
|
|
||||||
onShouldShowSpotlightChanged: {
|
onShouldShowSpotlightChanged: {
|
||||||
if (!shouldShowSpotlight && isActiveScreen) {
|
if (shouldShowSpotlight || !isActiveScreen)
|
||||||
Qt.callLater(() => keyboardFocusScope.forceActiveFocus())
|
return;
|
||||||
}
|
Qt.callLater(() => keyboardFocusScope.forceActiveFocus());
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
@@ -97,61 +119,62 @@ Scope {
|
|||||||
bottom: true
|
bottom: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: keyboardFocusScope
|
id: keyboardFocusScope
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (!overlayWindow.shouldShowSpotlight) {
|
if (overlayWindow.shouldShowSpotlight || niriOverviewScope.isClosing)
|
||||||
if ([Qt.Key_Escape, Qt.Key_Return].includes(event.key)) {
|
return;
|
||||||
NiriService.toggleOverview()
|
if ([Qt.Key_Escape, Qt.Key_Return].includes(event.key)) {
|
||||||
event.accepted = true
|
NiriService.toggleOverview();
|
||||||
return
|
event.accepted = true;
|
||||||
}
|
return;
|
||||||
|
|
||||||
if (event.key === Qt.Key_Left) {
|
|
||||||
NiriService.moveColumnLeft()
|
|
||||||
event.accepted = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === Qt.Key_Right) {
|
|
||||||
NiriService.moveColumnRight()
|
|
||||||
event.accepted = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === Qt.Key_Up) {
|
|
||||||
NiriService.moveWorkspaceUp()
|
|
||||||
event.accepted = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === Qt.Key_Down) {
|
|
||||||
NiriService.moveWorkspaceDown()
|
|
||||||
event.accepted = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.modifiers & (Qt.ControlModifier | Qt.MetaModifier) || [Qt.Key_Delete, Qt.Key_Backspace].includes(event.key)) {
|
|
||||||
event.accepted = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!event.isAutoRepeat && event.text) {
|
|
||||||
niriOverviewScope.showSpotlight(overlayWindow.screen.name)
|
|
||||||
if (spotlightContent?.searchField) {
|
|
||||||
spotlightContent.searchField.text = event.text.trim()
|
|
||||||
if (spotlightContent.appLauncher) {
|
|
||||||
spotlightContent.appLauncher.searchQuery = event.text.trim()
|
|
||||||
}
|
|
||||||
Qt.callLater(() => spotlightContent.searchField.forceActiveFocus())
|
|
||||||
}
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Left) {
|
||||||
|
NiriService.moveColumnLeft();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Right) {
|
||||||
|
NiriService.moveColumnRight();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Up) {
|
||||||
|
NiriService.moveWorkspaceUp();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Down) {
|
||||||
|
NiriService.moveWorkspaceDown();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.modifiers & (Qt.ControlModifier | Qt.MetaModifier) || [Qt.Key_Delete, Qt.Key_Backspace].includes(event.key)) {
|
||||||
|
event.accepted = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.isAutoRepeat || !event.text)
|
||||||
|
return;
|
||||||
|
if (!spotlightContent?.searchField)
|
||||||
|
return;
|
||||||
|
const trimmedText = event.text.trim();
|
||||||
|
spotlightContainer.waitingForResults = true;
|
||||||
|
spotlightContent.searchField.text = trimmedText;
|
||||||
|
if (spotlightContent.appLauncher) {
|
||||||
|
spotlightContent.appLauncher.searchQuery = trimmedText;
|
||||||
|
}
|
||||||
|
niriOverviewScope.showSpotlight(overlayWindow.screen.name);
|
||||||
|
Qt.callLater(() => spotlightContent.searchField.forceActiveFocus());
|
||||||
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,28 +185,35 @@ Scope {
|
|||||||
width: Theme.px(500, overlayWindow.dpr)
|
width: Theme.px(500, overlayWindow.dpr)
|
||||||
height: Theme.px(600, overlayWindow.dpr)
|
height: Theme.px(600, overlayWindow.dpr)
|
||||||
|
|
||||||
property real scaleValue: 0.96
|
readonly property bool animatingOut: niriOverviewScope.isClosing && overlayWindow.isSpotlightScreen
|
||||||
|
property bool waitingForResults: false
|
||||||
|
|
||||||
scale: scaleValue
|
Connections {
|
||||||
opacity: overlayWindow.shouldShowSpotlight ? 1 : 0
|
target: spotlightContent.appLauncher?.model ?? null
|
||||||
|
function onCountChanged() {
|
||||||
|
spotlightContainer.waitingForResults = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scale: (overlayWindow.shouldShowSpotlight && !waitingForResults) ? 1.0 : 0.96
|
||||||
|
opacity: (overlayWindow.shouldShowSpotlight && !waitingForResults) ? 1 : 0
|
||||||
|
visible: (overlayWindow.shouldShowSpotlight && !waitingForResults) || animatingOut
|
||||||
enabled: overlayWindow.shouldShowSpotlight
|
enabled: overlayWindow.shouldShowSpotlight
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr))
|
layer.textureSize: Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr))
|
||||||
|
|
||||||
Connections {
|
Behavior on scale {
|
||||||
target: overlayWindow
|
|
||||||
function onShouldShowSpotlightChanged() {
|
|
||||||
spotlightContainer.scaleValue = overlayWindow.shouldShowSpotlight ? 1.0 : 0.96
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on scaleValue {
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Theme.expressiveDurations.expressiveDefaultSpatial
|
duration: Theme.expressiveDurations.expressiveDefaultSpatial
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: niriOverviewScope.searchActive ? Theme.expressiveCurves.expressiveDefaultSpatial : Theme.expressiveCurves.emphasized
|
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveDefaultSpatial : Theme.expressiveCurves.emphasized
|
||||||
|
onRunningChanged: {
|
||||||
|
if (running || !spotlightContainer.animatingOut)
|
||||||
|
return;
|
||||||
|
niriOverviewScope.completeHide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +221,7 @@ Scope {
|
|||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Theme.expressiveDurations.expressiveDefaultSpatial
|
duration: Theme.expressiveDurations.expressiveDefaultSpatial
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: niriOverviewScope.searchActive ? Theme.expressiveCurves.expressiveDefaultSpatial : Theme.expressiveCurves.emphasized
|
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveDefaultSpatial : Theme.expressiveCurves.emphasized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,17 +239,14 @@ Scope {
|
|||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
|
|
||||||
property var fakeParentModal: QtObject {
|
property var fakeParentModal: QtObject {
|
||||||
property bool spotlightOpen: overlayWindow.shouldShowSpotlight
|
property bool spotlightOpen: spotlightContainer.visible
|
||||||
function hide() {
|
function hide() {
|
||||||
niriOverviewScope.hideSpotlight()
|
niriOverviewScope.hideSpotlight();
|
||||||
if (overlayWindow.isActiveScreen) {
|
|
||||||
Qt.callLater(() => keyboardFocusScope.forceActiveFocus())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
parentModal = fakeParentModal
|
parentModal = fakeParentModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user