Merge pull request #778 from lonerOrz/feat/bar

Feature: Add capsule opacity setting with conditional UI
This commit is contained in:
Lemmy
2025-11-17 08:10:54 -05:00
committed by GitHub
35 changed files with 137 additions and 39 deletions
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Widget-Hintergründe anzeigen.",
"label": "Kapsel anzeigen"
},
"capsule-opacity": {
"description": "Deckkraft der Widget-Hintergründe festlegen, wenn Kapsel angezeigt wird.",
"label": "Kapsel-Deckkraft"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Show widget backgrounds.",
"label": "Show capsule"
},
"capsule-opacity": {
"description": "Set the opacity level for widget backgrounds when capsule is shown.",
"label": "Capsule opacity"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Mostrar fondos de los widgets.",
"label": "Mostrar cápsula"
},
"capsule-opacity": {
"description": "Establecer el nivel de opacidad para los fondos de los widgets cuando se muestra la cápsula.",
"label": "Opacidad de la cápsula"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Afficher les arrière-plans des widgets.",
"label": "Afficher la capsule"
},
"capsule-opacity": {
"description": "Définir le niveau d'opacité des arrière-plans des widgets quand la capsule est affichée.",
"label": "Opacité de la capsule"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Widget-achtergronden tonen.",
"label": "Capsules tonen"
},
"capsule-opacity": {
"description": "Stel het doorzichtigheidsniveau in voor widget-achtergronden wanneer capsule wordt getoond.",
"label": "Capsule-doorzichtigheid"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Mostra o fundo dos widgets.",
"label": "Mostrar cápsula"
},
"capsule-opacity": {
"description": "Define o nível de opacidade para fundos dos widgets quando a cápsula é mostrada.",
"label": "Opacidade da cápsula"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Показывать фон виджетов.",
"label": "Показывать капсулу"
},
"capsule-opacity": {
"description": "Установить уровень непрозрачности для фона виджетов, когда капсула отображается.",
"label": "Непрозрачность капсулы"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Widget arka planlarını göster.",
"label": "Kapsülü göster"
},
"capsule-opacity": {
"description": "Kapsül gösterildiğinde widget arka planlarının saydamlık seviyesini ayarla.",
"label": "Kapsül saydamlığı"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "Показувати фон віджетів.",
"label": "Показувати капсулу"
},
"capsule-opacity": {
"description": "Встановити рівень непрозорості для фону віджетів, коли показано капсулу.",
"label": "Непрозорість капсули"
}
},
"monitors": {
+4
View File
@@ -818,6 +818,10 @@
"show-capsule": {
"description": "为每个小部件添加背景。",
"label": "显示组件背景"
},
"capsule-opacity": {
"description": "设置显示胶囊时小部件背景的不透明度。",
"label": "胶囊不透明度"
}
},
"monitors": {
+1
View File
@@ -7,6 +7,7 @@
"monitors": [],
"density": "default",
"showCapsule": true,
"capsuleOpacity": 1.0,
"floating": false,
"marginVertical": 0.25,
"marginHorizontal": 0.25,
+1
View File
@@ -141,6 +141,7 @@ Singleton {
property list<string> monitors: []
property string density: "default" // "compact", "default", "comfortable"
property bool showCapsule: true
property real capsuleOpacity: 1.0
// Floating bar settings
property bool floating: false
+3
View File
@@ -104,4 +104,7 @@ Singleton {
return Math.round(barHeight * 0.82);
}
}
readonly property color capsuleColor: Settings.data.bar.showCapsule ?
Qt.alpha(Color.mSurfaceVariant, Settings.data.bar.capsuleOpacity) :
Color.transparent
}
+21 -9
View File
@@ -72,6 +72,25 @@ Item {
}
}
// Unified background for the entire pill area to avoid overlapping opacity
Rectangle {
id: pillBackground
width: root.width
height: pillHeight
radius: halfPillHeight
color: hovered ? Color.mHover : Style.capsuleColor
anchors.verticalCenter: parent.verticalCenter
readonly property int halfPillHeight: Math.round(pillHeight * 0.5)
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
}
Rectangle {
id: pill
@@ -82,7 +101,7 @@ Item {
(iconCircle.x + iconCircle.width / 2) - width // Opens left
opacity: revealed ? Style.opacityFull : Style.opacityNone
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Color.transparent // Make pill background transparent to avoid double opacity
readonly property int halfPillHeight: Math.round(pillHeight * 0.5)
@@ -135,18 +154,11 @@ Item {
width: pillHeight
height: pillHeight
radius: width * 0.5
color: hovered ? Color.mHover : Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Color.transparent // Make icon background transparent to avoid double opacity
anchors.verticalCenter: parent.verticalCenter
x: oppositeDirection ? 0 : (parent.width - width)
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
NIcon {
icon: root.icon
pointSize: iconSize
+20 -9
View File
@@ -83,6 +83,24 @@ Item {
}
}
// Unified background for the entire pill area to avoid overlapping opacity
Rectangle {
id: pillBackground
width: buttonSize
height: revealed ? (buttonSize + maxPillHeight - pillOverlap) : buttonSize
radius: halfButtonSize
color: hovered ? Color.mHover : Style.capsuleColor
readonly property int halfButtonSize: Math.round(buttonSize * 0.5)
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
}
Rectangle {
id: pill
@@ -94,7 +112,7 @@ Item {
y: openUpward ? (iconCircle.y + iconCircle.height / 2 - height) : (iconCircle.y + iconCircle.height / 2)
opacity: revealed ? Style.opacityFull : Style.opacityNone
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Color.transparent // Make pill background transparent to avoid double opacity
readonly property int halfButtonSize: Math.round(buttonSize * 0.5)
@@ -158,20 +176,13 @@ Item {
width: buttonSize
height: buttonSize
radius: width * 0.5
color: hovered ? Color.mHover : Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Color.transparent // Make icon background transparent to avoid double opacity
// Icon positioning based on direction
x: 0
y: openUpward ? (parent.height - height) : 0
anchors.horizontalCenter: parent.horizontalCenter
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
NIcon {
icon: root.icon
pointSize: iconSize
+1 -1
View File
@@ -173,7 +173,7 @@ Item {
width: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : calculatedVerticalDimension()) : ((!hasFocusedWindow) && (hideMode === "hidden") ? 0 : dynamicWidth)
height: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : calculatedVerticalDimension()) : Style.capsuleHeight
radius: isVerticalBar ? width / 2 : Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
// Smooth width transition
Behavior on width {
+1 -1
View File
@@ -74,7 +74,7 @@ Item {
id: background
anchors.fill: parent
radius: Style.radiusS
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
}
// Store visualizer type to force re-evaluation
+1 -1
View File
@@ -46,7 +46,7 @@ Rectangle {
implicitHeight: isBarVertical ? Math.round(verticalLoader.implicitHeight + Style.marginS * 2) : Style.capsuleHeight
radius: Style.radiusS
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
Item {
id: clockContainer
+1 -1
View File
@@ -45,7 +45,7 @@ NIconButton {
baseSize: Style.capsuleHeight
applyUiScale: false
density: Settings.data.bar.density
colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBgHover: useDistroLogo ? Color.mSurfaceVariant : Color.mHover
colorBorder: Color.transparent
+1 -1
View File
@@ -14,7 +14,7 @@ NIconButton {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: Settings.data.colorSchemes.darkMode ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary
colorBg: Style.capsuleColor
colorFg: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mOnPrimary
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -45,7 +45,7 @@ Rectangle {
Layout.alignment: Qt.AlignVCenter
radius: Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
Item {
id: layout
+1 -1
View File
@@ -170,7 +170,7 @@ Item {
width: isVerticalBar ? ((shouldHideIdle || isEmptyForHideMode) ? 0 : calculatedVerticalDimension()) : ((shouldHideIdle || isEmptyForHideMode) ? 0 : dynamicWidth)
height: isVerticalBar ? ((shouldHideIdle || isEmptyForHideMode) ? 0 : calculatedVerticalDimension()) : Style.capsuleHeight
radius: isVerticalBar ? width / 2 : Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
// Smooth width transition
Behavior on width {
+1 -1
View File
@@ -17,7 +17,7 @@ NIconButton {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: Settings.data.nightLight.forced ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: Settings.data.nightLight.forced ? Color.mPrimary : Style.capsuleColor
colorFg: Settings.data.nightLight.forced ? Color.mOnPrimary : Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -17,7 +17,7 @@ NIconButton {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: PowerProfileService.noctaliaPerformanceMode ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: PowerProfileService.noctaliaPerformanceMode ? Color.mPrimary : Style.capsuleColor
colorFg: PowerProfileService.noctaliaPerformanceMode ? Color.mOnPrimary : Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -51,7 +51,7 @@ NIconButton {
icon: NotificationService.doNotDisturb ? "bell-off" : "bell"
tooltipText: NotificationService.doNotDisturb ? I18n.tr("tooltips.open-notification-history-disable-dnd") : I18n.tr("tooltips.open-notification-history-enable-dnd")
tooltipDirection: BarService.getTooltipDirection()
colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -21,7 +21,7 @@ NIconButton {
"profile": PowerProfileService.getName()
})
tooltipDirection: BarService.getTooltipDirection()
colorBg: (PowerProfileService.profile === PowerProfile.Balanced) ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary
colorBg: (PowerProfileService.profile === PowerProfile.Balanced) ? Style.capsuleColor : Color.mPrimary
colorFg: (PowerProfileService.profile === PowerProfile.Balanced) ? Color.mOnSurface : Color.mOnPrimary
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -17,7 +17,7 @@ NIconButton {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : Style.capsuleColor
colorFg: ScreenRecorderService.isRecording ? Color.mOnPrimary : Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -51,7 +51,7 @@ NIconButton {
icon: "power"
tooltipText: I18n.tr("tooltips.session-menu")
tooltipDirection: BarService.getTooltipDirection()
colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: Style.capsuleColor
colorFg: root.iconColor
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -108,7 +108,7 @@ Rectangle {
implicitWidth: isVertical ? Style.capsuleHeight : Math.round(mainGrid.implicitWidth + Style.marginM * 2)
implicitHeight: isVertical ? Math.round(mainGrid.implicitHeight + Style.marginM * 2) : Style.capsuleHeight
radius: Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
// Status indicator component definition
Component {
+1 -1
View File
@@ -90,7 +90,7 @@ Rectangle {
implicitWidth: visible ? (isVerticalBar ? Style.barHeight : Math.round(taskbarLayout.implicitWidth + Style.marginM * 2)) : 0
implicitHeight: visible ? (isVerticalBar ? Math.round(taskbarLayout.implicitHeight + Style.marginM * 2) : Style.barHeight) : 0
radius: Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
GridLayout {
id: taskbarLayout
+1 -1
View File
@@ -211,7 +211,7 @@ Item {
border.width: 1
width: (hasWindows ? iconsFlow.implicitWidth : root.itemSize * 0.8) + (root.isVerticalBar ? Style.marginXS : Style.marginL)
height: (hasWindows ? iconsFlow.implicitHeight : root.itemSize * 0.8) + (root.isVerticalBar ? Style.marginL : Style.marginXS)
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
MouseArea {
anchors.fill: parent
+3 -3
View File
@@ -225,7 +225,7 @@ Rectangle {
implicitWidth: isVertical ? Style.capsuleHeight : Math.round(trayFlow.implicitWidth)
implicitHeight: isVertical ? Math.round(trayFlow.implicitHeight) : Style.capsuleHeight
radius: Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
Flow {
id: trayFlow
@@ -241,7 +241,7 @@ Rectangle {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: Settings.data.colorSchemes.darkMode ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary
colorBg: Color.transparent
colorFg: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mOnPrimary
colorBorder: Color.transparent
colorBorderHover: Color.transparent
@@ -396,7 +396,7 @@ Rectangle {
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
colorBg: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
colorBg: Color.transparent
colorFg: Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -16,7 +16,7 @@ NIconButton {
icon: "wallpaper-selector"
tooltipText: I18n.tr("tooltips.open-wallpaper-selector")
tooltipDirection: BarService.getTooltipDirection()
colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent)
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
+1 -1
View File
@@ -225,7 +225,7 @@ Item {
width: isVertical ? Style.capsuleHeight : parent.width
height: isVertical ? parent.height : Style.capsuleHeight
radius: Style.radiusM
color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent
color: Style.capsuleColor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
+30
View File
@@ -89,6 +89,36 @@ ColumnLayout {
onToggled: checked => Settings.data.bar.showCapsule = checked
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginXXS
visible: Settings.data.bar.showCapsule
NText {
text: I18n.tr("settings.bar.appearance.capsule-opacity.label")
pointSize: Style.fontSizeS
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
}
NText {
text: I18n.tr("settings.bar.appearance.capsule-opacity.description")
pointSize: Style.fontSizeXS
color: Color.mOnSurfaceVariant
wrapMode: Text.WordWrap
}
NValueSlider {
Layout.fillWidth: true
from: 0
to: 1
stepSize: 0.01
value: Settings.data.bar.capsuleOpacity
onMoved: value => Settings.data.bar.capsuleOpacity = value
text: Math.floor(Settings.data.bar.capsuleOpacity * 100) + "%"
}
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("settings.bar.appearance.floating.label")