ControlCenter: add colorize distro toggle

This commit is contained in:
Ly-sec
2025-11-10 12:47:49 +01:00
parent 5ec97ac750
commit c6bd84dfaa
13 changed files with 70 additions and 14 deletions
+12
View File
@@ -32,6 +32,11 @@ NIconButton {
readonly property string customIcon: widgetSettings.icon || widgetMetadata.icon
readonly property bool useDistroLogo: (widgetSettings.useDistroLogo !== undefined) ? widgetSettings.useDistroLogo : widgetMetadata.useDistroLogo
readonly property string customIconPath: widgetSettings.customIconPath || ""
readonly property bool colorizeDistroLogo: {
if (widgetSettings.colorizeDistroLogo !== undefined)
return widgetSettings.colorizeDistroLogo
return widgetMetadata.colorizeDistroLogo !== undefined ? widgetMetadata.colorizeDistroLogo : false
}
// If we have a custom path or distro logo, don't use the theme icon.
icon: (customIconPath === "" && !useDistroLogo) ? customIcon : ""
@@ -72,5 +77,12 @@ NIconButton {
visible: source !== ""
smooth: true
asynchronous: true
layer.enabled: useDistroLogo && colorizeDistroLogo
layer.effect: ShaderEffect {
property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant
property real colorizeMode: 1.0
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
}
}
}
@@ -17,12 +17,14 @@ ColumnLayout {
property string valueIcon: widgetData.icon !== undefined ? widgetData.icon : widgetMetadata.icon
property bool valueUseDistroLogo: widgetData.useDistroLogo !== undefined ? widgetData.useDistroLogo : widgetMetadata.useDistroLogo
property string valueCustomIconPath: widgetData.customIconPath !== undefined ? widgetData.customIconPath : ""
property bool valueColorizeDistroLogo: widgetData.colorizeDistroLogo !== undefined ? widgetData.colorizeDistroLogo : (widgetMetadata.colorizeDistroLogo !== undefined ? widgetMetadata.colorizeDistroLogo : false)
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.icon = valueIcon
settings.useDistroLogo = valueUseDistroLogo
settings.customIconPath = valueCustomIconPath
settings.colorizeDistroLogo = valueColorizeDistroLogo
return settings
}
@@ -39,6 +41,16 @@ ColumnLayout {
}
}
NToggle {
visible: valueUseDistroLogo
label: I18n.tr("bar.widget-settings.control-center.colorize-distro-logo.label")
description: I18n.tr("bar.widget-settings.control-center.colorize-distro-logo.description")
checked: valueColorizeDistroLogo
onToggled: function (checked) {
valueColorizeDistroLogo = checked
}
}
RowLayout {
spacing: Style.marginM
@@ -761,10 +761,10 @@ ColumnLayout {
NCheckbox {
label: "Spicetify"
description: ProgramCheckerService.spicetifyAvailable ? I18n.tr("settings.color-scheme.templates.programs.spicetify.description", {
"filepath": "~/.config/spicetify/Themes/Comfy/color.ini"
}) : I18n.tr("settings.color-scheme.templates.programs.spicetify.description-missing", {
"app": "spicetify"
})
"filepath": "~/.config/spicetify/Themes/Comfy/color.ini"
}) : I18n.tr("settings.color-scheme.templates.programs.spicetify.description-missing", {
"app": "spicetify"
})
checked: Settings.data.templates.spicetify
enabled: ProgramCheckerService.spicetifyAvailable
opacity: ProgramCheckerService.spicetifyAvailable ? 1.0 : 0.6