示例#1
0
def main():
    percent = get_data()
    util.fmt_print(
        {
            "percent": util.fmt_percent(percent),
            "bar": util.get_bar(percent),
            "icon": get_icon(percent)
        }, sys.argv[1] if len(sys.argv) > 1 else "{icon} {percent}% {bar}")
示例#2
0
def main():
    volume, mute = get_data()
    util.fmt_print(
        {
            "percent": util.fmt_percent(volume, True),
            "mute": str(mute),
            "bar": util.get_bar(volume),
            "icon": get_icon(volume, mute)
        }, sys.argv[1] if len(sys.argv) > 1 else "{icon} {percent}% {bar}")
示例#3
0
def main():
    percent, cpu = get_data()
    data = {
        "percent": util.fmt_percent(percent),
        "bar": util.get_bar(percent),
        "icon": "\ufb19"
    }
    for i, core in enumerate(cpu):
        data["cpu" + str(i) + ""] = util.fmt_percent(core)
        data["bar" + str(i) + ""] = util.get_bar(core, minmum=True)
    util.fmt_print(data, sys.argv[1] if len(sys.argv) > 1 else "{icon} {percent}% " +
                   " ".join(["{{bar{}}}".format(i) for i in range(len(cpu))]))
示例#4
0
def main():
    data = get_data()
    if data == {}:
        print("\ue33b", end='')
        return
    data = gen_dict(data)
    if len(sys.argv) > 1 and sys.argv[1] == '--list':
        for key in data:
            print(key, end=', ')
        return
    util.fmt_print(
        data, sys.argv[1]
        if len(sys.argv) > 1 else "{icon}  {temperature}\u00b0 {summary}")
示例#5
0
def main():
    percent, total, used = get_data()
    util.fmt_print({
        "percent": util.fmt_percent(percent),
        "bar": util.get_bar(percent, True),
        "totalKB": get_size(total, 'KB'),
        "usedKB": get_size(used, 'KB'),
        "totalMB": get_size(total, 'MB'),
        "usedMB": get_size(used, 'MB'),
        "totalGB": get_size(total, 'GB'),
        "usedGB": get_size(used, 'GB'),
        "totalTB": get_size(total, 'TB'),
        "usedTB": get_size(used, 'TB'),
        "icon": "\uf85a"
    }, sys.argv[1] if len(sys.argv) > 1 else "{icon} {percent}% {bar}")
示例#6
0
def main():
    percent, charging, time = get_data()
    if len(sys.argv) > 1 and sys.argv[1] == "--charging":
        if charging is True:
            print("Charging", end='')
        else:
            print("Discharging", end='')
        return
    elif len(sys.argv) > 1 and sys.argv[1] == "--notify":
        if percent <= 5:
            title = "\uf071 Battery Critical!"
            content = "\uf244 " + util.fmt_percent(percent)
            content += "\n\uf017 {:02}:{:02}:{:02}".format(
                time[0], time[1], time[2])
            subprocess.run(
                ["notify-send", "--urgency=critical", title, content])
        elif percent <= 10:
            title = "\uf071 Battery Low!"
            content = "\uf243 " + util.fmt_percent(percent)
            content += "\n\uf017 {:02}:{:02}:{:02}".format(
                time[0], time[1], time[2])
            subprocess.run(
                ["notify-send", "--urgency=critical", title, content])
        elif percent >= 90 and charging is True:
            title = "\uf071 Battery Full!"
            content = "\uf240 " + util.fmt_percent(percent)
            content += "\n\uf017 {:02}:{:02}:{:02}".format(
                time[0], time[1], time[2])
            subprocess.run(["notify-send", title, content])
        return
    data = {
        "percent": util.fmt_percent(percent),
        "bar": util.get_bar(percent),
        "icon": get_icon(percent, charging),
        "H": "{:02}".format(time[0]),
        "M": "{:02}".format(time[1]),
        "S": "{:02}".format(time[2])
    }
    util.fmt_print(
        data, sys.argv[1]
        if len(sys.argv) > 1 else "{icon} [{H}:{M}:{S}]{percent}%{bar}")
示例#7
0
def main():
    total, used, available, percentage = get_data()
    data = dict()
    data['icon'] = '\ue706'
    data['percent'] = percentage
    data['totalKB'] = get_size(total, 'KB')
    data['totalMB'] = get_size(total, 'MB')
    data['totalGB'] = get_size(total, 'GB')
    data['totalTB'] = get_size(total, 'TB')
    data['totalAuto'], data['totalSufix'] = get_size(total, "Auto")
    data['usedKB'] = get_size(used, 'KB')
    data['usedMB'] = get_size(used, 'MB')
    data['usedGB'] = get_size(used, 'GB')
    data['usedTB'] = get_size(used, 'TB')
    data['usedAuto'], data['usedSufix'] = get_size(used, "Auto")
    data['availableKB'] = get_size(available, 'KB')
    data['availableMB'] = get_size(available, 'MB')
    data['availableGB'] = get_size(available, 'GB')
    data['availableTB'] = get_size(available, 'TB')
    data['availableAuto'], data['availableSufix'] = get_size(available, "Auto")
    data['bar'] = util.get_bar(percentage)
    util.fmt_print(
        data, sys.argv[1] if len(sys.argv) > 1 else
        "{icon} {availableAuto}{availableSufix} {percent}%{bar}")
示例#8
0
def main():
    status = get_data()
    data = dict()
    if status != -1:
        data = get_dict()
        data['artist'] = ' '.join(data['artist'])
        data['length'] = get_time(float(data['length'].split(' ')[1]))
    data['status'] = str(status)
    data['play_pause'] = get_play_pause(status)
    data['next'] = '\uf051'
    data['prev'] = '\uf048'
    data['icon'] = '\uf001'
    if len(sys.argv) == 1:
        sys.argv.append("{icon} {#FF9800}{artist}: {title:.40}{#}")
        sys.argv.append("{icon} {#90A4AE}{artist}: {title:.40}{#}")
        sys.argv.append("{#607D8B}{icon} {#}")
    if len(sys.argv) <= 2:
        util.fmt_print(data, sys.argv[1])
    if status is True and len(sys.argv) >= 3:
        util.fmt_print(data, sys.argv[1])
    elif status is False and len(sys.argv) >= 3:
        util.fmt_print(data, sys.argv[2])
    elif len(sys.argv) >= 4:
        util.fmt_print(data, sys.argv[3])