-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (28 loc) · 823 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from urllib.parse import unquote
from explorer import Explorer
#from menu_tray import Tray
from time import sleep
import keyboard
import os
## Set app in Windows System Tray
#Tray()
LOCALAPPDATA = os.environ['LOCALAPPDATA']
USERPROFILE = os.environ['USERPROFILE']
PATH_WT = os.path.join(LOCALAPPDATA, 'Microsoft', 'WindowsApps', 'wt.exe')
COMMAND_WT = f'{PATH_WT} -d'
PATH_CMD = f'start cmd /K cd "{USERPROFILE}"'
COMMAND_CMD = 'start cmd /K cd'
HOTKEY = 'ctrl+alt+t'
explorer = Explorer()
while True:
if keyboard.is_pressed(HOTKEY):
explorer_path = explorer.current_path()
# IF A WINDOWS EXPLORER WINDOW IS IN FOCUS
if explorer_path:
# COMMAND_WT OR COMMAND_CMD
os.popen(f'{COMMAND_CMD} "{unquote(explorer_path)}"')
else:
# PATH_WT OR PATH_CMD
os.popen(PATH_CMD)
sleep(0.2)
sleep(0.05)