fmt(espanso)
This commit is contained in:
parent
b338e78552
commit
4983a27813
1 changed files with 59 additions and 57 deletions
|
@ -1,4 +1,4 @@
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }: {
|
||||||
services.espanso = {
|
services.espanso = {
|
||||||
# package = pkgs.espanso.overrideAttrs(_: {
|
# package = pkgs.espanso.overrideAttrs(_: {
|
||||||
# # src =
|
# # src =
|
||||||
|
@ -10,64 +10,66 @@
|
||||||
# backend = "Clipboard";
|
# backend = "Clipboard";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
matches = let
|
matches =
|
||||||
playerctl = ''
|
let
|
||||||
${pkgs.coreutils}/bin/env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(${pkgs.coreutils}/bin/id -u)/bus" ${pkgs.playerctl}/bin/playerctl'';
|
playerctl = ''
|
||||||
in {
|
${pkgs.coreutils}/bin/env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(${pkgs.coreutils}/bin/id -u)/bus" ${pkgs.playerctl}/bin/playerctl'';
|
||||||
default = {
|
in
|
||||||
matches = [
|
{
|
||||||
{
|
default = {
|
||||||
trigger = ":vpos";
|
matches = [
|
||||||
replace = "{{output}}";
|
{
|
||||||
vars = [
|
trigger = ":vpos";
|
||||||
{
|
replace = "{{output}}";
|
||||||
name = "output";
|
vars = [
|
||||||
type = "script";
|
{
|
||||||
params = {
|
name = "output";
|
||||||
args = [
|
type = "script";
|
||||||
(pkgs.writeScript "espanso" ''
|
params = {
|
||||||
#! ${pkgs.python3}/bin/python
|
args = [
|
||||||
import subprocess, os, math, datetime
|
(pkgs.writeScript "espanso" ''
|
||||||
|
#! ${pkgs.python3}/bin/python
|
||||||
|
import subprocess, os, math, datetime
|
||||||
|
|
||||||
id=str(os.getuid())
|
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=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()
|
result.check_returncode()
|
||||||
|
|
||||||
position_secs = math.trunc(float(result.stdout))
|
position_secs = math.trunc(float(result.stdout))
|
||||||
position_human = datetime.timedelta(seconds=position_secs)
|
position_human = datetime.timedelta(seconds=position_secs)
|
||||||
print("%s - %s" % (position_human, position_secs))
|
print("%s - %s" % (position_human, position_secs))
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
trigger = ":vtit";
|
trigger = ":vtit";
|
||||||
replace = "{{output}}";
|
replace = "{{output}}";
|
||||||
vars = [
|
vars = [
|
||||||
{
|
{
|
||||||
name = "output";
|
name = "output";
|
||||||
type = "script";
|
type = "script";
|
||||||
params = {
|
params = {
|
||||||
args = [
|
args = [
|
||||||
(pkgs.writeShellScript "espanso"
|
(pkgs.writeShellScript "espanso"
|
||||||
"${playerctl} metadata title")
|
"${playerctl} metadata title")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
trigger = ":dunno";
|
trigger = ":dunno";
|
||||||
replace = "¯\\_(ツ)_/¯";
|
replace = "¯\\_(ツ)_/¯";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
trigger = ":shrug";
|
trigger = ":shrug";
|
||||||
replace = "¯\\_(ツ)_/¯";
|
replace = "¯\\_(ツ)_/¯";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue