Files
DankMaterialShell/quickshell/Widgets/WindowBlur.qml
T
Marlon Kranzandpurian23 0444835016 fix(frame): make connected mode honor the settings it overrides (#3665)
* fix(frame): make connected mode honor the settings it overrides

Several frame-mode behaviors contradicted what the settings UI shows:

- Frame -> Blur gated blur for every shell surface in connected mode,
  including the Settings window, polkit, context menus, OSDs and toasts.
  WindowBlur now defaults to Background blur; only surfaces painted
  with the frame color (connected popouts, slideouts, Control Center)
  follow Frame -> Blur, and frame-owned surfaces are blurred by the
  frame as before.
- The notepad slideout painted its own fill at the notepad
  transparency. On screens where the frame owns connected chrome it now
  claims a frame surface (new connected_arc slot 5), so the frame paints
  it flush with the cutout, with fillets, and follows the slide.
- Notification popups painted a card surface on top of the frame body,
  stacking fills. That layer is transparent when the frame paints it.
- Connected mode stripped shadow, border and corner styling from every
  bar, including bars on displays without a frame, and hid the rows.
  Styling is now stripped and restored per bar based on whether it
  covers a frame display, re-checked on screen, frame display and
  display-name-mode changes.
- Auto popup gaps and Gap size were hidden in separate mode although
  they still apply there; they now hide only in connected mode.
- The launcher style picker was hidden in connected mode while Island
  still overrode the connected launcher. Connected mode now always uses
  the connected launcher; the picker shows Full, disabled, with a note
  linking to the Bar layout picker.
- The frame shadow ignored Shadows -> Apply to -> Bars.

* fix(frame): address review feedback on connected mode

- Skip bar style reconciliation while the screen list is empty, so a
  hotplug doesn't restore and re-strip every bar.
- Replace the 16 copies of the connector blur anchor and cutout in
  FrameWindow with a ConnectorBlurRegion inline component.
- Let connected mode use the island launcher again now that the island
  can sit in any bar. The picker offers Full and Island there and hides
  Spotlight, which opens the full launcher in that mode anyway; the note
  and the SettingsControlledBy bar target are dropped.

* frame: address review findings on connected mode

---------

Co-authored-by: purian23 <[email protected]>
2026-10-10 00:04:17 -04:00

179 lines
5.1 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
import qs.Common
import qs.Services
Item {
id: root
visible: false
required property var targetWindow
property bool blurEnabled: true
property color surfaceColor: "transparent"
property real blurX: 0
property real blurY: 0
property real blurWidth: 0
property real blurHeight: 0
property real blurRadius: 0
property real blurBottomRadius: blurRadius
property bool clipEnabled: false
property real clipX: blurX
property real clipY: blurY
property real clipWidth: blurWidth
property real clipHeight: blurHeight
readonly property bool _active: blurEnabled && surfaceColor.a < 1 && BlurService.enabled && !!targetWindow
Region {
id: blurRegion
x: root.blurX
y: root.blurY
width: root.blurWidth
height: root.blurHeight
radius: root.blurRadius
Region {
readonly property bool needed: root.blurBottomRadius < root.blurRadius
x: root.blurX
y: root.blurY + root.blurRadius
width: needed ? root.blurWidth : 0
height: needed ? Math.max(0, root.blurHeight - root.blurRadius) : 0
radius: root.blurBottomRadius
}
Region {
intersection: Intersection.Intersect
x: root.clipEnabled ? root.clipX : root.blurX
y: root.clipEnabled ? root.clipY : root.blurY
width: root.clipEnabled ? root.clipWidth : root.blurWidth
height: root.clipEnabled ? root.clipHeight : root.blurHeight
}
// Hyprland blurs the whole surface when the region lies entirely outside it
Region {
intersection: Intersection.Intersect
width: root.targetWindow?.width ?? 0
height: root.targetWindow?.height ?? 0
}
}
function _apply() {
if (!targetWindow)
return;
targetWindow.BackgroundEffect.blurRegion = _active ? blurRegion : null;
}
function _clear() {
if (targetWindow)
targetWindow.BackgroundEffect.blurRegion = null;
}
// Re-publish blur region after wl_surface remaps (e.g. screen change).
function kick() {
if (!targetWindow)
return;
targetWindow.BackgroundEffect.blurRegion = null;
targetWindow.BackgroundEffect.blurRegion = _active ? blurRegion : null;
}
// Republish after geometry settles, plus one trailing pass.
onBlurXChanged: settleKickAction.restart()
onBlurYChanged: settleKickAction.restart()
onBlurWidthChanged: settleKickAction.restart()
onBlurHeightChanged: settleKickAction.restart()
onBlurRadiusChanged: settleKickAction.restart()
onBlurBottomRadiusChanged: settleKickAction.restart()
onClipEnabledChanged: settleKickAction.restart()
onClipXChanged: settleKickAction.restart()
onClipYChanged: settleKickAction.restart()
onClipWidthChanged: settleKickAction.restart()
onClipHeightChanged: settleKickAction.restart()
function _runSettleKick() {
if (!_active || !targetWindow?.visible)
return;
kick();
settleRepeatTimer.restart();
}
DeferredAction {
id: settleKickAction
interval: 16
onTriggered: root._runSettleKick()
}
Timer {
id: settleRepeatTimer
interval: 96
repeat: false
onTriggered: {
if (!root._active || !root.targetWindow?.visible)
return;
root.kick();
}
}
function _scheduleLifecycleKick() {
lifecycleKickAction.restart();
}
function _runLifecycleKick() {
if (!targetWindow)
return;
if (targetWindow.visible)
kick();
else
_apply();
}
on_ActiveChanged: {
if (_active)
_scheduleLifecycleKick();
else
_clear();
}
onTargetWindowChanged: {
lifecycleKickAction.cancel();
_apply();
}
DeferredAction {
id: lifecycleKickAction
onTriggered: root._runLifecycleKick()
}
Connections {
target: root.targetWindow ?? null
ignoreUnknownSignals: true
function onVisibleChanged() {
if (root.targetWindow && root.targetWindow.visible)
root._scheduleLifecycleKick();
else
root._clear();
}
function onWidthChanged() {
settleKickAction.restart();
}
function onHeightChanged() {
settleKickAction.restart();
}
function onResourcesLost() {
root._clear();
// Re-arm so blur self-heals since instances are no longer recreated per open
root._scheduleLifecycleKick();
}
function onWindowConnected() {
root._scheduleLifecycleKick();
}
}
Component.onCompleted: _scheduleLifecycleKick()
Component.onDestruction: {
lifecycleKickAction.cancel();
if (targetWindow && targetWindow.BackgroundEffect)
targetWindow.BackgroundEffect.blurRegion = null;
}
}