feat(qtile-desktop/espanso): :vpos display human readable time and timestamp
This commit is contained in:
parent
15f21b27dc
commit
9729abca54
1 changed files with 12 additions and 3 deletions
|
@ -320,9 +320,18 @@ in {
|
||||||
type = "script";
|
type = "script";
|
||||||
params = {
|
params = {
|
||||||
args = [
|
args = [
|
||||||
(pkgs.writeShellScript "espanso" ''
|
(pkgs.writeScript "espanso" ''
|
||||||
${playerctl} position''
|
#! ${pkgs.python3}/bin/python
|
||||||
)
|
import subprocess, os, math, datetime
|
||||||
|
|
||||||
|
id=str(os.getuid())
|
||||||
|
result=subprocess.run(args=["${pkgs.playerctl}/bin/playerctl", "position"], env={"DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/"+id+"/bus"},capture_output=True)
|
||||||
|
result.check_returncode()
|
||||||
|
|
||||||
|
position_secs = math.trunc(float(result.stdout))
|
||||||
|
position_human = datetime.timedelta(seconds=position_secs)
|
||||||
|
print("%s - %s" % (position_human, position_secs))
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue