def run(self):
if isWindows:
global windowsWindow
global isOnTop
wasOnTop = False
while True:
if windowsWindow:
focused = False
fg = win32gui.GetForegroundWindow()
if windowsWindow == fg:
focused = True
else:
for win in sublime.windows():
if win.hwnd() == fg:
focused = True
# print("focused....")
# print(focused)
if focused == False:
if isOnTop != False:
wasOnTop = True
set_always_on_top(False)
# print("moving to bottom")
if focused == True:
if isOnTop != True:
if wasOnTop == True:
wasOnTop = False
try:
win32gui.SetFocus(windowsWindow)
except Exception as e:
pass
time.sleep(0.1)
set_always_on_top(True)
# print("moving to top")
time.sleep(0.2)
else:
time.sleep(3)
评论列表
文章目录