Esempio n. 1
0
def ontop(title):
    c = Client()
    if title is None:
        title = c.group.window.info()['name']
        print(title)
        with open(PATH, 'w+') as f_obj:
            f_obj.write(title)
    wid = [(w['id'], w['group']) for w in c.windows() if title == w['name']]
    if len(wid) == 0:
        os.remove(PATH)
        return
    c.window[wid[0][0]].bring_to_front()
    c.window[wid[0][0]].togroup()

    # This code runs only when the current group is changed, so that
    # correct window is focused instead of mpv window
    prv_grp = wid[0][1]
    cur_grp = c.group.info()['name']
    focusHistory = c.groups()[c.group.info()['name']]['focusHistory']
    if focusHistory[-1] == title and cur_grp != prv_grp:
        last_wid = [
            w['id'] for w in c.windows()
            if w['name'] == focusHistory[-2] and w['group'] == cur_grp
        ][0]
        c.window[last_wid].focus()
#!/usr/bin/env python

from libqtile.command import Client
import subprocess
import re

# connect to Qtile
c = Client()

# get info of windows
wins = []
id_map = {}
id = 0
for win in c.windows():
    if win["group"]:
        wins.append(
            bytes("%i: %s (%s)" % (id, win["name"], win["group"]), 'utf-8'))
        id_map[id] = {'id': win['id'], 'group': win['group']}
        id = id + 1

# call dmenu
DMENU = 'dmenu -i -b -p ">>>" -nb #000 -nf #fff -sb #00BF32 -sf #fff'
p = subprocess.Popen(DMENU.split(),
                     stdin=subprocess.PIPE,
                     stdout=subprocess.PIPE)
out = p.communicate(b"\n".join(wins))[0]

# get selected window info
id = int(re.match(b"^\d+", out).group())
win = id_map[id]
#!/usr/bin/env python

from libqtile.command import Client
import subprocess
import re

# connect to Qtile
c = Client()

# get info of windows
wins = []
id_map = {}
id = 0
for win in c.windows():
    if win["group"]:
        wins.append(bytes("%i: %s (%s)" % (id, win["name"], win["group"]),
            'utf-8'))
        id_map[id] = {
                'id' : win['id'],
                'group' : win['group']
                }
        id = id +1

# call dmenu
DMENU='dmenu -i -b -p ">>>" -nb #000 -nf #fff -sb #00BF32 -sf #fff'
p = subprocess.Popen(DMENU.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out = p.communicate(b"\n".join(wins))[0]

# get selected window info
id = int(re.match(b"^\d+", out).group())
win = id_map[id]
Esempio n. 4
0
#!/usr/bin/python
from libqtile.command import Client
from inspect import getmembers
from pprint import pprint
from var_dump import var_dump
c = Client()
for i in c.windows():
#    var_dump(i)
    if (i['name'].startswith('Microsoft Excel' )) :
        c.window[ i['id'] ].group.toscreen()
        c.window[ i['id'] ].bring_to_front()
        c.window[ i['id'] ].disable_floating()