From: James Bunton Date: Sun, 25 Feb 2018 01:02:06 +0000 (+1100) Subject: xfdesktop-focus-fix: don't refocus when mediawrap is running X-Git-Url: https://code.delx.au/mediapc-tools/commitdiff_plain/2c16c206d8f9f54d6b9805c98cbe87b39d0abbaf xfdesktop-focus-fix: don't refocus when mediawrap is running --- diff --git a/xfdesktop-focus-fix b/xfdesktop-focus-fix index 757b562..b620932 100755 --- a/xfdesktop-focus-fix +++ b/xfdesktop-focus-fix @@ -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: