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