@@ -244,7 +244,11 @@ export class Ext extends Ecs.System<ExtEvent> {
244
244
this . dbus . Launcher = ( ) => this . window_search . open ( this )
245
245
246
246
this . dbus . WindowFocus = ( window : [ number , number ] ) => {
247
- this . windows . get ( window ) ?. activate ( )
247
+ const target_window = this . windows . get ( window )
248
+ if ( target_window ) {
249
+ target_window . activate ( )
250
+ this . on_focused ( target_window )
251
+ }
248
252
this . window_search . close ( )
249
253
}
250
254
@@ -628,28 +632,24 @@ export class Ext extends Ecs.System<ExtEvent> {
628
632
}
629
633
630
634
focus_left ( ) {
631
- this . unmaximize_workspace ( null )
632
635
this . stack_select (
633
636
( id , stack ) => id === 0 ? null : stack . tabs [ id - 1 ] . entity ,
634
637
( ) => this . activate_window ( this . focus_selector . left ( this , null ) )
635
638
) ;
636
639
}
637
640
638
641
focus_right ( ) {
639
- this . unmaximize_workspace ( null )
640
642
this . stack_select (
641
643
( id , stack ) => stack . tabs . length > id + 1 ? stack . tabs [ id + 1 ] . entity : null ,
642
644
( ) => this . activate_window ( this . focus_selector . right ( this , null ) )
643
645
)
644
646
}
645
647
646
648
focus_down ( ) {
647
- this . unmaximize_workspace ( null )
648
649
this . activate_window ( this . focus_selector . down ( this , null ) )
649
650
}
650
651
651
652
focus_up ( ) {
652
- this . unmaximize_workspace ( null )
653
653
this . activate_window ( this . focus_selector . up ( this , null ) )
654
654
}
655
655
@@ -890,7 +890,7 @@ export class Ext extends Ecs.System<ExtEvent> {
890
890
let prev = this . windows . get ( this . prev_focused [ 0 ] ) ;
891
891
let is_attached = this . auto_tiler . attached . contains ( this . prev_focused [ 0 ] ) ;
892
892
893
- if ( prev && prev !== win && is_attached && prev . actor_exists ( ) && prev . name ( this ) !== win . name ( this ) ) {
893
+ if ( prev && prev !== win && is_attached && prev . actor_exists ( ) && prev . name ( this ) !== win . name ( this ) && prev . workspace_id ( ) === win . workspace_id ( ) ) {
894
894
if ( prev . rect ( ) . contains ( win . rect ( ) ) ) {
895
895
if ( prev . is_maximized ( ) ) {
896
896
prev . meta . unmaximize ( Meta . MaximizeFlags . BOTH ) ;
@@ -995,25 +995,24 @@ export class Ext extends Ecs.System<ExtEvent> {
995
995
}
996
996
997
997
/** Unmaximize any maximized windows on the same workspace. */
998
- unmaximize_workspace ( win : Window . ShellWindow | null ) {
998
+ unmaximize_workspace ( win : Window . ShellWindow ) {
999
999
if ( this . auto_tiler ) {
1000
1000
let mon
1001
1001
let work
1002
1002
1003
- if ( win == null ) {
1004
- [ mon , work ] = this . workspace_id ( )
1005
- } else {
1006
- mon = win . meta . get_monitor ( )
1007
- work = win . meta . get_workspace ( ) . index ( )
1003
+ if ( ! win . is_tilable ( this ) ) {
1004
+ return
1008
1005
}
1006
+
1007
+ mon = win . meta . get_monitor ( )
1008
+ work = win . meta . get_workspace ( ) . index ( )
1009
1009
1010
1010
for ( const [ , compare ] of this . windows . iter ( ) ) {
1011
1011
const is_same_space = compare . meta . get_monitor ( ) === mon
1012
- && compare . meta . get_workspace ( ) . index ( ) === work ;
1013
- if ( is_same_space && ! this . contains_tag ( compare . entity , Tags . Floating ) ) {
1014
- if ( compare . is_maximized ( ) ) {
1012
+ && compare . meta . get_workspace ( ) . index ( ) === work ;
1013
+
1014
+ if ( is_same_space && ! this . contains_tag ( compare . entity , Tags . Floating ) && compare . is_maximized ( ) && win . entity [ 0 ] !== compare . entity [ 0 ] ) {
1015
1015
compare . meta . unmaximize ( Meta . MaximizeFlags . BOTH ) ;
1016
- }
1017
1016
}
1018
1017
}
1019
1018
}
0 commit comments