Skip to content

Commit

Permalink
prevent unexpected warning when macos is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Mar 22, 2018
1 parent 5b66a82 commit 70640fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ntfy/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from os import environ, ttyname
from subprocess import PIPE, Popen, check_output
from sys import platform, stdout
from screensaver import is_locked


def linux_window_is_focused():
Expand Down Expand Up @@ -36,6 +37,11 @@ def darwin_iterm2_shell_is_focused():


def darwin_terminal_shell_is_focused():
# The osascript for detecting window focus throws an error if the screen is
# locked, so we'll check that first.
if is_locked() == True:
return False

focused_tty = osascript_tell(
'Terminal',
'tty of (first tab of (first window whose frontmost is true) '
Expand Down

0 comments on commit 70640fb

Please sign in to comment.