mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
launcher v2: meta improvements
- Allow disabling each plugin from "all" mode - add IPCs for toggling specific modes - niri: overview respect size & default to apps mode - fix unicode icon handling
This commit is contained in:
@@ -431,14 +431,14 @@ Item {
|
||||
|
||||
if (searchMode === "all") {
|
||||
if (searchQuery) {
|
||||
var allPluginIds = getAllLauncherPluginIds();
|
||||
var allPluginIds = getVisibleLauncherPluginIds();
|
||||
for (var i = 0; i < allPluginIds.length; i++) {
|
||||
var pluginId = allPluginIds[i];
|
||||
var pItems = getPluginItems(pluginId, searchQuery);
|
||||
allItems = allItems.concat(pItems);
|
||||
}
|
||||
|
||||
var allBuiltInIds = getAllBuiltInLauncherIds();
|
||||
var allBuiltInIds = getVisibleBuiltInLauncherIds();
|
||||
for (var i = 0; i < allBuiltInIds.length; i++) {
|
||||
var pluginId = allBuiltInIds[i];
|
||||
var blItems = AppSearchService.getBuiltInLauncherItems(pluginId, searchQuery);
|
||||
@@ -858,7 +858,10 @@ Item {
|
||||
}
|
||||
|
||||
function getEmptyTriggerPlugins() {
|
||||
return PluginService.getPluginsWithEmptyTrigger();
|
||||
var plugins = PluginService.getPluginsWithEmptyTrigger();
|
||||
return plugins.filter(function (pluginId) {
|
||||
return SettingsData.getPluginAllowWithoutTrigger(pluginId);
|
||||
});
|
||||
}
|
||||
|
||||
function getAllLauncherPluginIds() {
|
||||
@@ -866,11 +869,25 @@ Item {
|
||||
return Object.keys(launchers);
|
||||
}
|
||||
|
||||
function getVisibleLauncherPluginIds() {
|
||||
var launchers = PluginService.getLauncherPlugins();
|
||||
return Object.keys(launchers).filter(function (pluginId) {
|
||||
return SettingsData.getPluginAllowWithoutTrigger(pluginId);
|
||||
});
|
||||
}
|
||||
|
||||
function getAllBuiltInLauncherIds() {
|
||||
var launchers = AppSearchService.getBuiltInLauncherPlugins();
|
||||
return Object.keys(launchers);
|
||||
}
|
||||
|
||||
function getVisibleBuiltInLauncherIds() {
|
||||
var launchers = AppSearchService.getBuiltInLauncherPlugins();
|
||||
return Object.keys(launchers).filter(function (pluginId) {
|
||||
return SettingsData.getPluginAllowWithoutTrigger(pluginId);
|
||||
});
|
||||
}
|
||||
|
||||
function getPluginBrowseItems() {
|
||||
var items = [];
|
||||
|
||||
@@ -930,7 +947,10 @@ Item {
|
||||
}
|
||||
|
||||
function getBuiltInEmptyTriggerLaunchers() {
|
||||
return AppSearchService.getBuiltInLauncherPluginsWithEmptyTrigger();
|
||||
var plugins = AppSearchService.getBuiltInLauncherPluginsWithEmptyTrigger();
|
||||
return plugins.filter(function (pluginId) {
|
||||
return SettingsData.getPluginAllowWithoutTrigger(pluginId);
|
||||
});
|
||||
}
|
||||
|
||||
function getPluginItems(pluginId, query) {
|
||||
@@ -947,12 +967,14 @@ Item {
|
||||
function detectIconType(iconName) {
|
||||
if (!iconName)
|
||||
return "material";
|
||||
if (iconName.indexOf("/") >= 0 || iconName.indexOf(".") >= 0)
|
||||
return "image";
|
||||
if (iconName.startsWith("unicode:"))
|
||||
return "unicode";
|
||||
if (iconName.startsWith("material:"))
|
||||
return "material";
|
||||
if (iconName.startsWith("image:"))
|
||||
return "image";
|
||||
if (iconName.indexOf("/") >= 0 || iconName.indexOf(".") >= 0)
|
||||
return "image";
|
||||
if (/^[a-z]+-[a-z]/.test(iconName.toLowerCase()))
|
||||
return "image";
|
||||
return "material";
|
||||
@@ -961,6 +983,8 @@ Item {
|
||||
function stripIconPrefix(iconName) {
|
||||
if (!iconName)
|
||||
return "extension";
|
||||
if (iconName.startsWith("unicode:"))
|
||||
return iconName.substring(8);
|
||||
if (iconName.startsWith("material:"))
|
||||
return iconName.substring(9);
|
||||
if (iconName.startsWith("image:"))
|
||||
|
||||
@@ -53,7 +53,7 @@ Item {
|
||||
|
||||
signal dialogClosed
|
||||
|
||||
function _initializeAndShow(query) {
|
||||
function _initializeAndShow(query, mode) {
|
||||
contentVisible = true;
|
||||
spotlightContent.searchField.forceActiveFocus();
|
||||
|
||||
@@ -61,7 +61,8 @@ Item {
|
||||
spotlightContent.searchField.text = query;
|
||||
}
|
||||
if (spotlightContent.controller) {
|
||||
spotlightContent.controller.searchMode = "all";
|
||||
var targetMode = mode || "all";
|
||||
spotlightContent.controller.searchMode = targetMode;
|
||||
spotlightContent.controller.activePluginId = "";
|
||||
spotlightContent.controller.activePluginName = "";
|
||||
spotlightContent.controller.pluginFilter = "";
|
||||
@@ -136,6 +137,32 @@ Item {
|
||||
spotlightOpen ? hide() : show();
|
||||
}
|
||||
|
||||
function showWithMode(mode) {
|
||||
closeCleanupTimer.stop();
|
||||
isClosing = false;
|
||||
openedFromOverview = false;
|
||||
|
||||
var focusedScreen = CompositorService.getFocusedScreen();
|
||||
if (focusedScreen)
|
||||
launcherWindow.screen = focusedScreen;
|
||||
|
||||
spotlightOpen = true;
|
||||
keyboardActive = true;
|
||||
ModalManager.openModal(root);
|
||||
if (useHyprlandFocusGrab)
|
||||
focusGrab.active = true;
|
||||
|
||||
_initializeAndShow("", mode);
|
||||
}
|
||||
|
||||
function toggleWithMode(mode) {
|
||||
if (spotlightOpen) {
|
||||
hide();
|
||||
} else {
|
||||
showWithMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: closeCleanupTimer
|
||||
interval: Theme.expressiveDurations.expressiveFastSpatial + 50
|
||||
|
||||
@@ -52,6 +52,14 @@ Rectangle {
|
||||
color: root.isSelected ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: root.item?.iconType === "unicode"
|
||||
text: root.item?.icon ?? ""
|
||||
font.pixelSize: parent.iconSize * 0.7
|
||||
color: root.isSelected ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
visible: root.item?.iconType === "composite"
|
||||
|
||||
@@ -52,6 +52,14 @@ Rectangle {
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: root.item?.iconType === "unicode"
|
||||
text: root.item?.icon ?? ""
|
||||
font.pixelSize: 24
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
visible: root.item?.iconType === "composite"
|
||||
|
||||
@@ -76,12 +76,20 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
visible: !root.useImage && !root.useIconProvider
|
||||
visible: !root.useImage && !root.useIconProvider && root.item?.iconType !== "unicode"
|
||||
name: root.item?.icon ?? "image"
|
||||
size: Math.min(parent.width, parent.height) * 0.4
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: root.item?.iconType === "unicode"
|
||||
text: root.item?.icon ?? ""
|
||||
font.pixelSize: Math.min(parent.width, parent.height) * 0.4
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Reference in New Issue
Block a user