@@ -10,7 +10,8 @@ class HotkeyListener():
10
10
def __init__ (self ):
11
11
try :
12
12
ShowWindow (Config .hwnd , SW_SHOW )
13
- tool .changeMute (Config .hwnd ,0 )
13
+ if Config .mute_after_hide :
14
+ tool .changeMute (Config .hwnd ,0 )
14
15
except :
15
16
pass
16
17
tool .sendNotify ("Boss Key正在运行!" , "Boss Key正在为您服务,您可通过托盘图标看到我" )
@@ -29,7 +30,6 @@ def reBind(self):
29
30
def BindHotKey (self ):
30
31
self .hotkeys = {
31
32
Config .hide_hotkey : self .onHide ,
32
- # Config.startup_hotkey: self.onStartup,
33
33
Config .close_hotkey : self .Close
34
34
}
35
35
self .hotkeys = tool .keyConvert (self .hotkeys )
@@ -38,33 +38,30 @@ def BindHotKey(self):
38
38
self .listener .start ()
39
39
40
40
def onHide (self ,e = "" ):
41
- Config .hwnd_n = GetForegroundWindow ()
42
41
if Config .times == 1 :
43
42
# 隐藏窗口
43
+ current = GetForegroundWindow ()
44
44
if Config .send_before_hide :
45
45
time .sleep (0.2 )
46
46
keyboard .Controller ().tap (keyboard .KeyCode .from_vk (0xB2 ))
47
47
48
- ShowWindow (Config . hwnd_n , SW_HIDE )
48
+ ShowWindow (current , SW_HIDE )
49
49
if Config .mute_after_hide :
50
- tool .changeMute (Config .hwnd_n ,1 )
51
- Config .hwnd_b = Config .hwnd_n
52
- Config .hwnd = Config .hwnd_b
50
+ tool .changeMute (current ,1 )
51
+ Config .hwnd = current
53
52
Config .times = 0
54
53
else :
55
54
# 显示窗口
56
- ShowWindow (Config .hwnd_b , SW_SHOW )
55
+ ShowWindow (Config .hwnd , SW_SHOW )
57
56
if Config .mute_after_hide :
58
- tool .changeMute (Config .hwnd_b ,0 )
59
- Config .hwnd_b = ""
57
+ tool .changeMute (Config .hwnd ,0 )
60
58
Config .times = 1
61
59
Config .save ()
62
60
63
61
def Close (self ,e = "" ):
64
62
tool .sendNotify ("Boss Key已停止服务" , "Boss Key已成功退出" )
65
63
if Config .times == 0 :
66
- ShowWindow (Config .hwnd_b , SW_SHOW )
67
- Config .hwnd_b = ""
64
+ ShowWindow (Config .hwnd , SW_SHOW )
68
65
Config .times = 1
69
66
70
67
self .stop ()
0 commit comments