1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 04:42:05 -04:00

feat(lockscreen): enable use of videos as screensaver in the lock screen (#1819)

* feat(lockscreen): enable use of videos as screensaver in the lock screen

* reducing debug logs

* feature becomes available only when QtMultimedia is available
This commit is contained in:
Augusto César Dias
2026-02-26 17:02:50 +01:00
committed by GitHub
parent 5d09acca4c
commit bd6ad53875
7 changed files with 370 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Modals.FileBrowser
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
@@ -8,6 +9,16 @@ import qs.Modules.Settings.Widgets
Item {
id: root
FileBrowserModal {
id: videoBrowserModal
browserTitle: I18n.tr("Select Video or Folder")
browserIcon: "movie"
browserType: "video"
showHiddenFiles: false
fileExtensions: ["*.mp4", "*.mkv", "*.webm", "*.mov", "*.avi", "*.m4v"]
onFileSelected: path => SettingsData.set("lockScreenVideoPath", path)
}
DankFlickable {
anchors.fill: parent
clip: true
@@ -168,6 +179,87 @@ Item {
}
}
SettingsCard {
width: parent.width
iconName: "movie"
title: I18n.tr("Video Screensaver")
settingKey: "videoScreensaver"
StyledText {
visible: !MultimediaService.available
text: I18n.tr("QtMultimedia is not available - video screensaver requires qt multimedia services")
font.pixelSize: Theme.fontSizeSmall
color: Theme.warning
width: parent.width
wrapMode: Text.WordWrap
}
SettingsToggleRow {
settingKey: "lockScreenVideoEnabled"
tags: ["lock", "screen", "video", "screensaver", "animation", "movie"]
text: I18n.tr("Enable Video Screensaver")
description: I18n.tr("Play a video when the screen locks.")
enabled: MultimediaService.available
checked: SettingsData.lockScreenVideoEnabled
onToggled: checked => SettingsData.set("lockScreenVideoEnabled", checked)
}
Column {
width: parent.width
spacing: Theme.spacingXS
visible: SettingsData.lockScreenVideoEnabled && MultimediaService.available
StyledText {
text: I18n.tr("Video Path")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: I18n.tr("Path to a video file or folder containing videos")
font.pixelSize: Theme.fontSizeXSmall
color: Theme.outlineVariant
wrapMode: Text.WordWrap
width: parent.width
}
Row {
width: parent.width
spacing: Theme.spacingS
DankTextField {
id: videoPathField
width: parent.width - browseVideoButton.width - Theme.spacingS
placeholderText: I18n.tr("/path/to/videos")
text: SettingsData.lockScreenVideoPath
backgroundColor: Theme.surfaceContainerHighest
onTextChanged: {
if (text !== SettingsData.lockScreenVideoPath) {
SettingsData.set("lockScreenVideoPath", text);
}
}
}
DankButton {
id: browseVideoButton
text: I18n.tr("Browse")
onClicked: videoBrowserModal.open()
}
}
}
SettingsToggleRow {
settingKey: "lockScreenVideoCycling"
tags: ["lock", "screen", "video", "screensaver", "cycling", "random", "shuffle"]
text: I18n.tr("Automatic Cycling")
description: I18n.tr("Pick a different random video each time from the same folder")
visible: SettingsData.lockScreenVideoEnabled && MultimediaService.available
enabled: MultimediaService.available
checked: SettingsData.lockScreenVideoCycling
onToggled: checked => SettingsData.set("lockScreenVideoCycling", checked)
}
}
SettingsCard {
width: parent.width
iconName: "monitor"