-
Notifications
You must be signed in to change notification settings - Fork 0
/
configParser-set-defaults.py
56 lines (47 loc) · 2.07 KB
/
configParser-set-defaults.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# whereis here: ~/Documents/github/PycharmProjects/Lintalist4Linux/configParser-set-defaults.py
# it sets defaults to:
# - LintaList (configParser-set-ini-defaults.ahk)
# - autokey
import json
import os
from pathlib import Path
home = str(Path.home())
path = home + "/.config/autokey/data/Sample Scripts/"
jsonFilePath = home + "/.config/autokey/data/Sample Scripts/.run-run-lintalistAHK-all.json"
file = open(jsonFilePath)
data = json.load(file)
# for x in data['hotkey']:
data['hotkey']['hotKey'] = '<f12>'
if False:
subprocess = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
output, error = subprocess.communicate()
target_process = "autokey"
for line in output.splitlines():
if target_process in str(line):
pid = int(line.split(None, 1)[0])
os.kill(pid, 9)
else:
myCmd = 'sudo killall -9 autokey &'
os.system(myCmd) # print(data)
print(myCmd)
os.system("sleep 1s")
with open(jsonFilePath, 'w') as file:
json.dump(data, file, indent=2)
#/‾‾‾ configParser-set-ini-defaults.ahk
pathAutohotkeyExe = '/.wine/drive_c/Program\ Files/AutoHotkey/AutoHotkey.exe "'
myCmd = 'wine ' + home + pathAutohotkeyExe + home + '/ahk/github/lintalist/lintalist.ahk" &'
os.system(myCmd)
os.system("sleep 1s")
myCmd = 'wine ' + home + pathAutohotkeyExe + home + '/.config/autokey/data/Sample Scripts/configParser-set-ini-defaults.ahk" &'
# wine /home/m/.wine/drive_c/Program\ Files/AutoHotkey/AutoHotkey.exe "/home/m/.config/autokey/data/Sample Scripts/.config/autokey/data/Sample Scripts/configParser-set-ini-defaults.ahk" &
# works:
# wine /home/m/.wine/drive_c/Program\ Files/AutoHotkey/AutoHotkey.exe "/home/m/.config/autokey/data/Sample Scripts/configParser-set-ini-defaults.ahk" &
print(myCmd)
os.system(myCmd)
#\___ configParser-set-ini-defaults.ahk
# myCmd = 'autokey-qt' # sleep 1s ;
# myCmd = 'autokey > /dev/null &' # sleep 1s ;
myCmd = 'autokey > /dev/null &' # sleep 1s ;
print(myCmd)
os.system(myCmd)
# cd ~/.wine/drive_c/Program\ Files/AutoHotkey/ ; wine AutoHotkey.exe ~/ahk/github/lintalist/lintalist.ahk -opengl > /dev/null