-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelNshell.py
More file actions
54 lines (52 loc) · 1.76 KB
/
Copy pathdelNshell.py
File metadata and controls
54 lines (52 loc) · 1.76 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
import pyperclip
import time
import os
from itranslate import itranslate as itrans
if __name__=='__main__':
print('we are now in clip del mode')
pyperclip.copy('start')
del_space_flag=0
to_keep_s=''
while 1:
time.sleep(0.5)
oldString=pyperclip.paste()
if oldString=='start' or oldString==to_keep_s:
continue
if '\n' in oldString:
if del_space_flag:
newString=oldString.replace('\r','').replace("-\n",'').replace("\n",' ')
print(newString)
print("---------------------------")
pyperclip.copy(newString)
try:
print(itrans(newString))
except:
pass
to_keep_s=newString
else:
newString=oldString.replace('\r','').replace("-\n",'').replace("\n",'')
print(newString)
print("---------------------------")
pyperclip.copy(newString)
try:
print(itrans(newString))
except:
pass
to_keep_s=newString
else:
newString=oldString
print(newString)
print("---------------------------")
pyperclip.copy(newString)
try:
print(itrans(newString))
except:
pass
to_keep_s=newString
if 'END'==oldString:
os.system('notify-send delN Stop')
break
if 'del_space'==oldString:
del_space_flag=1-del_space_flag
os.system("notify-send \"taggle del_space_flag {}\"".format(str(del_space_flag)))
pyperclip.copy(str(del_space_flag))