@@ -44,6 +44,7 @@ const { Gio, Meta, St } = imports.gi;
44
44
const { GlobalEvent, WindowEvent } = Events ;
45
45
const { cursor_rect, is_move_op } = Lib ;
46
46
const { layoutManager, loadTheme, overview, panel, setThemeStylesheet, screenShield, sessionMode } = imports . ui . main ;
47
+ const { ScreenShield } = imports . ui . screenShield ;
47
48
const Tags = Me . imports . tags ;
48
49
49
50
const STYLESHEET_PATHS = [ 'light' , 'dark' ] . map ( stylesheet_path ) ;
@@ -61,6 +62,12 @@ interface Monitor extends Rectangular {
61
62
index : number ;
62
63
}
63
64
65
+ interface Injection {
66
+ object : any ;
67
+ method : string ;
68
+ func : any ;
69
+ }
70
+
64
71
export class Ext extends Ecs . System < ExtEvent > {
65
72
/** Mechanism for managing keybindings */
66
73
keybindings : Keybindings . Keybindings = new Keybindings . Keybindings ( this ) ;
@@ -136,6 +143,9 @@ export class Ext extends Ecs.System<ExtEvent> {
136
143
/** A display config update is triggered on a workspace addition */
137
144
ignore_display_update : boolean = false ;
138
145
146
+ /** Functions replaced in GNOME */
147
+ injections : Array < Injection > = new Array ( ) ;
148
+
139
149
/** The last window that was focused */
140
150
last_focused : Entity | null = null ;
141
151
@@ -669,6 +679,26 @@ export class Ext extends Ecs.System<ExtEvent> {
669
679
return entity ? this . windows . get ( entity ) : null ;
670
680
}
671
681
682
+ inject ( object : any , method : string , func : any ) {
683
+ const prev = object [ method ] ;
684
+ this . injections . push ( { object, method, func : prev } )
685
+ object [ method ] = func ;
686
+ }
687
+
688
+ injections_add ( ) {
689
+ const screen_unlock_fn = ScreenShield . prototype [ 'deactivate' ] ;
690
+ this . inject ( ScreenShield . prototype , 'deactivate' , ( args : any ) => {
691
+ screen_unlock_fn . apply ( screenShield , [ args ] ) ;
692
+ this . update_display_configuration ( true ) ;
693
+ } )
694
+ }
695
+
696
+ injections_remove ( ) {
697
+ for ( const { object, method, func } of this . injections . splice ( 0 ) ) {
698
+ object [ method ] = func
699
+ }
700
+ }
701
+
672
702
load_settings ( ) {
673
703
this . set_gap_inner ( this . settings . gap_inner ( ) ) ;
674
704
this . set_gap_outer ( this . settings . gap_outer ( ) ) ;
@@ -1977,6 +2007,10 @@ export class Ext extends Ecs.System<ExtEvent> {
1977
2007
this . moved_by_mouse = false
1978
2008
}
1979
2009
2010
+ update_display_configuration_before ( ) {
2011
+
2012
+ }
2013
+
1980
2014
update_display_configuration ( workareas_only : boolean ) {
1981
2015
if ( ! this . auto_tiler || sessionMode . isLocked ) return
1982
2016
@@ -2339,6 +2373,7 @@ function enable() {
2339
2373
return ;
2340
2374
}
2341
2375
2376
+ ext . injections_add ( ) ;
2342
2377
ext . signals_attach ( ) ;
2343
2378
2344
2379
layoutManager . addChrome ( ext . overlay ) ;
@@ -2366,6 +2401,7 @@ function disable() {
2366
2401
return ;
2367
2402
}
2368
2403
2404
+ ext . injections_remove ( ) ;
2369
2405
ext . signals_remove ( ) ;
2370
2406
ext . exit_modes ( ) ;
2371
2407
ext . stop_launcher_services ( ) ;
0 commit comments