diff --git a/src/manager/event_handlers.ts b/src/manager/event_handlers.ts index d2f948b..e2cce2b 100644 --- a/src/manager/event_handlers.ts +++ b/src/manager/event_handlers.ts @@ -24,7 +24,6 @@ import { getRoundedCornersCfg, getRoundedCornersEffect, shouldEnableEffect, - unwrapActor, updateShadowActorStyle, windowScaleFactor, } from './utils.js'; @@ -43,10 +42,12 @@ export function onAddEffect(actor: RoundedWindowActor) { return; } - unwrapActor(actor)?.add_effect_with_name( - ROUNDED_CORNERS_EFFECT, - new RoundedCornersEffect(), - ); + actor + .get_last_child() + ?.add_effect_with_name( + ROUNDED_CORNERS_EFFECT, + new RoundedCornersEffect(), + ); const shadow = createShadow(actor); @@ -80,7 +81,7 @@ export function onAddEffect(actor: RoundedWindowActor) { export function onRemoveEffect(actor: RoundedWindowActor): void { const name = ROUNDED_CORNERS_EFFECT; - unwrapActor(actor)?.remove_effect_by_name(name); + actor.get_last_child()?.remove_effect_by_name(name); // Remove shadow actor const shadow = actor.rwcCustomData?.shadow; diff --git a/src/manager/event_manager.ts b/src/manager/event_manager.ts index e707049..df92df5 100644 --- a/src/manager/event_manager.ts +++ b/src/manager/event_manager.ts @@ -135,10 +135,20 @@ function applyEffectTo(actor: RoundedWindowActor) { // In wayland sessions, the surface actor of XWayland clients is sometimes // not ready when the window is created. In this case, we wait until it is // ready before applying the effect. - if (!actor.firstChild) { - const id = actor.connect('notify::first-child', () => { - applyEffectTo(actor); - actor.disconnect(id); + // For Blur My Shell compatibility, we have to make sure that the actor is + // not a bms-application-blurred-widget. This actor is created by BMS and + // is not the actual window actor. + const bmsActorName = 'bms-application-blurred-widget'; + const actorReady = + (actor.firstChild && actor.firstChild.name !== bmsActorName) || + (actor.lastChild && actor.lastChild.name !== bmsActorName); + + if (!actorReady) { + const id = actor.connect('child-added', (actor, child) => { + if (child.name !== bmsActorName) { + applyEffectTo(actor); + actor.disconnect(id); + } }); return; diff --git a/src/manager/utils.ts b/src/manager/utils.ts index b570626..4fda923 100644 --- a/src/manager/utils.ts +++ b/src/manager/utils.ts @@ -18,19 +18,6 @@ import type Clutter from 'gi://Clutter'; import type {RoundedCornersEffect} from '../effect/rounded_corners_effect.js'; import type {Bounds, RoundedCornerSettings} from '../utils/types.js'; -/** - * Get the actor that rounded corners should be applied to. - * In Wayland, the effect is applied to WindowActor, but in X11, it is applied - * to WindowActor.first_child. - * - * @param actor - The window actor to unwrap. - * @returns The correct actor that the effect should be applied to. - */ -export function unwrapActor(actor: Meta.WindowActor): Clutter.Actor | null { - const type = actor.metaWindow.get_client_type(); - return type === Meta.WindowClientType.X11 ? actor.get_first_child() : actor; -} - /** * Get the correct rounded corner setting for a window (custom settings if a * window has custom overrides, global settings otherwise). @@ -67,11 +54,8 @@ type RoundedCornersEffectType = InstanceType; export function getRoundedCornersEffect( actor: Meta.WindowActor, ): RoundedCornersEffectType | null { - const win = actor.metaWindow; const name = ROUNDED_CORNERS_EFFECT; - return win.get_client_type() === Meta.WindowClientType.X11 - ? (actor.firstChild.get_effect(name) as RoundedCornersEffectType) - : (actor.get_effect(name) as RoundedCornersEffectType); + return actor.lastChild.get_effect(name) as RoundedCornersEffectType; } /**