]> code.delx.au - mediapc-tools/commitdiff
xfdesktop-focus-fix: don't refocus when mediawrap is running
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 25 Feb 2018 01:02:06 +0000 (12:02 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 25 Feb 2018 01:02:06 +0000 (12:02 +1100)
xfdesktop-focus-fix

index 757b562262d52ca1c582c189bed16bc92b7aae8c..b620932c19aad46b8375b6a3d573453fcb91cda3 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python3
 
+import os
 import subprocess
 import time
 import Xlib
@@ -26,10 +27,16 @@ def is_active_window_change(event):
     )
 
 def handle_active_window_change():
+    if is_running_media_wrap():
+        return
+
     window_id = get_active_window_id()
     if not window_id:
         focus_xfdesktop()
 
+def is_running_media_wrap():
+    return os.path.isfile(os.path.expanduser("~/.mediawrap.lock"))
+
 def get_active_window_id():
     prop = root.get_full_property(NET_ACTIVE_WINDOW, Xlib.X.AnyPropertyType)
     if prop and prop.value: