mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-11 08:12:09 -04:00
@@ -126,6 +126,10 @@ Singleton {
|
|||||||
property var hiddenOutputDeviceNames: []
|
property var hiddenOutputDeviceNames: []
|
||||||
property var hiddenInputDeviceNames: []
|
property var hiddenInputDeviceNames: []
|
||||||
|
|
||||||
|
property string launcherLastMode: "all"
|
||||||
|
property string appDrawerLastMode: "apps"
|
||||||
|
property string niriOverviewLastMode: "apps"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!isGreeterMode) {
|
if (!isGreeterMode) {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -1100,6 +1104,21 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setLauncherLastMode(mode) {
|
||||||
|
launcherLastMode = mode;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAppDrawerLastMode(mode) {
|
||||||
|
appDrawerLastMode = mode;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setNiriOverviewLastMode(mode) {
|
||||||
|
niriOverviewLastMode = mode;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
function syncWallpaperForCurrentMode() {
|
function syncWallpaperForCurrentMode() {
|
||||||
if (!perModeWallpaper)
|
if (!perModeWallpaper)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ var SPEC = {
|
|||||||
|
|
||||||
deviceMaxVolumes: { def: {} },
|
deviceMaxVolumes: { def: {} },
|
||||||
hiddenOutputDeviceNames: { def: [] },
|
hiddenOutputDeviceNames: { def: [] },
|
||||||
hiddenInputDeviceNames: { def: [] }
|
hiddenInputDeviceNames: { def: [] },
|
||||||
|
|
||||||
|
launcherLastMode: { def: "all" },
|
||||||
|
appDrawerLastMode: { def: "apps" },
|
||||||
|
niriOverviewLastMode: { def: "apps" }
|
||||||
};
|
};
|
||||||
|
|
||||||
function getValidKeys() {
|
function getValidKeys() {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Item {
|
|||||||
spotlightContent.searchField.text = query;
|
spotlightContent.searchField.text = query;
|
||||||
}
|
}
|
||||||
if (spotlightContent.controller) {
|
if (spotlightContent.controller) {
|
||||||
var targetMode = mode || "all";
|
var targetMode = mode || SessionData.launcherLastMode || "all";
|
||||||
spotlightContent.controller.searchMode = targetMode;
|
spotlightContent.controller.searchMode = targetMode;
|
||||||
spotlightContent.controller.activePluginId = "";
|
spotlightContent.controller.activePluginId = "";
|
||||||
spotlightContent.controller.activePluginName = "";
|
spotlightContent.controller.activePluginName = "";
|
||||||
@@ -230,6 +230,15 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: spotlightContent?.controller ?? null
|
||||||
|
function onModeChanged(mode) {
|
||||||
|
if (spotlightContent.controller.autoSwitchedToFiles)
|
||||||
|
return;
|
||||||
|
SessionData.setLauncherLastMode(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
id: focusGrab
|
id: focusGrab
|
||||||
windows: [launcherWindow]
|
windows: [launcherWindow]
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ DankPopout {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const query = _pendingQuery;
|
const query = _pendingQuery;
|
||||||
const mode = _pendingMode || "apps";
|
const mode = _pendingMode || SessionData.appDrawerLastMode || "apps";
|
||||||
_pendingMode = "";
|
_pendingMode = "";
|
||||||
_pendingQuery = "";
|
_pendingQuery = "";
|
||||||
|
|
||||||
@@ -83,6 +83,15 @@ DankPopout {
|
|||||||
lc.actionPanel?.hide();
|
lc.actionPanel?.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: contentLoader.item?.launcherContent?.controller ?? null
|
||||||
|
function onModeChanged(mode) {
|
||||||
|
if (contentLoader.item.launcherContent.controller.autoSwitchedToFiles)
|
||||||
|
return;
|
||||||
|
SessionData.setAppDrawerLastMode(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentContainer
|
id: contentContainer
|
||||||
|
|||||||
@@ -79,199 +79,199 @@ Scope {
|
|||||||
id: overlayWindow
|
id: overlayWindow
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
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 && !niriOverviewScope.isClosing
|
readonly property bool shouldShowSpotlight: niriOverviewScope.searchActive && screen.name === niriOverviewScope.searchActiveScreen && !niriOverviewScope.isClosing
|
||||||
readonly property bool isSpotlightScreen: screen.name === niriOverviewScope.searchActiveScreen
|
readonly property bool isSpotlightScreen: screen.name === niriOverviewScope.searchActiveScreen
|
||||||
readonly property bool overlayVisible: NiriService.inOverview || niriOverviewScope.isClosing
|
readonly property bool overlayVisible: NiriService.inOverview || niriOverviewScope.isClosing
|
||||||
property bool hasActivePopout: !!PopoutManager.currentPopoutsByScreen[screen.name]
|
property bool hasActivePopout: !!PopoutManager.currentPopoutsByScreen[screen.name]
|
||||||
property bool hasActiveModal: !!ModalManager.currentModalsByScreen[screen.name]
|
property bool hasActiveModal: !!ModalManager.currentModalsByScreen[screen.name]
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: PopoutManager
|
target: PopoutManager
|
||||||
function onPopoutChanged() {
|
function onPopoutChanged() {
|
||||||
overlayWindow.hasActivePopout = !!PopoutManager.currentPopoutsByScreen[overlayWindow.screen.name];
|
overlayWindow.hasActivePopout = !!PopoutManager.currentPopoutsByScreen[overlayWindow.screen.name];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ModalManager
|
target: ModalManager
|
||||||
function onModalChanged() {
|
function onModalChanged() {
|
||||||
overlayWindow.hasActiveModal = !!ModalManager.currentModalsByScreen[overlayWindow.screen.name];
|
overlayWindow.hasActiveModal = !!ModalManager.currentModalsByScreen[overlayWindow.screen.name];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
visible: overlayVisible
|
visible: overlayVisible
|
||||||
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)
|
if (!NiriService.inOverview)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (!isActiveScreen)
|
if (!isActiveScreen)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (niriOverviewScope.releaseKeyboard)
|
if (niriOverviewScope.releaseKeyboard)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (hasActivePopout || hasActiveModal)
|
if (hasActivePopout || hasActiveModal)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
|
||||||
|
|
||||||
mask: Region {
|
|
||||||
item: overlayVisible && spotlightContainer.visible ? spotlightContainer : null
|
|
||||||
}
|
|
||||||
|
|
||||||
onShouldShowSpotlightChanged: {
|
|
||||||
if (shouldShowSpotlight) {
|
|
||||||
if (launcherContent?.controller) {
|
|
||||||
launcherContent.controller.searchMode = "apps";
|
|
||||||
launcherContent.controller.performSearch();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!isActiveScreen)
|
|
||||||
return;
|
|
||||||
Qt.callLater(() => keyboardFocusScope.forceActiveFocus());
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
mask: Region {
|
||||||
top: true
|
item: overlayVisible && spotlightContainer.visible ? spotlightContainer : null
|
||||||
left: true
|
}
|
||||||
right: true
|
|
||||||
bottom: true
|
onShouldShowSpotlightChanged: {
|
||||||
}
|
if (shouldShowSpotlight) {
|
||||||
|
if (launcherContent?.controller) {
|
||||||
FocusScope {
|
launcherContent.controller.searchMode = SessionData.niriOverviewLastMode || "apps";
|
||||||
id: keyboardFocusScope
|
launcherContent.controller.performSearch();
|
||||||
anchors.fill: parent
|
}
|
||||||
focus: true
|
return;
|
||||||
|
}
|
||||||
Keys.onPressed: event => {
|
if (!isActiveScreen)
|
||||||
if (overlayWindow.shouldShowSpotlight || niriOverviewScope.isClosing)
|
return;
|
||||||
return;
|
Qt.callLater(() => keyboardFocusScope.forceActiveFocus());
|
||||||
if ([Qt.Key_Escape, Qt.Key_Return].includes(event.key)) {
|
}
|
||||||
NiriService.toggleOverview();
|
|
||||||
event.accepted = true;
|
anchors {
|
||||||
return;
|
top: true
|
||||||
}
|
left: true
|
||||||
|
right: true
|
||||||
if (event.key === Qt.Key_Left) {
|
bottom: true
|
||||||
NiriService.moveColumnLeft();
|
}
|
||||||
event.accepted = true;
|
|
||||||
return;
|
FocusScope {
|
||||||
}
|
id: keyboardFocusScope
|
||||||
|
anchors.fill: parent
|
||||||
if (event.key === Qt.Key_Right) {
|
focus: true
|
||||||
NiriService.moveColumnRight();
|
|
||||||
event.accepted = true;
|
Keys.onPressed: event => {
|
||||||
return;
|
if (overlayWindow.shouldShowSpotlight || niriOverviewScope.isClosing)
|
||||||
}
|
return;
|
||||||
|
if ([Qt.Key_Escape, Qt.Key_Return].includes(event.key)) {
|
||||||
if (event.key === Qt.Key_Up) {
|
NiriService.toggleOverview();
|
||||||
NiriService.moveWorkspaceUp();
|
event.accepted = true;
|
||||||
event.accepted = true;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
if (event.key === Qt.Key_Left) {
|
||||||
if (event.key === Qt.Key_Down) {
|
NiriService.moveColumnLeft();
|
||||||
NiriService.moveWorkspaceDown();
|
event.accepted = true;
|
||||||
event.accepted = true;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
if (event.key === Qt.Key_Right) {
|
||||||
if (event.modifiers & (Qt.ControlModifier | Qt.MetaModifier) || [Qt.Key_Delete, Qt.Key_Backspace].includes(event.key)) {
|
NiriService.moveColumnRight();
|
||||||
event.accepted = false;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isAutoRepeat || !event.text)
|
if (event.key === Qt.Key_Up) {
|
||||||
return;
|
NiriService.moveWorkspaceUp();
|
||||||
if (!launcherContent?.searchField)
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
const trimmedText = event.text.trim();
|
}
|
||||||
launcherContent.searchField.text = trimmedText;
|
|
||||||
launcherContent.controller.setSearchQuery(trimmedText);
|
if (event.key === Qt.Key_Down) {
|
||||||
niriOverviewScope.showSpotlight(overlayWindow.screen.name);
|
NiriService.moveWorkspaceDown();
|
||||||
Qt.callLater(() => launcherContent.searchField.forceActiveFocus());
|
event.accepted = true;
|
||||||
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 (!launcherContent?.searchField)
|
||||||
|
return;
|
||||||
|
const trimmedText = event.text.trim();
|
||||||
|
launcherContent.searchField.text = trimmedText;
|
||||||
|
launcherContent.controller.setSearchQuery(trimmedText);
|
||||||
|
niriOverviewScope.showSpotlight(overlayWindow.screen.name);
|
||||||
|
Qt.callLater(() => launcherContent.searchField.forceActiveFocus());
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: spotlightContainer
|
id: spotlightContainer
|
||||||
x: Theme.snap((parent.width - width) / 2, overlayWindow.dpr)
|
x: Theme.snap((parent.width - width) / 2, overlayWindow.dpr)
|
||||||
y: Theme.snap((parent.height - height) / 2, overlayWindow.dpr)
|
y: Theme.snap((parent.height - height) / 2, overlayWindow.dpr)
|
||||||
|
|
||||||
readonly property int baseWidth: {
|
readonly property int baseWidth: {
|
||||||
switch (SettingsData.dankLauncherV2Size) {
|
switch (SettingsData.dankLauncherV2Size) {
|
||||||
case "micro":
|
case "micro":
|
||||||
return 500;
|
return 500;
|
||||||
case "medium":
|
case "medium":
|
||||||
return 720;
|
return 720;
|
||||||
case "large":
|
case "large":
|
||||||
return 860;
|
return 860;
|
||||||
default:
|
default:
|
||||||
return 620;
|
return 620;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
readonly property int baseHeight: {
|
||||||
readonly property int baseHeight: {
|
switch (SettingsData.dankLauncherV2Size) {
|
||||||
switch (SettingsData.dankLauncherV2Size) {
|
case "micro":
|
||||||
case "micro":
|
return 480;
|
||||||
return 480;
|
case "medium":
|
||||||
case "medium":
|
return 720;
|
||||||
return 720;
|
case "large":
|
||||||
case "large":
|
return 860;
|
||||||
return 860;
|
default:
|
||||||
default:
|
return 600;
|
||||||
return 600;
|
}
|
||||||
}
|
}
|
||||||
}
|
width: Math.min(baseWidth, overlayWindow.screen.width - 100)
|
||||||
width: Math.min(baseWidth, overlayWindow.screen.width - 100)
|
height: Math.min(baseHeight, overlayWindow.screen.height - 100)
|
||||||
height: Math.min(baseHeight, overlayWindow.screen.height - 100)
|
|
||||||
|
|
||||||
readonly property bool animatingOut: niriOverviewScope.isClosing && overlayWindow.isSpotlightScreen
|
readonly property bool animatingOut: niriOverviewScope.isClosing && overlayWindow.isSpotlightScreen
|
||||||
|
|
||||||
scale: overlayWindow.shouldShowSpotlight ? 1.0 : 0.96
|
scale: overlayWindow.shouldShowSpotlight ? 1.0 : 0.96
|
||||||
opacity: overlayWindow.shouldShowSpotlight ? 1 : 0
|
opacity: overlayWindow.shouldShowSpotlight ? 1 : 0
|
||||||
visible: overlayWindow.shouldShowSpotlight || animatingOut
|
visible: overlayWindow.shouldShowSpotlight || animatingOut
|
||||||
enabled: overlayWindow.shouldShowSpotlight
|
enabled: overlayWindow.shouldShowSpotlight
|
||||||
|
|
||||||
layer.enabled: visible
|
layer.enabled: visible
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: layer.enabled ? Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr)) : Qt.size(0, 0)
|
layer.textureSize: layer.enabled ? Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr)) : Qt.size(0, 0)
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
id: scaleAnimation
|
id: scaleAnimation
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Theme.expressiveDurations.fast
|
duration: Theme.expressiveDurations.fast
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
|
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if (running || !spotlightContainer.animatingOut)
|
if (running || !spotlightContainer.animatingOut)
|
||||||
return;
|
return;
|
||||||
niriOverviewScope.resetState();
|
niriOverviewScope.resetState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Theme.expressiveDurations.fast
|
duration: Theme.expressiveDurations.fast
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
|
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
border.color: Theme.outlineMedium
|
border.color: Theme.outlineMedium
|
||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherContent {
|
LauncherContent {
|
||||||
id: launcherContent
|
id: launcherContent
|
||||||
@@ -308,6 +308,11 @@ Scope {
|
|||||||
function onItemExecuted() {
|
function onItemExecuted() {
|
||||||
niriOverviewScope.releaseKeyboard = true;
|
niriOverviewScope.releaseKeyboard = true;
|
||||||
}
|
}
|
||||||
|
function onModeChanged(mode) {
|
||||||
|
if (launcherContent.controller.autoSwitchedToFiles)
|
||||||
|
return;
|
||||||
|
SessionData.setNiriOverviewLastMode(mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user