Merge pull request #2193 from tibssy/feat/dock-launcher-icon-selector

Feat/dock launcher icon selector
This commit is contained in:
Lemmy
2026-03-16 07:55:41 -04:00
committed by GitHub
6 changed files with 138 additions and 1 deletions
+34 -1
View File
@@ -237,7 +237,13 @@ Item {
return -1;
}
readonly property var launcherMetadata: BarWidgetRegistry.widgetMetadata["Launcher"]
readonly property string launcherIcon: launcherWidgetSettings.icon || (launcherMetadata && launcherMetadata.icon ? launcherMetadata.icon : "search")
readonly property string launcherIcon: {
if (Settings.data.dock.launcherIcon !== undefined && Settings.data.dock.launcherIcon !== "")
return Settings.data.dock.launcherIcon;
if (launcherWidgetSettings.icon !== undefined && launcherWidgetSettings.icon !== "")
return launcherWidgetSettings.icon;
return (launcherMetadata && launcherMetadata.icon) ? launcherMetadata.icon : "search";
}
readonly property string launcherIconColorKey: {
if (Settings.data.dock.launcherIconColor !== undefined)
return Settings.data.dock.launcherIconColor;
@@ -247,6 +253,15 @@ Item {
return launcherMetadata.iconColor;
return "none";
}
readonly property bool launcherUseDistroLogo: {
if (Settings.data.dock.launcherUseDistroLogo !== undefined)
return Settings.data.dock.launcherUseDistroLogo;
if (launcherWidgetSettings.useDistroLogo !== undefined)
return launcherWidgetSettings.useDistroLogo;
if (launcherMetadata && launcherMetadata.useDistroLogo !== undefined)
return launcherMetadata.useDistroLogo;
return false;
}
Item {
id: launcherIconContainer
@@ -268,6 +283,24 @@ Item {
icon: launcherButton.launcherIcon
pointSize: dockRoot.iconSize * 0.7
color: Color.resolveColorKey(launcherButton.launcherIconColorKey)
visible: !launcherButton.launcherUseDistroLogo
}
IconImage {
anchors.centerIn: parent
width: dockRoot.iconSize * 0.8
height: width
source: launcherButton.launcherUseDistroLogo ? HostService.osLogo : ""
visible: source !== ""
smooth: true
asynchronous: true
layer.enabled: visible
layer.effect: ShaderEffect {
property color targetColor: Color.resolveColorKey(launcherButton.launcherIconColorKey)
property real colorizeMode: 2.0
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
}
}
}
@@ -1,7 +1,9 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import qs.Commons
import qs.Services.System
import qs.Widgets
ColumnLayout {
@@ -9,6 +11,8 @@ ColumnLayout {
spacing: Style.marginL
Layout.fillWidth: true
readonly property color launcherPreviewColor: Color.resolveColorKey((Settings.data.dock.launcherIconColor !== undefined) ? Settings.data.dock.launcherIconColor : "none")
NToggle {
Layout.fillWidth: true
label: I18n.tr("panels.dock.enabled-label")
@@ -350,6 +354,74 @@ ColumnLayout {
onSelected: key => Settings.data.dock.launcherPosition = key
}
NToggle {
Layout.fillWidth: true
visible: Settings.data.dock.showLauncherIcon
label: I18n.tr("panels.dock.appearance-launcher-use-distro-logo-label")
description: I18n.tr("panels.dock.appearance-launcher-use-distro-logo-description")
checked: Settings.data.dock.launcherUseDistroLogo
defaultValue: Settings.getDefaultValue("dock.launcherUseDistroLogo")
onToggled: checked => Settings.data.dock.launcherUseDistroLogo = checked
}
RowLayout {
visible: Settings.data.dock.showLauncherIcon
Layout.fillWidth: true
NLabel {
Layout.fillWidth: true
label: I18n.tr("panels.dock.appearance-launcher-icon-label")
description: I18n.tr("panels.dock.appearance-launcher-icon-description")
}
NIconButton {
visible: !Settings.data.dock.launcherUseDistroLogo
enabled: !Settings.data.dock.launcherUseDistroLogo
icon: (Settings.data.dock.launcherIcon && Settings.data.dock.launcherIcon !== "") ? Settings.data.dock.launcherIcon : "search"
colorFg: root.launcherPreviewColor
colorFgHover: root.launcherPreviewColor
tooltipText: I18n.tr("bar.control-center.browse-library")
onClicked: launcherIconPicker.open()
}
Rectangle {
visible: Settings.data.dock.launcherUseDistroLogo
width: Style.toOdd(Style.baseWidgetSize * Style.uiScaleRatio)
height: width
radius: Math.min(Style.iRadiusL, width / 2)
color: Color.smartAlpha(Color.mSurfaceVariant)
border.color: Color.mOutline
border.width: Style.borderS
opacity: Style.opacityMedium
Image {
anchors.centerIn: parent
width: parent.width * 0.62
height: width
source: HostService.osLogo
fillMode: Image.PreserveAspectFit
smooth: true
asynchronous: true
layer.enabled: visible
layer.effect: ShaderEffect {
property color targetColor: root.launcherPreviewColor
property real colorizeMode: 2.0
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
}
}
}
}
NIconPicker {
id: launcherIconPicker
initialIcon: (Settings.data.dock.launcherIcon && Settings.data.dock.launcherIcon !== "") ? Settings.data.dock.launcherIcon : "search"
onIconSelected: iconName => {
Settings.data.dock.launcherIcon = iconName;
Settings.saveImmediate();
}
}
NColorChoice {
Layout.fillWidth: true
visible: Settings.data.dock.showLauncherIcon