Skip to content

Commit

Permalink
Restore windows when gnome-shell is unlocked
Browse files Browse the repository at this point in the history
  • Loading branch information
LuoYi committed Aug 2, 2022
1 parent 85b3a7f commit 469213e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion resources/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Rounded Window Corners",
"description": "Add rounded corners for all windows",
"uuid": "rounded-window-corners@yilozt",
"version": "v1",
"version": "4",
"url": "https://github.com/yilozt/rounded-window-corners",
"shell-version": ["40", "41", "42"]
}
21 changes: 17 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { WM } from '@gi/Shell'
import { WindowPreview } from '@imports/ui/windowPreview'
import { RoundedCornersCfg } from './utils/types'
import { Window, WindowActor } from '@gi/Meta'
import { global } from '@global'

// --------------------------------------------------------------- [end imports]
export class Extension {
Expand Down Expand Up @@ -70,29 +71,41 @@ export class Extension {
// solve this problem.

const monitor_manager = MonitorManager.get ()
type _Window = Window & { __extensions_rounded_window_fs?: 1 }

Connections.get ().connect (monitor_manager, 'monitors-changed', () => {
if (sessionMode.isLocked || sessionMode.isGreeter) {
return
}
for (const win of this._rounded_corners_manager?.windows () ?? []) {
(win as Window & { __fs?: 1 }).__fs = 1
(win as _Window).__extensions_rounded_window_fs = 1
win.make_fullscreen ()
}

// waiting 3 seconds then restore marked windows.
this._timeout_handler = timeout_add_seconds (0, 3, () => {
for (const _win of this._rounded_corners_manager?.windows () ??
[]) {
const win = _win as Window & { __fs?: 1 }
if (win && win.__fs == 1) {
const win = _win as _Window
if (win && win.__extensions_rounded_window_fs == 1) {
win.unmake_fullscreen ()
delete win.__fs
delete win.__extensions_rounded_window_fs
}
}
return false
})
})

// Restore window that have __extensions_rounded_window_fs props when
// unlocked
for (const win_actor of global.get_window_actors ()) {
const win = win_actor.meta_window as _Window
if (win.__extensions_rounded_window_fs === 1) {
win.unmake_fullscreen ()
delete win.__extensions_rounded_window_fs
}
}

const self = this

// When there is new window added into overview, this function will be
Expand Down

0 comments on commit 469213e

Please sign in to comment.