Dimming: replaced dimmer by panel dimming, now that we have no margins it works fine.
This commit is contained in:
parent
7acca17b83
commit
0b790c219d
3 changed files with 6 additions and 82 deletions
|
|
@ -1,76 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
delegate: Loader {
|
||||
required property ShellScreen modelData
|
||||
|
||||
// Dimmer is only active on the screen where the panel is currently open.
|
||||
active: {
|
||||
if (Settings.isLoaded && Settings.data.general.dimDesktop && modelData !== undefined && PanelService.openedPanel !== null && PanelService.openedPanel.item !== undefined && PanelService.openedPanel.item !== null) {
|
||||
return (PanelService.openedPanel.item.screen === modelData)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
id: panel
|
||||
|
||||
property real customOpacity: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
if (modelData) {
|
||||
Logger.log("Dimmer", "Loaded on", modelData.name)
|
||||
}
|
||||
|
||||
// When a NPanel opens it seems it is initialized with the primary screen for a very brief moment
|
||||
// before the screen actually updates to the proper value. We use a timer to delay the fade in to avoid
|
||||
// a single frame flicker on the main screen when opening a panel on another screen.
|
||||
fadeInTimer.start()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PanelService
|
||||
function onWillClose() {
|
||||
customOpacity = Style.opacityNone
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: fadeInTimer
|
||||
interval: 100
|
||||
onTriggered: customOpacity = Style.opacityHeavy
|
||||
}
|
||||
|
||||
screen: modelData
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
WlrLayershell.namespace: "quickshell-dimmer"
|
||||
|
||||
// mask: Region {}
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
right: true
|
||||
left: true
|
||||
}
|
||||
|
||||
color: Qt.alpha(Color.mShadow, customOpacity)
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationSlow
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ Loader {
|
|||
readonly property real originalOpacity: 0.0
|
||||
property real scaleValue: originalScale
|
||||
property real opacityValue: originalOpacity
|
||||
property real dimmingOpacity: 0
|
||||
|
||||
property alias isClosing: hideTimer.running
|
||||
|
||||
|
|
@ -108,6 +109,7 @@ Loader {
|
|||
|
||||
// -----------------------------------------
|
||||
function close() {
|
||||
dimmingOpacity = 0
|
||||
scaleValue = originalScale
|
||||
opacityValue = originalOpacity
|
||||
hideTimer.start()
|
||||
|
|
@ -149,6 +151,7 @@ Loader {
|
|||
|
||||
Component.onCompleted: {
|
||||
Logger.log("NPanel", "Opened", root.objectName)
|
||||
dimmingOpacity = Style.opacityHeavy
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -174,17 +177,14 @@ Loader {
|
|||
|
||||
visible: true
|
||||
|
||||
// No dimming here
|
||||
color: Color.transparent
|
||||
|
||||
WlrLayershell.layer: Settings.data.general.dimDesktop ? WlrLayer.Overlay : WlrLayer.Top
|
||||
color: Settings.data.general.dimDesktop ? Qt.alpha(Color.mShadow, dimmingOpacity) : Color.transparent
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.namespace: "noctalia-panel"
|
||||
WlrLayershell.keyboardFocus: root.panelKeyboardFocus ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationNormal
|
||||
duration: Style.animationSlow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,6 +208,7 @@ Loader {
|
|||
onClicked: root.close()
|
||||
}
|
||||
|
||||
// The actual panel's content
|
||||
Rectangle {
|
||||
id: panelBackground
|
||||
color: panelBackgroundColor
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ ShellRoot {
|
|||
Background {}
|
||||
Overview {}
|
||||
ScreenCorners {}
|
||||
Dimmer {}
|
||||
Bar {}
|
||||
Dock {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue