Add animation speed slider in general tab, always collapse activeWindow

GeneralTab: add animation speed slider
Workspace: set activeWindow to always collapsed except for hover
Misc: replaced a lot of animations with Style.animationXYZ
This commit is contained in:
Ly-sec 2025-08-27 14:52:50 +02:00
parent 563a151277
commit 124d9becc6
7 changed files with 55 additions and 34 deletions

View file

@ -140,6 +140,8 @@ Singleton {
property bool dimDesktop: false property bool dimDesktop: false
property bool showScreenCorners: false property bool showScreenCorners: false
property real radiusRatio: 1.0 property real radiusRatio: 1.0
// Animation speed multiplier (0.1x - 2.0x)
property real animationSpeed: 1.0
// Replace sidepanel toggle with distro logo (shown in bar and/or side panel) // Replace sidepanel toggle with distro logo (shown in bar and/or side panel)
property bool useDistroLogoForSidepanel: false property bool useDistroLogoForSidepanel: false
} }

View file

@ -56,9 +56,9 @@ Singleton {
property real opacityFull: 1.0 property real opacityFull: 1.0
// Animation duration (ms) // Animation duration (ms)
property int animationFast: 150 property int animationFast: Math.round(150 * Settings.data.general.animationSpeed)
property int animationNormal: 300 property int animationNormal: Math.round(300 * Settings.data.general.animationSpeed)
property int animationSlow: 450 property int animationSlow: Math.round(450 * Settings.data.general.animationSpeed)
// Dimensions // Dimensions
property int barHeight: 36 property int barHeight: 36

View file

@ -12,36 +12,16 @@ Row {
property ShellScreen screen property ShellScreen screen
property real scaling: ScalingService.scale(screen) property real scaling: ScalingService.scale(screen)
// Title stays collapsed by default; expands only on hover
property bool showingFullTitle: false property bool showingFullTitle: false
property int lastWindowIndex: -1
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
visible: getTitle() !== "" visible: getTitle() !== ""
// Timer to hide full title after window switch // Remove auto-expand timer; we rely solely on hover
Timer {
id: fullTitleTimer
interval: 2000
repeat: false
onTriggered: {
showingFullTitle = false
}
}
// Update text when window changes
Connections {
target: CompositorService
function onActiveWindowChanged() {
// Check if window actually changed
if (CompositorService.focusedWindowIndex !== lastWindowIndex) {
lastWindowIndex = CompositorService.focusedWindowIndex
showingFullTitle = true
fullTitleTimer.restart()
}
}
}
// No auto-expansion on window change; keep collapsed unless hovered
function getTitle() { function getTitle() {
// Use the service's focusedWindowTitle property which is updated immediately // Use the service's focusedWindowTitle property which is updated immediately
// when WindowOpenedOrChanged events are received // when WindowOpenedOrChanged events are received
@ -105,11 +85,10 @@ Row {
NText { NText {
id: titleText id: titleText
// If hovered or just switched window, show up to 400 pixels // Fix collapsed width to 150px to avoid layout shifts with neighbors
// If not hovered show up to 150 pixels // Expand up to 400px on hover
width: (showingFullTitle || mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth, width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth, 400 * scaling) : 150 * scaling
400 * scaling) : Math.min( horizontalAlignment: mouseArea.containsMouse ? Text.AlignLeft : Text.AlignHCenter
fullTitleMetrics.contentWidth, 150 * scaling)
text: getTitle() text: getTitle()
font.pointSize: Style.fontSizeS * scaling font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium font.weight: Style.fontWeightMedium

View file

@ -107,7 +107,7 @@ Item {
property: "masterProgress" property: "masterProgress"
from: 0.0 from: 0.0
to: 1.0 to: 1.0
duration: 1000 duration: Style.animationSlow * 2
easing.type: Easing.OutQuint easing.type: Easing.OutQuint
} }
PropertyAction { PropertyAction {

View file

@ -346,7 +346,7 @@ NPanel {
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0
to: 360 to: 360
duration: 2000 duration: Style.animationSlow * 4
} }
} }

View file

@ -164,6 +164,46 @@ ColumnLayout {
Layout.bottomMargin: Style.marginL * scaling Layout.bottomMargin: Style.marginL * scaling
} }
// Animation Speed
ColumnLayout {
spacing: Style.marginXXS * scaling
Layout.fillWidth: true
NText {
text: "Animation Speed"
font.pointSize: Style.fontSizeL * scaling
font.weight: Style.fontWeightBold
color: Color.mOnSurface
}
NText {
text: "Adjust global animation speed (0.1× to 2.0×)"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0.1
to: 2.0
stepSize: 0.01
value: Settings.data.general.animationSpeed
onMoved: Settings.data.general.animationSpeed = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.general.animationSpeed * 100) + "%"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginS * scaling
color: Color.mOnSurface
}
}
}
NText { NText {
text: "Fonts" text: "Fonts"
font.pointSize: Style.fontSizeXXL * scaling font.pointSize: Style.fontSizeXXL * scaling

View file

@ -9,7 +9,7 @@ Item {
property color color: Color.mPrimary property color color: Color.mPrimary
property int size: Style.baseWidgetSize * scaling property int size: Style.baseWidgetSize * scaling
property int strokeWidth: Style.borderL * scaling property int strokeWidth: Style.borderL * scaling
property int duration: 1000 property int duration: Style.animationSlow * 2
implicitWidth: size implicitWidth: size
implicitHeight: size implicitHeight: size