mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
configurable animation speeds
This commit is contained in:
@@ -19,6 +19,14 @@ Singleton {
|
|||||||
Right
|
Right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum AnimationSpeed {
|
||||||
|
None,
|
||||||
|
Shortest,
|
||||||
|
Short,
|
||||||
|
Medium,
|
||||||
|
Long
|
||||||
|
}
|
||||||
|
|
||||||
// Theme settings
|
// Theme settings
|
||||||
property string currentThemeName: "blue"
|
property string currentThemeName: "blue"
|
||||||
property string customThemeFile: ""
|
property string customThemeFile: ""
|
||||||
@@ -151,6 +159,7 @@ Singleton {
|
|||||||
property int notificationTimeoutCritical: 0
|
property int notificationTimeoutCritical: 0
|
||||||
property int notificationPopupPosition: SettingsData.Position.Top
|
property int notificationPopupPosition: SettingsData.Position.Top
|
||||||
property var screenPreferences: ({})
|
property var screenPreferences: ({})
|
||||||
|
property int animationSpeed: SettingsData.AnimationSpeed.Short
|
||||||
readonly property string defaultFontFamily: "Inter Variable"
|
readonly property string defaultFontFamily: "Inter Variable"
|
||||||
readonly property string defaultMonoFontFamily: "Fira Code"
|
readonly property string defaultMonoFontFamily: "Fira Code"
|
||||||
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
||||||
@@ -350,6 +359,7 @@ Singleton {
|
|||||||
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
||||||
surfaceBase = settings.surfaceBase !== undefined ? settings.surfaceBase : "s"
|
surfaceBase = settings.surfaceBase !== undefined ? settings.surfaceBase : "s"
|
||||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
||||||
|
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : SettingsData.AnimationSpeed.Short
|
||||||
applyStoredTheme()
|
applyStoredTheme()
|
||||||
detectAvailableIconThemes()
|
detectAvailableIconThemes()
|
||||||
detectQtTools()
|
detectQtTools()
|
||||||
@@ -468,7 +478,8 @@ Singleton {
|
|||||||
"notificationTimeoutNormal": notificationTimeoutNormal,
|
"notificationTimeoutNormal": notificationTimeoutNormal,
|
||||||
"notificationTimeoutCritical": notificationTimeoutCritical,
|
"notificationTimeoutCritical": notificationTimeoutCritical,
|
||||||
"notificationPopupPosition": notificationPopupPosition,
|
"notificationPopupPosition": notificationPopupPosition,
|
||||||
"screenPreferences": screenPreferences
|
"screenPreferences": screenPreferences,
|
||||||
|
"animationSpeed": animationSpeed
|
||||||
}, null, 2))
|
}, null, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1229,6 +1240,11 @@ Singleton {
|
|||||||
return Quickshell.screens.filter(screen => prefs.includes(screen.name))
|
return Quickshell.screens.filter(screen => prefs.includes(screen.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setAnimationSpeed(speed) {
|
||||||
|
animationSpeed = speed
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function _shq(s) {
|
function _shq(s) {
|
||||||
return "'" + String(s).replace(/'/g, "'\\''") + "'"
|
return "'" + String(s).replace(/'/g, "'\\''") + "'"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,11 +235,22 @@ Singleton {
|
|||||||
property color shadowMedium: Qt.rgba(0, 0, 0, 0.08)
|
property color shadowMedium: Qt.rgba(0, 0, 0, 0.08)
|
||||||
property color shadowStrong: Qt.rgba(0, 0, 0, 0.3)
|
property color shadowStrong: Qt.rgba(0, 0, 0, 0.3)
|
||||||
|
|
||||||
property int shorterDuration: 100
|
readonly property var animationDurations: [
|
||||||
property int shortDuration: 150
|
{ shorter: 0, short: 0, medium: 0, long: 0, extraLong: 0 },
|
||||||
property int mediumDuration: 300
|
{ shorter: 50, short: 75, medium: 150, long: 250, extraLong: 500 },
|
||||||
property int longDuration: 500
|
{ shorter: 100, short: 150, medium: 300, long: 500, extraLong: 1000 },
|
||||||
property int extraLongDuration: 1000
|
{ shorter: 150, short: 225, medium: 450, long: 750, extraLong: 1500 },
|
||||||
|
{ shorter: 200, short: 300, medium: 600, long: 1000, extraLong: 2000 }
|
||||||
|
]
|
||||||
|
|
||||||
|
readonly property int currentAnimationSpeed: typeof SettingsData !== "undefined" ? SettingsData.animationSpeed : SettingsData.AnimationSpeed.Short
|
||||||
|
readonly property var currentDurations: animationDurations[currentAnimationSpeed] || animationDurations[SettingsData.AnimationSpeed.Short]
|
||||||
|
|
||||||
|
property int shorterDuration: currentDurations.shorter
|
||||||
|
property int shortDuration: currentDurations.short
|
||||||
|
property int mediumDuration: currentDurations.medium
|
||||||
|
property int longDuration: currentDurations.long
|
||||||
|
property int extraLongDuration: currentDurations.extraLong
|
||||||
property int standardEasing: Easing.OutCubic
|
property int standardEasing: Easing.OutCubic
|
||||||
property int emphasizedEasing: Easing.OutQuart
|
property int emphasizedEasing: Easing.OutQuart
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ PanelWindow {
|
|||||||
property bool closeOnEscapeKey: true
|
property bool closeOnEscapeKey: true
|
||||||
property bool closeOnBackgroundClick: true
|
property bool closeOnBackgroundClick: true
|
||||||
property string animationType: "scale"
|
property string animationType: "scale"
|
||||||
property int animationDuration: Theme.shorterDuration
|
property int animationDuration: Theme.shortDuration
|
||||||
property var animationEasing: Theme.emphasizedEasing
|
property var animationEasing: Theme.emphasizedEasing
|
||||||
property color backgroundColor: Theme.surfaceContainer
|
property color backgroundColor: Theme.surfaceContainer
|
||||||
property color borderColor: Theme.outlineMedium
|
property color borderColor: Theme.outlineMedium
|
||||||
@@ -91,7 +91,7 @@ PanelWindow {
|
|||||||
Timer {
|
Timer {
|
||||||
id: closeTimer
|
id: closeTimer
|
||||||
|
|
||||||
interval: animationDuration + 50
|
interval: animationDuration + 100
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,11 +32,7 @@ DankModal {
|
|||||||
function hide() {
|
function hide() {
|
||||||
spotlightOpen = false
|
spotlightOpen = false
|
||||||
close()
|
close()
|
||||||
if (contentLoader.item && contentLoader.item.appLauncher) {
|
cleanupTimer.restart()
|
||||||
contentLoader.item.appLauncher.searchQuery = ""
|
|
||||||
contentLoader.item.appLauncher.selectedIndex = 0
|
|
||||||
contentLoader.item.appLauncher.setCategory("All")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
@@ -73,6 +69,19 @@ DankModal {
|
|||||||
}
|
}
|
||||||
content: spotlightContent
|
content: spotlightContent
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: cleanupTimer
|
||||||
|
|
||||||
|
interval: animationDuration + 50
|
||||||
|
onTriggered: {
|
||||||
|
if (contentLoader.item && contentLoader.item.appLauncher) {
|
||||||
|
contentLoader.item.appLauncher.searchQuery = ""
|
||||||
|
contentLoader.item.appLauncher.selectedIndex = 0
|
||||||
|
contentLoader.item.appLauncher.setCategory("All")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onCloseAllModalsExcept(excludedModal) {
|
function onCloseAllModalsExcept(excludedModal) {
|
||||||
if (excludedModal !== spotlightModal && !allowStacking && spotlightOpen) {
|
if (excludedModal !== spotlightModal && !allowStacking && spotlightOpen) {
|
||||||
|
|||||||
@@ -1702,6 +1702,77 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Animation Settings
|
||||||
|
StyledRect {
|
||||||
|
width: parent.width
|
||||||
|
height: animationSection.implicitHeight + Theme.spacingL * 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceContainerHigh
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: animationSection
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "animation"
|
||||||
|
size: Theme.iconSize
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Animations"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Animation Speed"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Control the speed of animations throughout the interface"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
DankButtonGroup {
|
||||||
|
id: animationSpeedGroup
|
||||||
|
width: parent.width
|
||||||
|
model: ["None", "Shortest", "Short", "Medium", "Long"]
|
||||||
|
selectionMode: "single"
|
||||||
|
currentIndex: SettingsData.animationSpeed
|
||||||
|
onSelectionChanged: (index, selected) => {
|
||||||
|
if (selected) {
|
||||||
|
SettingsData.setAnimationSpeed(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Lock Screen Settings
|
// Lock Screen Settings
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ PanelWindow {
|
|||||||
property real triggerWidth: 40
|
property real triggerWidth: 40
|
||||||
property string triggerSection: ""
|
property string triggerSection: ""
|
||||||
property string positioning: "center"
|
property string positioning: "center"
|
||||||
property int animationDuration: Theme.mediumDuration
|
property int animationDuration: Theme.shortDuration
|
||||||
property var animationEasing: Theme.emphasizedEasing
|
property var animationEasing: Theme.emphasizedEasing
|
||||||
property bool shouldBeVisible: false
|
property bool shouldBeVisible: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user