mirror of
https://github.com/harish2704/dotFiles.git
synced 2026-09-10 07:11:09 +00:00
Move from slow zx to python
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env zx
|
|
||||||
|
|
||||||
|
|
||||||
let engineList = await $`ibus read-config | grep preload-engines | sed "s/preload-engines://g; s/'/\\"/g"`
|
|
||||||
|
|
||||||
engineList = JSON.parse(engineList)
|
|
||||||
|
|
||||||
let currentEngine = await $`ibus engine`
|
|
||||||
currentEngine = currentEngine.toString().trim()
|
|
||||||
|
|
||||||
let currentEngineIdx = engineList.indexOf(currentEngine);
|
|
||||||
|
|
||||||
let nextEngineIdx = currentEngineIdx+1;
|
|
||||||
if( nextEngineIdx === engineList.length ){
|
|
||||||
nextEngineIdx=0
|
|
||||||
}
|
|
||||||
|
|
||||||
await $`ibus engine ${engineList[nextEngineIdx]}`
|
|
||||||
+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])
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
./bin/chromium
|
./bin/chromium
|
||||||
./bin/hari-tools.sh
|
./bin/hari-tools.sh
|
||||||
./bin/bash-session
|
./bin/bash-session
|
||||||
./bin/ibus-next-engine.mjs
|
./bin/ibus-next-engine.py
|
||||||
|
|||||||
Reference in New Issue
Block a user