1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

Merge branch 'master' into auto-theme

This commit is contained in:
purian23
2026-01-24 18:19:13 -05:00
11 changed files with 245 additions and 76 deletions

View File

@@ -13,7 +13,7 @@ import "settings/SessionStore.js" as Store
Singleton { Singleton {
id: root id: root
readonly property int sessionConfigVersion: 2 readonly property int sessionConfigVersion: 3
readonly property bool isGreeterMode: Quickshell.env("DMS_RUN_GREETER") === "1" || Quickshell.env("DMS_RUN_GREETER") === "true" readonly property bool isGreeterMode: Quickshell.env("DMS_RUN_GREETER") === "1" || Quickshell.env("DMS_RUN_GREETER") === "true"
property bool _parseError: false property bool _parseError: false
@@ -117,6 +117,8 @@ Singleton {
property var appOverrides: ({}) property var appOverrides: ({})
property bool searchAppActions: true property bool searchAppActions: true
property string vpnLastConnected: ""
Component.onCompleted: { Component.onCompleted: {
if (!isGreeterMode) { if (!isGreeterMode) {
loadSettings(); loadSettings();
@@ -1038,6 +1040,11 @@ Singleton {
saveSettings(); saveSettings();
} }
function setVpnLastConnected(uuid) {
vpnLastConnected = uuid || "";
saveSettings();
}
function syncWallpaperForCurrentMode() { function syncWallpaperForCurrentMode() {
if (!perModeWallpaper) if (!perModeWallpaper)
return; return;

View File

@@ -292,13 +292,13 @@ Singleton {
property string _legacyWeatherLocation: "New York, NY" property string _legacyWeatherLocation: "New York, NY"
property string _legacyWeatherCoordinates: "40.7128,-74.0060" property string _legacyWeatherCoordinates: "40.7128,-74.0060"
property string _legacyVpnLastConnected: ""
readonly property string weatherLocation: SessionData.weatherLocation readonly property string weatherLocation: SessionData.weatherLocation
readonly property string weatherCoordinates: SessionData.weatherCoordinates readonly property string weatherCoordinates: SessionData.weatherCoordinates
property bool useAutoLocation: false property bool useAutoLocation: false
property bool weatherEnabled: true property bool weatherEnabled: true
property string networkPreference: "auto" property string networkPreference: "auto"
property string vpnLastConnected: ""
property string iconTheme: "System Default" property string iconTheme: "System Default"
property var availableIconThemes: ["System Default"] property var availableIconThemes: ["System Default"]
@@ -1078,6 +1078,11 @@ Singleton {
_legacyWeatherLocation = obj.weatherLocation; _legacyWeatherLocation = obj.weatherLocation;
if (obj?.weatherCoordinates !== undefined) if (obj?.weatherCoordinates !== undefined)
_legacyWeatherCoordinates = obj.weatherCoordinates; _legacyWeatherCoordinates = obj.weatherCoordinates;
if (obj?.vpnLastConnected !== undefined && obj.vpnLastConnected !== "") {
_legacyVpnLastConnected = obj.vpnLastConnected;
SessionData.vpnLastConnected = _legacyVpnLastConnected;
SessionData.saveSettings();
}
_loadedSettingsSnapshot = JSON.stringify(Store.toJson(root)); _loadedSettingsSnapshot = JSON.stringify(Store.toJson(root));
_hasLoaded = true; _hasLoaded = true;
@@ -2311,6 +2316,11 @@ Singleton {
_legacyWeatherLocation = obj.weatherLocation; _legacyWeatherLocation = obj.weatherLocation;
if (obj.weatherCoordinates !== undefined) if (obj.weatherCoordinates !== undefined)
_legacyWeatherCoordinates = obj.weatherCoordinates; _legacyWeatherCoordinates = obj.weatherCoordinates;
if (obj.vpnLastConnected !== undefined && obj.vpnLastConnected !== "") {
_legacyVpnLastConnected = obj.vpnLastConnected;
SessionData.vpnLastConnected = _legacyVpnLastConnected;
SessionData.saveSettings();
}
_loadedSettingsSnapshot = JSON.stringify(Store.toJson(root)); _loadedSettingsSnapshot = JSON.stringify(Store.toJson(root));
_hasLoaded = true; _hasLoaded = true;

View File

@@ -69,7 +69,9 @@ var SPEC = {
hiddenApps: { def: [] }, hiddenApps: { def: [] },
appOverrides: { def: {} }, appOverrides: { def: {} },
searchAppActions: { def: true } searchAppActions: { def: true },
vpnLastConnected: { def: "" }
}; };
function getValidKeys() { function getValidKeys() {

View File

@@ -1,6 +1,6 @@
.pragma library .pragma library
.import "./SessionSpec.js" as SpecModule .import "./SessionSpec.js" as SpecModule
function parse(root, jsonObj) { function parse(root, jsonObj) {
var SPEC = SpecModule.SPEC; var SPEC = SpecModule.SPEC;
@@ -68,6 +68,11 @@ function migrateToVersion(obj, targetVersion, settingsData) {
session.configVersion = 2; session.configVersion = 2;
} }
if (currentVersion < 3) {
console.info("SessionData: Migrating session to version 3");
session.configVersion = 3;
}
return session; return session;
} }

View File

@@ -79,16 +79,18 @@ var SPEC = {
privacyShowCameraIcon: { def: false }, privacyShowCameraIcon: { def: false },
privacyShowScreenShareIcon: { def: false }, privacyShowScreenShareIcon: { def: false },
controlCenterWidgets: { def: [ controlCenterWidgets: {
{ id: "volumeSlider", enabled: true, width: 50 }, def: [
{ id: "brightnessSlider", enabled: true, width: 50 }, { id: "volumeSlider", enabled: true, width: 50 },
{ id: "wifi", enabled: true, width: 50 }, { id: "brightnessSlider", enabled: true, width: 50 },
{ id: "bluetooth", enabled: true, width: 50 }, { id: "wifi", enabled: true, width: 50 },
{ id: "audioOutput", enabled: true, width: 50 }, { id: "bluetooth", enabled: true, width: 50 },
{ id: "audioInput", enabled: true, width: 50 }, { id: "audioOutput", enabled: true, width: 50 },
{ id: "nightMode", enabled: true, width: 50 }, { id: "audioInput", enabled: true, width: 50 },
{ id: "darkMode", enabled: true, width: 50 } { id: "nightMode", enabled: true, width: 50 },
]}, { id: "darkMode", enabled: true, width: 50 }
]
},
showWorkspaceIndex: { def: false }, showWorkspaceIndex: { def: false },
showWorkspaceName: { def: false }, showWorkspaceName: { def: false },
@@ -119,13 +121,15 @@ var SPEC = {
keyboardLayoutNameCompactMode: { def: false }, keyboardLayoutNameCompactMode: { def: false },
runningAppsCurrentWorkspace: { def: false }, runningAppsCurrentWorkspace: { def: false },
runningAppsGroupByApp: { def: false }, runningAppsGroupByApp: { def: false },
appIdSubstitutions: { def: [ appIdSubstitutions: {
{ pattern: "Spotify", replacement: "spotify", type: "exact" }, def: [
{ pattern: "beepertexts", replacement: "beeper", type: "exact" }, { pattern: "Spotify", replacement: "spotify", type: "exact" },
{ pattern: "home assistant desktop", replacement: "homeassistant-desktop", type: "exact" }, { pattern: "beepertexts", replacement: "beeper", type: "exact" },
{ pattern: "com.transmissionbt.transmission", replacement: "transmission-gtk", type: "contains" }, { pattern: "home assistant desktop", replacement: "homeassistant-desktop", type: "exact" },
{ pattern: "^steam_app_(\\d+)$", replacement: "steam_icon_$1", type: "regex" } { pattern: "com.transmissionbt.transmission", replacement: "transmission-gtk", type: "contains" },
]}, { pattern: "^steam_app_(\\d+)$", replacement: "steam_icon_$1", type: "regex" }
]
},
centeringMode: { def: "index" }, centeringMode: { def: "index" },
clockDateFormat: { def: "" }, clockDateFormat: { def: "" },
lockDateFormat: { def: "" }, lockDateFormat: { def: "" },
@@ -153,7 +157,6 @@ var SPEC = {
weatherEnabled: { def: true }, weatherEnabled: { def: true },
networkPreference: { def: "auto" }, networkPreference: { def: "auto" },
vpnLastConnected: { def: "" },
iconTheme: { def: "System Default", onChange: "applyStoredIconTheme" }, iconTheme: { def: "System Default", onChange: "applyStoredIconTheme" },
availableIconThemes: { def: ["System Default"], persist: false }, availableIconThemes: { def: ["System Default"], persist: false },
@@ -306,7 +309,7 @@ var SPEC = {
osdAlwaysShowValue: { def: false }, osdAlwaysShowValue: { def: false },
osdPosition: { def: 5 }, osdPosition: { def: 5 },
osdVolumeEnabled: { def: true }, osdVolumeEnabled: { def: true },
osdMediaVolumeEnabled : { def: true }, osdMediaVolumeEnabled: { def: true },
osdBrightnessEnabled: { def: true }, osdBrightnessEnabled: { def: true },
osdIdleInhibitorEnabled: { def: true }, osdIdleInhibitorEnabled: { def: true },
osdMicMuteEnabled: { def: true }, osdMicMuteEnabled: { def: true },
@@ -337,52 +340,54 @@ var SPEC = {
niriOutputSettings: { def: {} }, niriOutputSettings: { def: {} },
hyprlandOutputSettings: { def: {} }, hyprlandOutputSettings: { def: {} },
barConfigs: { def: [{ barConfigs: {
id: "default", def: [{
name: "Main Bar", id: "default",
enabled: true, name: "Main Bar",
position: 0, enabled: true,
screenPreferences: ["all"], position: 0,
showOnLastDisplay: true, screenPreferences: ["all"],
leftWidgets: ["launcherButton", "workspaceSwitcher", "focusedWindow"], showOnLastDisplay: true,
centerWidgets: ["music", "clock", "weather"], leftWidgets: ["launcherButton", "workspaceSwitcher", "focusedWindow"],
rightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"], centerWidgets: ["music", "clock", "weather"],
spacing: 4, rightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"],
innerPadding: 4, spacing: 4,
bottomGap: 0, innerPadding: 4,
transparency: 1.0, bottomGap: 0,
widgetTransparency: 1.0, transparency: 1.0,
squareCorners: false, widgetTransparency: 1.0,
noBackground: false, squareCorners: false,
gothCornersEnabled: false, noBackground: false,
gothCornerRadiusOverride: false, gothCornersEnabled: false,
gothCornerRadiusValue: 12, gothCornerRadiusOverride: false,
borderEnabled: false, gothCornerRadiusValue: 12,
borderColor: "surfaceText", borderEnabled: false,
borderOpacity: 1.0, borderColor: "surfaceText",
borderThickness: 1, borderOpacity: 1.0,
widgetOutlineEnabled: false, borderThickness: 1,
widgetOutlineColor: "primary", widgetOutlineEnabled: false,
widgetOutlineOpacity: 1.0, widgetOutlineColor: "primary",
widgetOutlineThickness: 1, widgetOutlineOpacity: 1.0,
fontScale: 1.0, widgetOutlineThickness: 1,
autoHide: false, fontScale: 1.0,
autoHideDelay: 250, autoHide: false,
showOnWindowsOpen: false, autoHideDelay: 250,
openOnOverview: false, showOnWindowsOpen: false,
visible: true, openOnOverview: false,
popupGapsAuto: true, visible: true,
popupGapsManual: 4, popupGapsAuto: true,
maximizeDetection: true, popupGapsManual: 4,
scrollEnabled: true, maximizeDetection: true,
scrollXBehavior: "column", scrollEnabled: true,
scrollYBehavior: "workspace", scrollXBehavior: "column",
shadowIntensity: 0, scrollYBehavior: "workspace",
shadowOpacity: 60, shadowIntensity: 0,
shadowColorMode: "text", shadowOpacity: 60,
shadowCustomColor: "#000000", shadowColorMode: "text",
clickThrough: false shadowCustomColor: "#000000",
}], onChange: "updateBarConfigs" }, clickThrough: false
}], onChange: "updateBarConfigs"
},
desktopClockEnabled: { def: false }, desktopClockEnabled: { def: false },
desktopClockStyle: { def: "analog" }, desktopClockStyle: { def: "analog" },
@@ -437,7 +442,7 @@ var SPEC = {
}; };
function getValidKeys() { function getValidKeys() {
return Object.keys(SPEC).filter(function(k) { return SPEC[k].persist !== false; }).concat(["configVersion"]); return Object.keys(SPEC).filter(function (k) { return SPEC[k].persist !== false; }).concat(["configVersion"]);
} }
function set(root, key, value, saveFn, hooks) { function set(root, key, value, saveFn, hooks) {

View File

@@ -1,6 +1,6 @@
.pragma library .pragma library
.import "./SettingsSpec.js" as SpecModule .import "./SettingsSpec.js" as SpecModule
function parse(root, jsonObj) { function parse(root, jsonObj) {
var SPEC = SpecModule.SPEC; var SPEC = SpecModule.SPEC;

View File

@@ -48,9 +48,14 @@ Item {
Connections { Connections {
target: PluginService target: PluginService
function onRequestLauncherUpdate(pluginId) { function onRequestLauncherUpdate(pluginId) {
if (activePluginId === pluginId || searchQuery) { if (activePluginId === pluginId) {
if (activePluginCategories.length <= 1)
loadPluginCategories(pluginId);
performSearch(); performSearch();
return;
} }
if (searchQuery)
performSearch();
} }
} }
@@ -133,6 +138,8 @@ Item {
property string pluginFilter: "" property string pluginFilter: ""
property string activePluginName: "" property string activePluginName: ""
property var activePluginCategories: []
property string activePluginCategory: ""
function getSectionViewMode(sectionId) { function getSectionViewMode(sectionId) {
if (sectionId === "browse_plugins") if (sectionId === "browse_plugins")
@@ -307,10 +314,33 @@ Item {
isSearching = false; isSearching = false;
activePluginId = ""; activePluginId = "";
activePluginName = ""; activePluginName = "";
activePluginCategories = [];
activePluginCategory = "";
pluginFilter = ""; pluginFilter = "";
collapsedSections = {}; collapsedSections = {};
} }
function loadPluginCategories(pluginId) {
if (!pluginId) {
activePluginCategories = [];
activePluginCategory = "";
return;
}
const categories = AppSearchService.getPluginLauncherCategories(pluginId);
activePluginCategories = categories;
activePluginCategory = "";
AppSearchService.setPluginLauncherCategory(pluginId, "");
}
function setActivePluginCategory(categoryId) {
if (activePluginCategory === categoryId)
return;
activePluginCategory = categoryId;
AppSearchService.setPluginLauncherCategory(activePluginId, categoryId);
performSearch();
}
function clearPluginFilter() { function clearPluginFilter() {
if (pluginFilter) { if (pluginFilter) {
pluginFilter = ""; pluginFilter = "";
@@ -342,6 +372,8 @@ Item {
if (cachedSections && !searchQuery && searchMode === "all" && !pluginFilter) { if (cachedSections && !searchQuery && searchMode === "all" && !pluginFilter) {
activePluginId = ""; activePluginId = "";
activePluginName = ""; activePluginName = "";
activePluginCategories = [];
activePluginCategory = "";
clearActivePluginViewPreference(); clearActivePluginViewPreference();
sections = cachedSections.map(function (s) { sections = cachedSections.map(function (s) {
var copy = Object.assign({}, s, { var copy = Object.assign({}, s, {
@@ -363,10 +395,14 @@ Item {
var triggerMatch = detectTrigger(searchQuery); var triggerMatch = detectTrigger(searchQuery);
if (triggerMatch.pluginId) { if (triggerMatch.pluginId) {
var pluginChanged = activePluginId !== triggerMatch.pluginId;
activePluginId = triggerMatch.pluginId; activePluginId = triggerMatch.pluginId;
activePluginName = getPluginName(triggerMatch.pluginId, triggerMatch.isBuiltIn); activePluginName = getPluginName(triggerMatch.pluginId, triggerMatch.isBuiltIn);
applyActivePluginViewPreference(triggerMatch.pluginId, triggerMatch.isBuiltIn); applyActivePluginViewPreference(triggerMatch.pluginId, triggerMatch.isBuiltIn);
if (pluginChanged && !triggerMatch.isBuiltIn)
loadPluginCategories(triggerMatch.pluginId);
var pluginItems = getPluginItems(triggerMatch.pluginId, triggerMatch.query); var pluginItems = getPluginItems(triggerMatch.pluginId, triggerMatch.query);
allItems = allItems.concat(pluginItems); allItems = allItems.concat(pluginItems);
@@ -401,6 +437,8 @@ Item {
activePluginId = ""; activePluginId = "";
activePluginName = ""; activePluginName = "";
activePluginCategories = [];
activePluginCategory = "";
clearActivePluginViewPreference(); clearActivePluginViewPreference();
if (searchMode === "files") { if (searchMode === "files") {

View File

@@ -483,9 +483,64 @@ FocusScope {
} }
} }
Row {
id: categoryRow
width: parent.width
height: controller.activePluginCategories.length > 0 ? 36 : 0
visible: controller.activePluginCategories.length > 0
spacing: Theme.spacingS
clip: true
Behavior on height {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
DankDropdown {
id: categoryDropdown
width: Math.min(200, parent.width)
compactMode: true
dropdownWidth: 200
popupWidth: 240
maxPopupHeight: 300
enableFuzzySearch: controller.activePluginCategories.length > 8
currentValue: {
const cats = controller.activePluginCategories;
const current = controller.activePluginCategory;
if (!current)
return cats.length > 0 ? cats[0].name : "";
for (let i = 0; i < cats.length; i++) {
if (cats[i].id === current)
return cats[i].name;
}
return cats.length > 0 ? cats[0].name : "";
}
options: {
const cats = controller.activePluginCategories;
const names = [];
for (let i = 0; i < cats.length; i++)
names.push(cats[i].name);
return names;
}
onValueChanged: value => {
const cats = controller.activePluginCategories;
for (let i = 0; i < cats.length; i++) {
if (cats[i].name === value) {
controller.setActivePluginCategory(cats[i].id);
return;
}
}
}
}
}
Item { Item {
width: parent.width width: parent.width
height: parent.height - searchField.height - actionPanel.height - Theme.spacingXS * 2 height: parent.height - searchField.height - categoryRow.height - actionPanel.height - Theme.spacingXS * (categoryRow.visible ? 3 : 2)
opacity: root.parentModal?.isClosing ? 0 : 1 opacity: root.parentModal?.isClosing ? 0 : 1
ResultsList { ResultsList {

View File

@@ -884,4 +884,52 @@ Singleton {
return allItems; return allItems;
} }
function getPluginLauncherCategories(pluginId) {
if (typeof PluginService === "undefined")
return [];
const instance = PluginService.pluginInstances[pluginId];
if (!instance)
return [];
if (typeof instance.getCategories !== "function")
return [];
try {
return instance.getCategories() || [];
} catch (e) {
console.warn("AppSearchService: Error getting categories from plugin", pluginId, ":", e);
return [];
}
}
function setPluginLauncherCategory(pluginId, categoryId) {
if (typeof PluginService === "undefined")
return;
const instance = PluginService.pluginInstances[pluginId];
if (!instance)
return;
if (typeof instance.setCategory !== "function")
return;
try {
instance.setCategory(categoryId);
} catch (e) {
console.warn("AppSearchService: Error setting category on plugin", pluginId, ":", e);
}
}
function pluginHasCategories(pluginId) {
if (typeof PluginService === "undefined")
return false;
const instance = PluginService.pluginInstances[pluginId];
if (!instance)
return false;
return typeof instance.getCategories === "function";
}
} }

View File

@@ -130,7 +130,7 @@ Singleton {
Component.onCompleted: { Component.onCompleted: {
root.userPreference = SettingsData.networkPreference; root.userPreference = SettingsData.networkPreference;
lastConnectedVpnUuid = SettingsData.vpnLastConnected || ""; lastConnectedVpnUuid = SessionData.vpnLastConnected || "";
if (socketPath && socketPath.length > 0) { if (socketPath && socketPath.length > 0) {
checkDMSCapabilities(); checkDMSCapabilities();
} }
@@ -293,7 +293,7 @@ Singleton {
if (vpnConnected && activeUuid) { if (vpnConnected && activeUuid) {
lastConnectedVpnUuid = activeUuid; lastConnectedVpnUuid = activeUuid;
SettingsData.set("vpnLastConnected", activeUuid); SessionData.setVpnLastConnected(activeUuid);
} }
if (vpnIsBusy) { if (vpnIsBusy) {

View File

@@ -396,7 +396,6 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
root.currentValue = delegateRoot.modelData;
root.valueChanged(delegateRoot.modelData); root.valueChanged(delegateRoot.modelData);
dropdownMenu.close(); dropdownMenu.close();
} }