diff --git a/ntfy/terminal.py b/ntfy/terminal.py index 6c73a33..3966b14 100644 --- a/ntfy/terminal.py +++ b/ntfy/terminal.py @@ -7,8 +7,10 @@ def linux_window_is_focused(): xprop_cmd = shlex.split('xprop -root _NET_ACTIVE_WINDOW') try: - xprop_window_id = int(check_output(xprop_cmd).split()[-1], 16) - except (ValueError, CalledProcessError): + xprop_window_id = int(check_output(xprop_cmd, stdout=PIPE, stderr=PIPE).split()[-1], 16) + except CalledProcessError: + return False + except ValueError: return False except OSError as e: if 'No such file' in e.strerror: