We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dfb2a9c commit fb57d1aCopy full SHA for fb57d1a
1 file changed
ntfy/terminal.py
@@ -2,6 +2,7 @@
2
from os import environ, ttyname
3
from subprocess import PIPE, Popen, check_output
4
from sys import platform, stdout
5
+from screensaver import is_locked
6
7
8
def linux_window_is_focused():
@@ -36,6 +37,11 @@ def darwin_iterm2_shell_is_focused():
36
37
38
39
def darwin_terminal_shell_is_focused():
40
+ # The osascript for detecting window focus throws an error if the screen is
41
+ # locked, so we'll check that first.
42
+ if is_locked() == True:
43
+ return False
44
+
45
focused_tty = osascript_tell(
46
'Terminal',
47
'tty of (first tab of (first window whose frontmost is true) '
0 commit comments