Skip to content

Commit

Permalink
Enable rounded corners effect when gnome-shell is ready
Browse files Browse the repository at this point in the history
Closes #41

When gnome-shell is starting up, there is no windows to be added rounded
corners because `global.get_window_actors()` return a empty array. After
connect 'startup-complete' signal of 'imports.ui.Main.layoutManger', it
will ensure `global.get_window_actors()` will return all window actors
for this extensions.

Ref:
https://github.com/aunetx/blur-my-shell/blob/21d4bbde15acf7c3bf348f7375a12f7b14c3ab6f/src/extension.js#L87
  • Loading branch information
yilozt committed Aug 31, 2022
1 parent e611e7f commit 5bf47ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 7 additions & 1 deletion @imports/ui/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { LookingGlass } from "./lookingGlass";
import * as GObject from '@gi/GObject'

export const createLookingGlass: () => LookingGlass;

export const sessionMode = {
isLocked: boolean,
isGreeter: boolean
}
}

declare const layoutManager: {
_startingUp: boolean,
connect (_: 'startup-complete', cb: () => void)
} & GObject.Object
17 changes: 15 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { WindowPreview } from '@imports/ui/windowPreview'
import { WorkspaceGroup } from '@imports/ui/workspaceAnimation'
import { WindowManager } from '@imports/ui/windowManager'
import BackgroundMenu from '@imports/ui/backgroundMenu'
import { sessionMode } from '@imports/ui/main'
import { sessionMode, layoutManager } from '@imports/ui/main'

// local modules
import constants from './utils/constants'
Expand Down Expand Up @@ -62,7 +62,20 @@ export class Extension {
this._rounded_corners_manager = new RoundedCornersManager ()

this._services.export ()
this._enable_effect_managers ()

// Enable rounded corners effects when gnome-shell is ready
//
// https://github.com/aunetx/blur-my-shell/blob/
// 21d4bbde15acf7c3bf348f7375a12f7b14c3ab6f/src/extension.js#L87

if (layoutManager._startingUp) {
const id = layoutManager.connect ('startup-complete', () => {
this._enable_effect_managers ()
layoutManager.disconnect (id)
})
} else {
this._enable_effect_managers ()
}

// Have to toggle fullscreen for all windows when changed scale factor
// of windows because rounded-corners-manager may got incorrect frame
Expand Down

0 comments on commit 5bf47ef

Please sign in to comment.