MediaMini: autoHide

This commit is contained in:
ItsLemmy
2025-09-25 08:49:01 -04:00
parent 0690ac4996
commit 0f888fd734
5 changed files with 33 additions and 23 deletions
+2 -1
View File
@@ -774,8 +774,8 @@
"search-placeholder": "Search widgets..."
},
"active-window": {
"show-app-icon": "Show app icon",
"auto-hide": "Hide automatically",
"show-app-icon": "Show app icon",
"scrolling-mode": "Scrolling mode"
},
"system-monitor": {
@@ -867,6 +867,7 @@
}
},
"media-mini": {
"auto-hide": "Hide automatically",
"show-album-art": "Show album art",
"show-visualizer": "Show visualizer",
"visualizer-type": "Visualizer type",
+12 -3
View File
@@ -33,6 +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 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
@@ -41,6 +42,17 @@ Item {
// Fixed width - no expansion
readonly property real widgetWidth: Math.max(1, screen.width * 0.06)
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 || getTitle() !== "" ? 1.0 : 0
Behavior on opacity {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.OutCubic
}
}
function getTitle() {
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
}
@@ -49,9 +61,6 @@ Item {
return Math.round(Style.baseWidgetSize * 0.8 * scaling)
}
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
// A hidden text element to safely measure the full title width
NText {
id: fullTitleMetrics
@@ -14,6 +14,7 @@ ColumnLayout {
property var widgetMetadata: null
// Local state
property bool valueAutoHide: widgetData.autoHide !== undefined ? widgetData.autoHide : widgetMetadata.autoHide
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
@@ -21,6 +22,7 @@ ColumnLayout {
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.autoHide = valueAutoHide
settings.showAlbumArt = valueShowAlbumArt
settings.showVisualizer = valueShowVisualizer
settings.visualizerType = valueVisualizerType
@@ -28,6 +30,13 @@ ColumnLayout {
return settings
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.media-mini.auto-hide")
checked: root.valueAutoHide
onToggled: checked => root.valueAutoHide = checked
}
NToggle {
label: I18n.tr("bar.widget-settings.media-mini.show-album-art")
checked: valueShowAlbumArt
+2 -3
View File
@@ -81,12 +81,11 @@ Singleton {
},
"MediaMini": {
"allowUserSettings": true,
"hideAutomatically": false,
"autoHide": true,
"scrollingMode": "hover",
"showAlbumArt": false,
"showVisualizer": false,
"visualizerType": "linear",
"autoHide": false
"visualizerType": "linear"
},
"Microphone": {
"allowUserSettings": true,
+8 -16
View File
@@ -66,8 +66,7 @@ Rectangle {
"token": "ddd, MMM dd",
"description": I18n.tr("widgets.datetime-tokens.common.weekday-date"),
"example": "Fri, Dec 12"
},
// Hour tokens
}, // Hour tokens
{
"category": "Hour",
"token": "H",
@@ -78,8 +77,7 @@ Rectangle {
"token": "HH",
"description": I18n.tr("widgets.datetime-tokens.hour.leading-zero"),
"example": "14"
},
// Minute tokens
}, // Minute tokens
{
"category": "Minute",
"token": "m",
@@ -90,8 +88,7 @@ Rectangle {
"token": "mm",
"description": I18n.tr("widgets.datetime-tokens.minute.leading-zero"),
"example": "30"
},
// Second tokens
}, // Second tokens
{
"category": "Second",
"token": "s",
@@ -102,8 +99,7 @@ Rectangle {
"token": "ss",
"description": I18n.tr("widgets.datetime-tokens.second.leading-zero"),
"example": "45"
},
// AM/PM tokens
}, // AM/PM tokens
{
"category": "AM/PM",
"token": "AP",
@@ -114,15 +110,13 @@ Rectangle {
"token": "ap",
"description": I18n.tr("widgets.datetime-tokens.ampm.lowercase"),
"example": "pm"
},
// Timezone tokens
}, // Timezone tokens
{
"category": "Timezone",
"token": "t",
"description": I18n.tr("widgets.datetime-tokens.timezone.abbreviation"),
"example": "UTC"
},
// Year tokens
}, // Year tokens
{
"category": "Year",
"token": "yy",
@@ -133,8 +127,7 @@ Rectangle {
"token": "yyyy",
"description": I18n.tr("widgets.datetime-tokens.year.four-digit"),
"example": "2023"
},
// Month tokens
}, // Month tokens
{
"category": "Month",
"token": "M",
@@ -155,8 +148,7 @@ Rectangle {
"token": "MMMM",
"description": I18n.tr("widgets.datetime-tokens.month.full"),
"example": "December"
},
// Day tokens
}, // Day tokens
{
"category": "Day",
"token": "d",