aboutsummaryrefslogtreecommitdiff
path: root/xboomx/bin/xboomx
blob: c8865dc0d282a1ecb807de8b29101ef32a2d21c8 (plain)
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
#!/usr/bin/python
import subprocess
from xboomx.config import config
import xboomx.db
import sys


if len(sys.argv) > 1 and sys.argv[1] == "--stats":
    db = xboomx.db.open_shelve('')

    items = []

    keys = db.keys()

    for x in keys:
        items.append([x, db.get(x, "")])

    db.close()

    # sort items
    items.sort(key=lambda x: x[1], reverse=True)

    # print items
    print "Application\tLaunches"
    for item in items:
        if len(item[0]) < 8:
            print item[0]+"\t\t"+str(item[1])
        else:
            print item[0]+"\t"+str(item[1])

    exit(0)

DMENU_LAUNCHER = 'dmenu ' + config.get("dmenu_params", "")

subprocess.call("xboomx_path.py | xboomx_sort.py | " + DMENU_LAUNCHER +  "| xboomx_update.py | xargs -I {} sh -c \'exec {} &\'", shell=True)