bar: save cpu usage

Stop window preview when not visible
This commit is contained in:
2 * r + 2 * t 2025-06-03 13:29:11 +08:00
parent 4f816e0abf
commit 5bd740abe7
2 changed files with 3 additions and 1 deletions

View file

@ -39,7 +39,7 @@ Item {
ScreencopyView {
id: preview
captureSource: ToplevelManager.toplevels.values.find(t => t.title === Hyprland.activeClient?.title) ?? null
captureSource: visible ? (ToplevelManager.toplevels.values.find(t => t.title === Hyprland.activeClient?.title) ?? null) : null
live: true
constraintSize.width: BarConfig.sizes.windowPreviewSize

View file

@ -8,6 +8,8 @@ Item {
required property ShellScreen screen
visible: width > 0 && height > 0
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight + BorderConfig.rounding * 2