@@ -121,7 +121,12 @@ async def _configure_windowrules(self, scratch: Scratch) -> None:
121
121
defined_class : str = scratch .conf .get ("class" , "" )
122
122
skipped_windowrules = scratch .conf .get ("skip_windowrules" , [])
123
123
if defined_class :
124
- monitor = await self .get_focused_monitor_props (name = scratch .conf .get ("force_monitor" ))
124
+ forced_monitor = scratch .conf .get ("force_monitor" )
125
+ if forced_monitor and forced_monitor not in state .monitors :
126
+ self .log .error ("forced monitor %s doesn't exist" , forced_monitor )
127
+ await self .notify_error (f"Monitor '{ forced_monitor } ' doesn't exist, check { scratch .uid } 's scratch configuration" )
128
+ forced_monitor = None
129
+ monitor = await self .get_focused_monitor_props (name = forced_monitor )
125
130
width , height = convert_coords (scratch .conf .get ("size" , "80% 80%" ), monitor )
126
131
127
132
ipc_commands = []
@@ -435,7 +440,7 @@ async def run_toggle(self, uid_or_uids: str) -> None:
435
440
) # visible on the currently focused monitor
436
441
437
442
is_visible = first_scratch .visible and (
438
- first_scratch .conf . get ( "force_monitor" ) or extra_visibility_check
443
+ first_scratch .forced_monitor or extra_visibility_check
439
444
) # always showing on the same monitor
440
445
tasks = []
441
446
@@ -455,7 +460,7 @@ async def get_offsets(self, scratch: Scratch, monitor: MonitorInfo | None = None
455
460
"""Return offset from config or use margin as a ref."""
456
461
offset = scratch .conf .get ("offset" )
457
462
if monitor is None :
458
- monitor = await get_focused_monitor_props (self .log , name = scratch .conf . get ( "force_monitor" ) )
463
+ monitor = await get_focused_monitor_props (self .log , name = scratch .forced_monitor )
459
464
rotated = is_rotated (monitor )
460
465
aspect = reversed (scratch .client_info ["size" ]) if rotated else scratch .client_info ["size" ]
461
466
@@ -540,7 +545,7 @@ async def run_show(self, uid: str) -> None:
540
545
541
546
scratch .visible = True
542
547
scratch .meta .space_identifier = get_active_space_identifier ()
543
- monitor = await self .get_focused_monitor_props (name = scratch .conf . get ( "force_monitor" ) )
548
+ monitor = await self .get_focused_monitor_props (name = scratch .forced_monitor )
544
549
545
550
assert monitor
546
551
assert scratch .full_address , "No address !"
0 commit comments