1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 14:32:52 -05:00

displays: workaround for duplicate models

This commit is contained in:
bbedward
2025-11-27 10:34:18 -05:00
parent 384c775f1a
commit 28ad641070
5 changed files with 92 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
@@ -16,10 +17,16 @@ Rectangle {
property string currentDeviceName: ""
function getScreenPinKey() {
if (!screenName)
return "";
const screen = Quickshell.screens.find(s => s.name === screenName);
if (screen) {
return SettingsData.getScreenDisplayName(screen);
}
if (SettingsData.displayNameMode === "model" && screenModel && screenModel.length > 0) {
return screenModel;
}
return screenName || "";
return screenName;
}
function resolveDeviceName() {

View File

@@ -1,4 +1,5 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Modules.Plugins
import qs.Services
@@ -79,10 +80,16 @@ BasePill {
}
function getScreenPinKey() {
if (!root.screenName)
return "";
const screen = Quickshell.screens.find(s => s.name === root.screenName);
if (screen) {
return SettingsData.getScreenDisplayName(screen);
}
if (SettingsData.displayNameMode === "model" && root.screenModel && root.screenModel.length > 0) {
return root.screenModel;
}
return root.screenName || "";
return root.screenName;
}
function getPinnedBrightnessDevice() {

View File

@@ -1486,17 +1486,26 @@ Item {
currentPrefs = [];
}
const screenModelIndex = SettingsData.getScreenModelIndex(screenData);
let newPrefs = currentPrefs.filter(pref => {
if (typeof pref === "string")
return false;
if (pref.modelIndex !== undefined && screenModelIndex >= 0) {
return !(pref.model === screenData.model && pref.modelIndex === screenModelIndex);
}
return pref.name !== screenData.name || pref.model !== screenData.model;
});
if (checked) {
newPrefs.push({
const prefObj = {
name: screenData.name,
model: screenData.model || ""
});
};
if (screenModelIndex >= 0) {
prefObj.modelIndex = screenModelIndex;
}
newPrefs.push(prefObj);
}
dankBarTab.setBarScreenPreferences(selectedBarId, newPrefs);

View File

@@ -691,9 +691,9 @@ Item {
StyledText {
text: {
if (parent.currentMode) {
return parent.currentMode.width + "×" + parent.currentMode.height + "@" + Math.round(parent.currentMode.refresh / 1000) + "Hz"
return parent.currentMode.width + "×" + parent.currentMode.height + "@" + Math.round(parent.currentMode.refresh / 1000) + "Hz";
}
return modelData.width + "×" + modelData.height
return modelData.width + "×" + modelData.height;
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
@@ -870,17 +870,26 @@ Item {
currentPrefs = [];
}
const screenModelIndex = SettingsData.getScreenModelIndex(screenData);
var newPrefs = currentPrefs.filter(pref => {
if (typeof pref === "string")
return false;
if (pref.modelIndex !== undefined && screenModelIndex >= 0) {
return !(pref.model === screenData.model && pref.modelIndex === screenModelIndex);
}
return pref.name !== screenData.name || pref.model !== screenData.model;
});
if (checked) {
newPrefs.push({
const prefObj = {
name: screenData.name,
model: screenData.model || ""
});
};
if (screenModelIndex >= 0) {
prefObj.modelIndex = screenModelIndex;
}
newPrefs.push(prefObj);
}
displaysTab.setScreenPreferences(componentId, newPrefs);