File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,9 @@ class MyApp(App[None]):
487487 INLINE_PADDING : ClassVar [int ] = 1
488488 """Number of blank lines above an inline app."""
489489
490+ SUSPENDED_SCREEN_CLASS : ClassVar [str ] = ""
491+ """Class to apply to suspended screens, or empty string for no class."""
492+
490493 _PSEUDO_CLASSES : ClassVar [dict [str , Callable [[App ], bool ]]] = {
491494 "focus" : lambda app : app .app_focus ,
492495 "blur" : lambda app : not app .app_focus ,
Original file line number Diff line number Diff line change @@ -1210,7 +1210,8 @@ def _screen_resized(self, size: Size):
12101210
12111211 def _on_screen_resume (self ) -> None :
12121212 """Screen has resumed."""
1213- self .remove_class ("-screen-suspended" )
1213+ if self .app .SUSPENDED_SCREEN_CLASS :
1214+ self .remove_class (self .app .SUSPENDED_SCREEN_CLASS )
12141215 self .stack_updates += 1
12151216 self .app ._refresh_notifications ()
12161217 size = self .app .size
@@ -1230,7 +1231,8 @@ def _on_screen_resume(self) -> None:
12301231
12311232 def _on_screen_suspend (self ) -> None :
12321233 """Screen has suspended."""
1233- self .add_class ("-screen-suspended" )
1234+ if self .app .SUSPENDED_SCREEN_CLASS :
1235+ self .add_class (self .app .SUSPENDED_SCREEN_CLASS )
12341236 self .app ._set_mouse_over (None )
12351237 self ._clear_tooltip ()
12361238 self .stack_updates += 1
Original file line number Diff line number Diff line change @@ -1960,6 +1960,7 @@ def test_ansi_command_palette(snap_compare):
19601960 """Test command palette on top of ANSI colors."""
19611961
19621962 class CommandPaletteApp (App [None ]):
1963+ SUSPENDED_SCREEN_CLASS = "-screen-suspended"
19631964 CSS = """
19641965 Label {
19651966 width: 1fr;
You can’t perform that action at this time.
0 commit comments