mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
refactor(Spotlight): Use Spotlight alongside OG Launcher
- Update to add DMS Action keys in Keyboard Shortcuts - Defaulted in niri/hyprland includes file as `Alt+Space` - New (IPC): `dms ipc call spotlight-bar toggle` - Slight UI update to follow user radius
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
-- === Application Launchers ===
|
||||
hl.bind("SUPER + T", hl.dsp.exec_cmd("{{TERMINAL_COMMAND}}"))
|
||||
hl.bind("SUPER + space", hl.dsp.exec_cmd("dms ipc call spotlight toggle"))
|
||||
hl.bind("ALT + space", hl.dsp.exec_cmd("dms ipc call spotlight-bar toggle"))
|
||||
hl.bind("SUPER + V", hl.dsp.exec_cmd("dms ipc call clipboard toggle"))
|
||||
hl.bind("SUPER + M", hl.dsp.exec_cmd("dms ipc call processlist focusOrToggle"))
|
||||
hl.bind("SUPER + comma", hl.dsp.exec_cmd("dms ipc call settings focusOrToggle"))
|
||||
|
||||
@@ -9,6 +9,9 @@ binds {
|
||||
Mod+Space hotkey-overlay-title="Application Launcher" {
|
||||
spawn "dms" "ipc" "call" "spotlight" "toggle";
|
||||
}
|
||||
Alt+Space hotkey-overlay-title="Spotlight Bar" {
|
||||
spawn "dms" "ipc" "call" "spotlight-bar" "toggle";
|
||||
}
|
||||
Mod+V hotkey-overlay-title="Clipboard Manager" {
|
||||
spawn "dms" "ipc" "call" "clipboard" "toggle";
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ const DMS_ACTIONS = [
|
||||
{ id: "spawn dms ipc call spotlight toggle", label: "App Launcher: Toggle" },
|
||||
{ id: "spawn dms ipc call spotlight open", label: "App Launcher: Open" },
|
||||
{ id: "spawn dms ipc call spotlight close", label: "App Launcher: Close" },
|
||||
{ id: "spawn dms ipc call spotlight-bar toggle", label: "Spotlight Bar: Toggle" },
|
||||
{ id: "spawn dms ipc call spotlight-bar open", label: "Spotlight Bar: Open" },
|
||||
{ id: "spawn dms ipc call spotlight-bar close", label: "Spotlight Bar: Close" },
|
||||
{ id: "spawn dms ipc call clipboard toggle", label: "Clipboard: Toggle" },
|
||||
{ id: "spawn dms ipc call clipboard open", label: "Clipboard: Open" },
|
||||
{ id: "spawn dms ipc call clipboard close", label: "Clipboard: Close" },
|
||||
|
||||
@@ -258,8 +258,6 @@ Singleton {
|
||||
onFrameLauncherEmergeSideChanged: saveSettings()
|
||||
property bool frameLauncherArcExtender: false
|
||||
onFrameLauncherArcExtenderChanged: saveSettings()
|
||||
property bool frameUseSpotlightLauncher: false
|
||||
onFrameUseSpotlightLauncherChanged: saveSettings()
|
||||
readonly property string frameModalEmergeSide: frameLauncherEmergeSide === "top" ? "bottom" : "top"
|
||||
property string frameMode: "connected"
|
||||
onFrameModeChanged: saveSettings()
|
||||
|
||||
@@ -575,7 +575,6 @@ var SPEC = {
|
||||
frameCloseGaps: { def: true },
|
||||
frameLauncherEmergeSide: { def: "bottom" },
|
||||
frameLauncherArcExtender: { def: false },
|
||||
frameUseSpotlightLauncher: { def: false },
|
||||
frameMode: { def: "connected" }
|
||||
};
|
||||
|
||||
|
||||
@@ -725,6 +725,25 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: spotlightBarModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.spotlightBarModalLoader = spotlightBarModalLoader;
|
||||
}
|
||||
|
||||
DankLauncherV2ModalSpotlight {
|
||||
id: spotlightBarModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.spotlightBarModal = spotlightBarModal;
|
||||
PopoutService._onSpotlightBarModalLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: clipboardHistoryPopoutLoader
|
||||
|
||||
|
||||
@@ -1340,6 +1340,25 @@ Item {
|
||||
target: "spotlight"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
PopoutService.openSpotlightBar();
|
||||
return "SPOTLIGHT_BAR_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
PopoutService.closeSpotlightBar();
|
||||
return "SPOTLIGHT_BAR_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
PopoutService.toggleSpotlightBar();
|
||||
return "SPOTLIGHT_BAR_TOGGLE_SUCCESS";
|
||||
}
|
||||
|
||||
target: "spotlight-bar"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function info(message: string): string {
|
||||
if (!message)
|
||||
|
||||
@@ -62,7 +62,7 @@ Item {
|
||||
impl.item.toggleWithMode(mode);
|
||||
}
|
||||
|
||||
readonly property bool useSpotlightBackend: SettingsData.connectedFrameModeActive ? SettingsData.frameUseSpotlightLauncher : SettingsData.launcherStyle === "spotlight"
|
||||
readonly property bool useSpotlightBackend: !SettingsData.connectedFrameModeActive && SettingsData.launcherStyle === "spotlight"
|
||||
readonly property var _desiredBackend: useSpotlightBackend ? spotlightComp : (SettingsData.connectedFrameModeActive ? connectedComp : standaloneComp)
|
||||
property var _resolvedBackend: null
|
||||
|
||||
@@ -73,9 +73,6 @@ Item {
|
||||
function onConnectedFrameModeActiveChanged() {
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
function onFrameUseSpotlightLauncherChanged() {
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
function onLauncherStyleChanged() {
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ Item {
|
||||
const searchBarH = 56;
|
||||
const usableH = Math.max(searchBarH, screenHeight - insetT - insetB);
|
||||
const preferred = insetT + Math.max(0, usableH * 0.33 - searchBarH / 2);
|
||||
const maxY = Math.max(insetT, screenHeight - insetB - _contentImplicitH);
|
||||
const maxY = Math.max(insetT, screenHeight - insetB - 56);
|
||||
return Math.max(insetT, Math.min(preferred, maxY));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ FocusScope {
|
||||
|
||||
readonly property bool _hasQuery: searchInput.text.length > 0
|
||||
readonly property real _searchBarH: 56
|
||||
readonly property real _surfaceInset: BlurService.enabled ? (_hasQuery ? Theme.spacingS : Theme.spacingXS) : 0
|
||||
readonly property real _searchAreaH: _searchBarH + _surfaceInset * 2
|
||||
readonly property real _searchAreaH: _searchBarH
|
||||
readonly property real _statusH: 92
|
||||
readonly property real _rowH: 64
|
||||
readonly property real _maxResultsH: Math.min(430, (parentModal?.screenHeight ?? 900) * 0.55)
|
||||
@@ -233,11 +232,8 @@ FocusScope {
|
||||
Rectangle {
|
||||
id: searchBarSurface
|
||||
anchors.fill: parent
|
||||
anchors.margins: root._surfaceInset
|
||||
radius: height / 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(root._hasQuery ? Theme.surfaceContainerHigh : Theme.surfaceContainer, root._hasQuery ? Theme.popupTransparency : Math.max(0.68, Theme.popupTransparency * 0.9))
|
||||
border.color: BlurService.enabled && !root._hasQuery ? Theme.withAlpha(Theme.outline, 0.08) : "transparent"
|
||||
border.width: BlurService.enabled && !root._hasQuery ? 1 : 0
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
@@ -384,8 +380,6 @@ FocusScope {
|
||||
anchors.top: searchBarItem.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: root._surfaceInset
|
||||
anchors.rightMargin: root._surfaceInset
|
||||
height: 1
|
||||
color: Theme.outlineMedium
|
||||
opacity: root._resultsH > 0 ? 0.55 : 0
|
||||
|
||||
@@ -308,15 +308,6 @@ Item {
|
||||
onToggled: checked => SettingsData.set("frameCloseGaps", !checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "frameUseSpotlightLauncher"
|
||||
tags: ["frame", "connected", "launcher", "spotlight", "search", "minimal"]
|
||||
text: I18n.tr("Use Spotlight Launcher")
|
||||
description: I18n.tr("Use the centered minimal launcher instead of the connected V2 launcher")
|
||||
checked: SettingsData.frameUseSpotlightLauncher
|
||||
onToggled: checked => SettingsData.set("frameUseSpotlightLauncher", checked)
|
||||
}
|
||||
|
||||
SettingsButtonGroupRow {
|
||||
settingKey: "frameLauncherEmergeSide"
|
||||
tags: ["frame", "connected", "launcher", "modal", "emerge", "direction", "bottom", "top"]
|
||||
|
||||
@@ -34,6 +34,8 @@ Singleton {
|
||||
property var clipboardHistoryModal: null
|
||||
property var dankLauncherV2Modal: null
|
||||
property var dankLauncherV2ModalLoader: null
|
||||
property var spotlightBarModal: null
|
||||
property var spotlightBarModalLoader: null
|
||||
property var powerMenuModal: null
|
||||
property var processListModal: null
|
||||
property var processListModalLoader: null
|
||||
@@ -616,6 +618,45 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
property bool _spotlightBarWantsOpen: false
|
||||
property bool _spotlightBarWantsToggle: false
|
||||
|
||||
function openSpotlightBar() {
|
||||
if (spotlightBarModal) {
|
||||
spotlightBarModal.show();
|
||||
} else if (spotlightBarModalLoader) {
|
||||
_spotlightBarWantsOpen = true;
|
||||
_spotlightBarWantsToggle = false;
|
||||
spotlightBarModalLoader.active = true;
|
||||
}
|
||||
}
|
||||
|
||||
function closeSpotlightBar() {
|
||||
spotlightBarModal?.hide();
|
||||
}
|
||||
|
||||
function toggleSpotlightBar() {
|
||||
if (spotlightBarModal) {
|
||||
spotlightBarModal.toggle();
|
||||
} else if (spotlightBarModalLoader) {
|
||||
_spotlightBarWantsToggle = true;
|
||||
_spotlightBarWantsOpen = false;
|
||||
spotlightBarModalLoader.active = true;
|
||||
}
|
||||
}
|
||||
|
||||
function _onSpotlightBarModalLoaded() {
|
||||
if (_spotlightBarWantsOpen) {
|
||||
_spotlightBarWantsOpen = false;
|
||||
spotlightBarModal?.show();
|
||||
return;
|
||||
}
|
||||
if (_spotlightBarWantsToggle) {
|
||||
_spotlightBarWantsToggle = false;
|
||||
spotlightBarModal?.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
function openPowerMenu() {
|
||||
powerMenuModal?.openCentered();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user