1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-02 10:32:07 -04:00

(settings): Update monocrhrome & settings

This commit is contained in:
purian23
2026-04-25 15:29:27 -04:00
parent b8bfaf9a26
commit 5033bdc630
4 changed files with 40 additions and 25 deletions

View File

@@ -194,6 +194,7 @@ Singleton {
property int selectedGpuIndex: 0 property int selectedGpuIndex: 0
property var enabledGpuPciIds: [] property var enabledGpuPciIds: []
property bool showSystemTray: true property bool showSystemTray: true
property bool systemTrayMonochromeIcons: false
property bool showClock: true property bool showClock: true
property bool showNotificationButton: true property bool showNotificationButton: true
property bool showBattery: true property bool showBattery: true
@@ -1296,9 +1297,7 @@ Singleton {
return true; return true;
const msg = String(error || "").toLowerCase(); const msg = String(error || "").toLowerCase();
return msg.indexOf("file does not exist") !== -1 return msg.indexOf("file does not exist") !== -1 || msg.indexOf("no such file") !== -1 || msg.indexOf("enoent") !== -1;
|| msg.indexOf("no such file") !== -1
|| msg.indexOf("enoent") !== -1;
} }
function loadPluginSettings() { function loadPluginSettings() {

View File

@@ -69,6 +69,7 @@ var SPEC = {
selectedGpuIndex: { def: 0 }, selectedGpuIndex: { def: 0 },
enabledGpuPciIds: { def: [] }, enabledGpuPciIds: { def: [] },
showSystemTray: { def: true }, showSystemTray: { def: true },
systemTrayMonochromeIcons: { def: false },
showClock: { def: true }, showClock: { def: true },
showNotificationButton: { def: true }, showNotificationButton: { def: true },
showBattery: { def: true }, showBattery: { def: true },

View File

@@ -79,6 +79,7 @@ BasePill {
item: item item: item
})) }))
readonly property var hiddenBarItems: allSortedTrayItems.filter(item => SessionData.isHiddenTrayId(root.getTrayItemKey(item))) readonly property var hiddenBarItems: allSortedTrayItems.filter(item => SessionData.isHiddenTrayId(root.getTrayItemKey(item)))
readonly property bool trayIconsMonochrome: SettingsData.systemTrayMonochromeIcons ?? false
function moveTrayItemInFullOrder(visibleFromIndex, visibleToIndex) { function moveTrayItemInFullOrder(visibleFromIndex, visibleToIndex) {
if (visibleFromIndex === visibleToIndex || visibleFromIndex < 0 || visibleToIndex < 0) if (visibleFromIndex === visibleToIndex || visibleFromIndex < 0 || visibleToIndex < 0)
@@ -290,6 +291,10 @@ BasePill {
smooth: true smooth: true
mipmap: true mipmap: true
visible: status === Image.Ready visible: status === Image.Ready
layer.enabled: root.trayIconsMonochrome && visible
layer.effect: MultiEffect {
saturation: -1
}
} }
Text { Text {
@@ -550,6 +555,10 @@ BasePill {
smooth: true smooth: true
mipmap: true mipmap: true
visible: status === Image.Ready visible: status === Image.Ready
layer.enabled: root.trayIconsMonochrome && visible
layer.effect: MultiEffect {
saturation: -1
}
} }
Text { Text {
@@ -1067,6 +1076,10 @@ BasePill {
smooth: true smooth: true
mipmap: true mipmap: true
visible: status === Image.Ready visible: status === Image.Ready
layer.enabled: root.trayIconsMonochrome && visible
layer.effect: MultiEffect {
saturation: -1
}
} }
Text { Text {

View File

@@ -52,9 +52,11 @@ Item {
} }
function _isBarActive(c) { function _isBarActive(c) {
if (!c.enabled) return false; if (!c.enabled)
return false;
const prefs = c.screenPreferences || ["all"]; const prefs = c.screenPreferences || ["all"];
if (prefs.length > 0) return true; if (prefs.length > 0)
return true;
return (c.showOnLastDisplay ?? true) && Quickshell.screens.length === 1; return (c.showOnLastDisplay ?? true) && Quickshell.screens.length === 1;
} }
@@ -64,7 +66,8 @@ Item {
return; return;
const hasHorizontal = configs.some(c => { const hasHorizontal = configs.some(c => {
if (!_isBarActive(c)) return false; if (!_isBarActive(c))
return false;
const p = c.position ?? SettingsData.Position.Top; const p = c.position ?? SettingsData.Position.Top;
return p === SettingsData.Position.Top || p === SettingsData.Position.Bottom; return p === SettingsData.Position.Top || p === SettingsData.Position.Bottom;
}); });
@@ -72,7 +75,8 @@ Item {
return; return;
const hasVertical = configs.some(c => { const hasVertical = configs.some(c => {
if (!_isBarActive(c)) return false; if (!_isBarActive(c))
return false;
const p = c.position ?? SettingsData.Position.Top; const p = c.position ?? SettingsData.Position.Top;
return p === SettingsData.Position.Left || p === SettingsData.Position.Right; return p === SettingsData.Position.Left || p === SettingsData.Position.Right;
}); });
@@ -305,9 +309,7 @@ Item {
const prefs = cfg?.screenPreferences || ["all"]; const prefs = cfg?.screenPreferences || ["all"];
if (prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all")) if (prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all"))
return I18n.tr("All displays"); return I18n.tr("All displays");
return prefs.length === 1 return prefs.length === 1 ? I18n.tr("%1 display").arg(prefs.length) : I18n.tr("%1 displays").arg(prefs.length);
? I18n.tr("%1 display").arg(prefs.length)
: I18n.tr("%1 displays").arg(prefs.length);
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
@@ -419,7 +421,7 @@ Item {
iconName: "vertical_align_center" iconName: "vertical_align_center"
title: I18n.tr("Position") title: I18n.tr("Position")
settingKey: "barPosition" settingKey: "barPosition"
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
Item { Item {
width: parent.width width: parent.width
@@ -479,7 +481,7 @@ Item {
settingKey: "barDisplay" settingKey: "barDisplay"
collapsible: true collapsible: true
expanded: false expanded: false
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
StyledText { StyledText {
width: parent.width width: parent.width
@@ -586,7 +588,7 @@ Item {
settingKey: "barVisibility" settingKey: "barVisibility"
collapsible: true collapsible: true
expanded: false expanded: false
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
SettingsToggleRow { SettingsToggleRow {
text: I18n.tr("Auto-hide") text: I18n.tr("Auto-hide")
@@ -705,7 +707,7 @@ Item {
iconName: "space_bar" iconName: "space_bar"
title: I18n.tr("Spacing") title: I18n.tr("Spacing")
settingKey: "barSpacing" settingKey: "barSpacing"
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
SettingsSliderRow { SettingsSliderRow {
id: edgeSpacingSlider id: edgeSpacingSlider
@@ -852,7 +854,7 @@ Item {
iconName: "opacity" iconName: "opacity"
title: I18n.tr("Transparency") title: I18n.tr("Transparency")
settingKey: "barTransparency" settingKey: "barTransparency"
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
SettingsSliderRow { SettingsSliderRow {
id: barTransparencySlider id: barTransparencySlider
@@ -904,7 +906,7 @@ Item {
iconName: "text_fields" iconName: "text_fields"
title: I18n.tr("Font Scale") title: I18n.tr("Font Scale")
description: I18n.tr("Scale DankBar font sizes independently") description: I18n.tr("Scale DankBar font sizes independently")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
minimum: 50 minimum: 50
maximum: 200 maximum: 200
value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100) value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100)
@@ -929,7 +931,7 @@ Item {
iconName: "interests" iconName: "interests"
title: I18n.tr("Icon Scale") title: I18n.tr("Icon Scale")
description: I18n.tr("Scale DankBar icon sizes independently") description: I18n.tr("Scale DankBar icon sizes independently")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
minimum: 50 minimum: 50
maximum: 200 maximum: 200
value: Math.round((selectedBarConfig?.iconScale ?? 1.0) * 100) value: Math.round((selectedBarConfig?.iconScale ?? 1.0) * 100)
@@ -955,7 +957,7 @@ Item {
settingKey: "barCorners" settingKey: "barCorners"
collapsible: true collapsible: true
expanded: false expanded: false
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
SettingsToggleRow { SettingsToggleRow {
text: I18n.tr("Square Corners") text: I18n.tr("Square Corners")
@@ -1055,7 +1057,7 @@ Item {
iconName: "fit_screen" iconName: "fit_screen"
title: I18n.tr("Maximize Detection") title: I18n.tr("Maximize Detection")
description: I18n.tr("Remove gaps and border when windows are maximized") description: I18n.tr("Remove gaps and border when windows are maximized")
visible: selectedBarConfig?.enabled && (CompositorService.isNiri || CompositorService.isHyprland) visible: (selectedBarConfig?.enabled ?? false) && (CompositorService.isNiri || CompositorService.isHyprland)
checked: selectedBarConfig?.maximizeDetection ?? true checked: selectedBarConfig?.maximizeDetection ?? true
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
maximizeDetection: checked maximizeDetection: checked
@@ -1066,15 +1068,15 @@ Item {
iconName: "filter_b_and_w" iconName: "filter_b_and_w"
title: I18n.tr("Monochrome System Tray Icons") title: I18n.tr("Monochrome System Tray Icons")
description: I18n.tr("Desaturate all system tray icons for a uniform monochrome look") description: I18n.tr("Desaturate all system tray icons for a uniform monochrome look")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
checked: SettingsData.systemTrayMonochromeIcons checked: SettingsData.systemTrayMonochromeIcons ?? false
onToggled: checked => SettingsData.set("systemTrayMonochromeIcons", checked) onToggled: checked => SettingsData.set("systemTrayMonochromeIcons", checked)
} }
SettingsToggleCard { SettingsToggleCard {
iconName: "border_style" iconName: "border_style"
title: I18n.tr("Border") title: I18n.tr("Border")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
checked: selectedBarConfig?.borderEnabled ?? false checked: selectedBarConfig?.borderEnabled ?? false
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
borderEnabled: checked borderEnabled: checked
@@ -1164,7 +1166,7 @@ Item {
SettingsToggleCard { SettingsToggleCard {
iconName: "highlight" iconName: "highlight"
title: I18n.tr("Widget Outline") title: I18n.tr("Widget Outline")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
checked: selectedBarConfig?.widgetOutlineEnabled ?? false checked: selectedBarConfig?.widgetOutlineEnabled ?? false
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
widgetOutlineEnabled: checked widgetOutlineEnabled: checked
@@ -1258,7 +1260,7 @@ Item {
settingKey: "barShadow" settingKey: "barShadow"
collapsible: true collapsible: true
expanded: false expanded: false
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
readonly property bool shadowActive: (selectedBarConfig?.shadowIntensity ?? 0) > 0 readonly property bool shadowActive: (selectedBarConfig?.shadowIntensity ?? 0) > 0
readonly property bool isCustomColor: (selectedBarConfig?.shadowColorMode ?? "text") === "custom" readonly property bool isCustomColor: (selectedBarConfig?.shadowColorMode ?? "text") === "custom"
@@ -1383,7 +1385,7 @@ Item {
iconName: "mouse" iconName: "mouse"
title: I18n.tr("Scroll Wheel") title: I18n.tr("Scroll Wheel")
description: I18n.tr("Control workspaces and columns by scrolling on the bar") description: I18n.tr("Control workspaces and columns by scrolling on the bar")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled ?? false
checked: selectedBarConfig?.scrollEnabled ?? true checked: selectedBarConfig?.scrollEnabled ?? true
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
scrollEnabled: checked scrollEnabled: checked