mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-05-31 17:54:41 +00:00
feat(mediamini): Add tri-state hideMode to MediaMini
This commit is contained in:
@@ -1034,9 +1034,9 @@
|
||||
}
|
||||
},
|
||||
"media-mini": {
|
||||
"auto-hide": {
|
||||
"label": "Hide automatically",
|
||||
"description": "Automatically hide the widget when no media is playing."
|
||||
"hide-mode": {
|
||||
"label": "Hiding mode",
|
||||
"description": "Controls how the widget behaves when no media is playing."
|
||||
},
|
||||
"show-album-art": {
|
||||
"label": "Show album art",
|
||||
|
||||
@@ -33,7 +33,7 @@ Item {
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
readonly property bool compact: (Settings.data.bar.density === "compact")
|
||||
|
||||
readonly property bool autoHide: (widgetSettings.autoHide !== undefined) ? widgetSettings.autoHide : widgetMetadata.autoHide
|
||||
readonly property string hideMode: (widgetSettings.hideMode !== undefined) ? widgetSettings.hideMode : "hidden" // "visible", "hidden", "transparent"
|
||||
readonly property bool showAlbumArt: (widgetSettings.showAlbumArt !== undefined) ? widgetSettings.showAlbumArt : widgetMetadata.showAlbumArt
|
||||
readonly property bool showVisualizer: (widgetSettings.showVisualizer !== undefined) ? widgetSettings.showVisualizer : widgetMetadata.showVisualizer
|
||||
readonly property string visualizerType: (widgetSettings.visualizerType !== undefined && widgetSettings.visualizerType !== "") ? widgetSettings.visualizerType : widgetMetadata.visualizerType
|
||||
@@ -63,7 +63,9 @@ Item {
|
||||
implicitHeight: visible ? ((barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)) : 0
|
||||
implicitWidth: visible ? ((barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (widgetWidth * scaling)) : 0
|
||||
|
||||
opacity: !autoHide || hasActivePlayer || (!hasActivePlayer && !autoHide) ? 1.0 : 0
|
||||
// "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty
|
||||
visible: hideMode !== "hidden" || hasActivePlayer
|
||||
opacity: hideMode !== "transparent" || hasActivePlayer ? 1.0 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationNormal
|
||||
|
||||
@@ -14,15 +14,21 @@ ColumnLayout {
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueAutoHide: widgetData.autoHide !== undefined ? widgetData.autoHide : widgetMetadata.autoHide
|
||||
property string valueHideMode: "hidden" // Default to 'Hide When Empty'
|
||||
property bool valueShowAlbumArt: widgetData.showAlbumArt !== undefined ? widgetData.showAlbumArt : widgetMetadata.showAlbumArt
|
||||
property bool valueShowVisualizer: widgetData.showVisualizer !== undefined ? widgetData.showVisualizer : widgetMetadata.showVisualizer
|
||||
property string valueVisualizerType: widgetData.visualizerType || widgetMetadata.visualizerType
|
||||
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
|
||||
|
||||
Component.onCompleted: {
|
||||
if (widgetData && widgetData.hideMode !== undefined) {
|
||||
valueHideMode = widgetData.hideMode
|
||||
}
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.autoHide = valueAutoHide
|
||||
settings.hideMode = valueHideMode
|
||||
settings.showAlbumArt = valueShowAlbumArt
|
||||
settings.showVisualizer = valueShowVisualizer
|
||||
settings.visualizerType = valueVisualizerType
|
||||
@@ -30,12 +36,24 @@ ColumnLayout {
|
||||
return settings
|
||||
}
|
||||
|
||||
NToggle {
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.media-mini.auto-hide.label")
|
||||
description: I18n.tr("bar.widget-settings.media-mini.auto-hide.description")
|
||||
checked: root.valueAutoHide
|
||||
onToggled: checked => root.valueAutoHide = checked
|
||||
label: I18n.tr("bar.widget-settings.media-mini.hide-mode.label")
|
||||
description: I18n.tr("bar.widget-settings.media-mini.hide-mode.description")
|
||||
model: [
|
||||
{
|
||||
"key": "visible",
|
||||
"name": I18n.tr("options.hide-modes.visible")
|
||||
}, {
|
||||
"key": "hidden",
|
||||
"name": I18n.tr("options.hide-modes.hidden")
|
||||
}, {
|
||||
"key": "transparent",
|
||||
"name": I18n.tr("options.hide-modes.transparent")
|
||||
}
|
||||
]
|
||||
currentKey: root.valueHideMode
|
||||
onSelected: key => root.valueHideMode = key
|
||||
}
|
||||
|
||||
NToggle {
|
||||
|
||||
Reference in New Issue
Block a user