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
+4
View File
@@ -1141,6 +1141,10 @@
"appearance-launcher-position-end": "End",
"appearance-launcher-position-label": "Launcher position",
"appearance-launcher-position-start": "Start",
"appearance-launcher-use-distro-logo-description": "Use your distribution logo as the dock launcher icon.",
"appearance-launcher-use-distro-logo-label": "Use distro logo instead of icon",
"appearance-launcher-icon-description": "Choose the icon used for the dock launcher.",
"appearance-launcher-icon-label": "Launcher icon",
"appearance-pinned-static-description": "Always push pinned app icons to the left in static order.",
"appearance-pinned-static-label": "Static pinned apps",
"appearance-position-description": "Choose where the dock appears on screen.",
+2
View File
@@ -361,6 +361,8 @@
"colorizeIcons": false,
"showLauncherIcon": false,
"launcherPosition": "end",
"launcherUseDistroLogo": false,
"launcherIcon": "",
"launcherIconColor": "none",
"pinnedStatic": false,
"inactiveIndicators": false,
+24
View File
@@ -1185,6 +1185,30 @@
"Settings.data.dock.showLauncherIcon"
]
},
{
"labelKey": "panels.dock.appearance-launcher-use-distro-logo-label",
"descriptionKey": "panels.dock.appearance-launcher-use-distro-logo-description",
"widget": "NToggle",
"tab": 5,
"tabLabel": "panels.dock.title",
"subTab": 0,
"subTabLabel": "common.appearance",
"visibleWhen": [
"Settings.data.dock.showLauncherIcon"
]
},
{
"labelKey": "panels.dock.appearance-launcher-icon-label",
"descriptionKey": "panels.dock.appearance-launcher-icon-description",
"widget": "NIconButton",
"tab": 5,
"tabLabel": "panels.dock.title",
"subTab": 0,
"subTabLabel": "common.appearance",
"visibleWhen": [
"Settings.data.dock.showLauncherIcon"
]
},
{
"labelKey": "common.select-icon-color",
"descriptionKey": null,
+2
View File
@@ -555,6 +555,8 @@ Singleton {
property bool colorizeIcons: false
property bool showLauncherIcon: false
property string launcherPosition: "end" // "start", "end"
property bool launcherUseDistroLogo: false
property string launcherIcon: ""
property string launcherIconColor: "none"
property bool pinnedStatic: false
property bool inactiveIndicators: false
+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