@@ -20,7 +20,7 @@ def _gjs_cmdline(self, code):
2020 SHELL_DBUS = "org.gnome.Shell"
2121 SHELL_OBJECT = "/org/gnome/Shell"
2222 EVAL_DBUS = "org.gnome.Shell.Eval"
23- code_full = f''' paperwm = Main.extensionManager.lookup("paperwm@paperwm.github.com").stateObj; { code } '''
23+ code_full = f''' let paperwm = Main.extensionManager.lookup("paperwm@paperwm.github.com").stateObj; { code } '''
2424 esc_code = code_full .replace ('"' , '\\ "' ).replace ('`' , '\\ `' )
2525 return f"sudo -u user gdbus call -a unix:path=/run/user/1000/bus -d { SHELL_DBUS } --object-path { SHELL_OBJECT } --method { EVAL_DBUS } \" { esc_code } \" "
2626
@@ -32,13 +32,18 @@ def libinput_play(self, recording):
3232
3333 def gjs_eval (self , code ):
3434 ''' Execute the specified GJS code from within the GNOME Shell process.
35+ Will raise Exception in the event of a GJS error.
3536 '''
36- return self .machine .succeed (self ._gjs_cmdline (code ))
37+ result = eval (self .machine .succeed (self ._gjs_cmdline (code )))
38+ if result [0 ]:
39+ return result [1 ]
40+ else :
41+ raise Exception (result [1 ])
3742
3843 def wait_for_paperwm (self ):
3944 ''' Wait until GNOME Shell is able to yield PaperWM internal state.
4045 '''
41- return self .machine .wait_until_succeeds (self ._gjs_cmdline ('paperwm.findModule("tiling").spaces._initDone' ))
46+ return self .machine .wait_until_succeeds (self ._gjs_cmdline ('paperwm.findModule("tiling").spaces._initDone' ) + "| grep \" (true, 'true') \" " )
4247
4348 def screenshot (self ):
4449 ''' Take a screenshot and load it as an OpenCV-compatible representation
0 commit comments