Friday, July 14, 2017

swtich applications with gpicker

1- compile gpicker
$ git clone https://github.com/alk/gpicker.git
$ cd gpicker
$ ./bookstrap
$ ./configure
$ ./make

2- to start the application switcher
$ wmctrl -i -a `wmctrl -l -x | gpicker --sync -n "\n" -d "\n" -`

or can be used the script to below to remove some unwanted strings


*** gpicker-script ***

import os
import re

wm = os.popen("wmctrl -l -x").read()
wml = wm.split("\n")
wmdic = {}
inx = 1
for i in wml:
   
    if i != "":
        i = re.sub(r"(compname)\s", "", i)
        i = re.sub("\'", "", i)
        il = i.split()
        prox = " ".join(il[3:])

        list1 = prox + " " + il[2] + " " + il[1]
        wmdic[list1] = il[0]
        #print list1
        inx += 1
wmlist = "\n".join(wmdic.keys())
x = os.popen("echo '" + wmlist + "'| gpicker -l -n '\n' -d '\n' -").read()

os.system("wmctrl -i -a '" +wmdic[x] + "'")




No comments:

Post a Comment