mirror of
https://github.com/harish2704/dotFiles.git
synced 2026-09-10 15:21:09 +00:00
Move from slow zx to python
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
|
||||
def ex(cmd):
|
||||
return subprocess.getoutput(cmd)
|
||||
|
||||
|
||||
engineList = ex('ibus read-config | grep preload-engines | sed "s/preload-engines://g; s/\'/\\"/g"')
|
||||
engineList = json.loads(engineList)
|
||||
|
||||
currentEngine = ex('ibus engine')
|
||||
currentEngineIdx = engineList.index(currentEngine);
|
||||
|
||||
nextEngineIdx = currentEngineIdx+1;
|
||||
if nextEngineIdx == len(engineList):
|
||||
nextEngineIdx=0
|
||||
|
||||
ex('ibus engine %s' % engineList[nextEngineIdx])
|
||||
Reference in New Issue
Block a user