Skip to content

Commit

Permalink
fix: add effect when previously misssing
Browse files Browse the repository at this point in the history
b73fef0 disabled the early return in onAddEffect for windows that
shouldn't have rounded corners, but this caused another bug (see #73).
This commit restores the early return, and adds a separate check in
refreshRoundedCorners to create the effect if it should be enabled but
doesn't exist.

Fixes #73
  • Loading branch information
flexagoon committed Jan 3, 2025
1 parent 521b137 commit 763b444
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/manager/event_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ import type {RoundedWindowActor} from '../utils/types.js';
export function onAddEffect(actor: RoundedWindowActor) {
logDebug(`opened: ${actor?.metaWindow.title}: ${actor}`);

const win = actor.metaWindow;

if (!shouldEnableEffect(win)) {
logDebug(`Skipping ${win.title}`);
return;
}

unwrapActor(actor)?.add_effect_with_name(
ROUNDED_CORNERS_EFFECT,
new RoundedCornersEffect(),
Expand Down Expand Up @@ -264,13 +271,19 @@ function refreshRoundedCorners(actor: RoundedWindowActor): void {
const windowInfo = actor.rwcCustomData;
const effect = getRoundedCornersEffect(actor);

const shouldHaveEffect = shouldEnableEffect(win);

if (!(effect && windowInfo)) {
if (shouldHaveEffect) {
logDebug(`Adding previously missing effect to ${win.title}`);
onAddEffect(actor);
}

return;
}

// Skip rounded corners when window is fullscreen & maximize
const cfg = getRoundedCornersCfg(win);
const shouldHaveEffect = shouldEnableEffect(win);

if (effect.enabled !== shouldHaveEffect) {
effect.enabled = shouldHaveEffect;
Expand Down

0 comments on commit 763b444

Please sign in to comment.