ActiveWindow: better autohide

This commit is contained in:
ItsLemmy
2025-09-25 08:42:10 -04:00
parent 644e24f409
commit 3809f290ed
4 changed files with 46 additions and 22 deletions
+3 -1
View File
@@ -774,7 +774,9 @@
"search-placeholder": "Search widgets..."
},
"active-window": {
"show-app-icon": "Show app icon"
"show-app-icon": "Show app icon",
"auto-hide": "Hide automatically",
"scrolling-mode": "Scrolling mode"
},
"system-monitor": {
"cpu-usage": "CPU usage",
+12 -3
View File
@@ -39,18 +39,27 @@ Item {
// Widget settings - matching MediaMini pattern
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : widgetMetadata.showIcon
readonly property bool autoHide: (widgetSettings.autoHide !== undefined) ? widgetSettings.autoHide : widgetMetadata.autoHide
readonly property string scrollingMode: (widgetSettings.scrollingMode !== undefined) ? widgetSettings.scrollingMode : (widgetMetadata.scrollingMode !== undefined ? widgetMetadata.scrollingMode : "hover")
// Fixed width
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 || hasActiveWindow ? 1.0 : 0
Behavior on opacity {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.OutCubic
}
}
function calculatedVerticalHeight() {
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
function getAppIcon() {
try {
// Try CompositorService first
@@ -15,22 +15,32 @@ ColumnLayout {
// Local state
property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon
property bool valueAutoHide: widgetData.autoHide !== undefined ? widgetData.autoHide : widgetMetadata.autoHide
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.autoHide = valueAutoHide
settings.showIcon = valueShowIcon
settings.scrollingMode = valueScrollingMode
console.log(JSON.stringify(settings))
return settings
}
NToggle {
id: showIcon
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.active-window.auto-hide")
checked: root.valueAutoHide
onToggled: checked => root.valueAutoHide = checked
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.active-window.show-app-icon")
checked: root.valueShowIcon
onToggled: checked => root.valueShowIcon = checked
}
NComboBox {
label: I18n.tr("bar.widget-settings.active-window.scrolling-mode")
model: [{
+20 -17
View File
@@ -41,6 +41,7 @@ Singleton {
"ActiveWindow": {
"allowUserSettings": true,
"showIcon": true,
"autoHide": true,
"scrollingMode": "hover"
},
"Battery": {
@@ -59,6 +60,12 @@ Singleton {
"formatHorizontal": "HH:mm ddd, MMM dd",
"formatVertical": "HH mm - dd MM"
},
"ControlCenter": {
"allowUserSettings": true,
"useDistroLogo": false,
"icon": "noctalia",
"customIconPath": ""
},
"CustomButton": {
"allowUserSettings": true,
"icon": "heart",
@@ -68,6 +75,19 @@ Singleton {
"textCommand": "",
"textIntervalMs": 3000
},
"KeyboardLayout": {
"allowUserSettings": true,
"displayMode": "onhover"
},
"MediaMini": {
"allowUserSettings": true,
"hideAutomatically": false,
"scrollingMode": "hover",
"showAlbumArt": false,
"showVisualizer": false,
"visualizerType": "linear",
"autoHide": false
},
"Microphone": {
"allowUserSettings": true,
"displayMode": "onhover"
@@ -95,26 +115,9 @@ Singleton {
"labelMode": "index",
"hideUnoccupied": false
},
"MediaMini": {
"allowUserSettings": true,
"showAlbumArt": false,
"showVisualizer": false,
"visualizerType": "linear",
"scrollingMode": "hover"
},
"ControlCenter": {
"allowUserSettings": true,
"useDistroLogo": false,
"icon": "noctalia",
"customIconPath": ""
},
"Volume": {
"allowUserSettings": true,
"displayMode": "onhover"
},
"KeyboardLayout": {
"allowUserSettings": true,
"displayMode": "onhover"
}
})