相关疑难解决方法(0)

我怎样才能让这个窗口和应用程序时间跟踪脚本产生排序的输出?

Jacob Vlijm在另一个问题中写了一个应用程序使用时间跟踪器脚本。https://askubuntu.com/a/780542/654800

由于名气不大,我无法在那里发表评论。所以我会在这里问,是否可以按使用百分比而不是当前相对顺序对条目进行排序?

这是一个脚本,以防您不想检查原始问题。

#!/usr/bin/env python3
import subprocess
import time
import os

# -- set update/round time (seconds)
period = 5
# -- 
# don change anything below
home = os.environ["HOME"]
logdir = home+"/.usagelogs"

def currtime(tformat=None):
    return time.strftime("%Y_%m_%d_%H_%M_%S") if tformat == "file"\
           else time.strftime("%Y-%m-%d %H:%M:%S")

try:
    os.mkdir(logdir)
except FileExistsError:
    pass

# path to your logfile
log = logdir+"/"+currtime("file")+".txt"; startt = currtime()

def get(command):
    try:
        return subprocess.check_output(command).decode("utf-8").strip()
    except subprocess.CalledProcessError:
        pass

def time_format(s):
    # convert time format from seconds to …
Run Code Online (Sandbox Code Playgroud)

python scripts productivity

5
推荐指数
1
解决办法
1876
查看次数

标签 统计

productivity ×1

python ×1

scripts ×1