From 3d6ee99ecb4b059467b5ab2c8f9d04790c353232 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 31 May 2025 20:44:18 -0500 Subject: [PATCH] feat: cleaned up espanso --- .../apps/tools/espanso/config/academic.nix | 6 + .../gui/apps/tools/espanso/config/base.nix | 7 + .../apps/tools/espanso/config/characters.nix | 6 + .../gui/apps/tools/espanso/config/debate.nix | 8 + .../gui/apps/tools/espanso/config/email.nix | 9 + .../gui/apps/tools/espanso/config/logic.nix | 11 ++ .../apps/tools/espanso/config/superscript.nix | 13 ++ .../gui/apps/tools/espanso/config/url.nix | 10 ++ .../home/gui/apps/tools/espanso/default.nix | 163 +++--------------- 9 files changed, 91 insertions(+), 142 deletions(-) create mode 100755 modules/home/gui/apps/tools/espanso/config/academic.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/base.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/characters.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/debate.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/email.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/logic.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/superscript.nix create mode 100755 modules/home/gui/apps/tools/espanso/config/url.nix diff --git a/modules/home/gui/apps/tools/espanso/config/academic.nix b/modules/home/gui/apps/tools/espanso/config/academic.nix new file mode 100755 index 0000000..be424ba --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/academic.nix @@ -0,0 +1,6 @@ +{ matchHelper, ... }: +[ + (matchHelper ":dag1" "†") + (matchHelper ":dag2" "‡") + (matchHelper ":glp" "GLP-1RA") +] diff --git a/modules/home/gui/apps/tools/espanso/config/base.nix b/modules/home/gui/apps/tools/espanso/config/base.nix new file mode 100755 index 0000000..65bb056 --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/base.nix @@ -0,0 +1,7 @@ +{ matchHelper, ... }: +[ + (matchHelper ":up" "↑") + (matchHelper ":down" "↓") + (matchHelper ":left" "←") + (matchHelper ":right" "→") +] diff --git a/modules/home/gui/apps/tools/espanso/config/characters.nix b/modules/home/gui/apps/tools/espanso/config/characters.nix new file mode 100755 index 0000000..aad8e1b --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/characters.nix @@ -0,0 +1,6 @@ +{ matchHelper, ... }: +[ + (matchHelper ":delta" "Δ") + (matchHelper ":emdash" "—") + (matchHelper ":degree" "°") +] diff --git a/modules/home/gui/apps/tools/espanso/config/debate.nix b/modules/home/gui/apps/tools/espanso/config/debate.nix new file mode 100755 index 0000000..7ac3c8f --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/debate.nix @@ -0,0 +1,8 @@ +{ matchHelper, ... }: +[ + (matchHelper ":ntt" '' + World A) Animals farmed for food. + World B) Humans farmed for food. + + All else equal, what is true of world A that is untrue of world B, that if made true of world B, would make world B permissible?'') +] diff --git a/modules/home/gui/apps/tools/espanso/config/email.nix b/modules/home/gui/apps/tools/espanso/config/email.nix new file mode 100755 index 0000000..104872d --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/email.nix @@ -0,0 +1,9 @@ +{ flake, matchHelper, ... }: +let + inherit (flake.config.people) user0; + inherit (flake.config.people.users.${user0}) email; +in +[ + (matchHelper ":mail0" email.address0) + (matchHelper ":mail1" email.address2) +] diff --git a/modules/home/gui/apps/tools/espanso/config/logic.nix b/modules/home/gui/apps/tools/espanso/config/logic.nix new file mode 100755 index 0000000..7adec9d --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/logic.nix @@ -0,0 +1,11 @@ +{ matchHelper, ... }: +[ + (matchHelper ":neg" "¬") + (matchHelper ":conj" "∧") + (matchHelper ":disj" "∨") + (matchHelper ":imp" "→") + (matchHelper ":bicon" "↔") + (matchHelper ":forall" "∀") + (matchHelper ":exist" "∃") + (matchHelper ":therefore" "∴") +] diff --git a/modules/home/gui/apps/tools/espanso/config/superscript.nix b/modules/home/gui/apps/tools/espanso/config/superscript.nix new file mode 100755 index 0000000..c119ac5 --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/superscript.nix @@ -0,0 +1,13 @@ +{ matchHelper, ... }: +[ + (matchHelper ":ss1" "¹") + (matchHelper ":ss2" "²") + (matchHelper ":ss3" "³") + (matchHelper ":ss4" "⁴") + (matchHelper ":ss5" "⁵") + (matchHelper ":ss6" "⁶") + (matchHelper ":ss7" "⁷") + (matchHelper ":ss8" "⁸") + (matchHelper ":ss9" "⁹") + (matchHelper ":ss0" "⁰") +] diff --git a/modules/home/gui/apps/tools/espanso/config/url.nix b/modules/home/gui/apps/tools/espanso/config/url.nix new file mode 100755 index 0000000..9e55bd0 --- /dev/null +++ b/modules/home/gui/apps/tools/espanso/config/url.nix @@ -0,0 +1,10 @@ +{ flake, matchHelper, ... }: +let + inherit (flake.config.services.instances) forgejo mastodon web; +in +[ + (matchHelper ":dotfiles" "https://gitlab.com/upRootNutrition/dotfiles") + (matchHelper ":website" "https://${web.domains.url3}") + (matchHelper ":forgejo" "https://${forgejo.subdomain}.${web.domains.url3}") + (matchHelper ":mastodon" "https://${mastodon.subdomain}.${web.domains.url3}") +] diff --git a/modules/home/gui/apps/tools/espanso/default.nix b/modules/home/gui/apps/tools/espanso/default.nix index ed5a246..ef636ac 100755 --- a/modules/home/gui/apps/tools/espanso/default.nix +++ b/modules/home/gui/apps/tools/espanso/default.nix @@ -4,8 +4,26 @@ ... }: let - inherit (flake.config.people) user0; - inherit (flake.config.people.users.${user0}) email; + + matchHelper = trigger: replace: { + trigger = trigger; + replace = replace; + }; + + configPath = ./config; + + baseMatches = { + matches = + [ ] + ++ (import (configPath + /base.nix) { inherit matchHelper; }) + ++ (import (configPath + /url.nix) { inherit flake matchHelper; }) + ++ (import (configPath + /logic.nix) { inherit matchHelper; }) + ++ (import (configPath + /debate.nix) { inherit matchHelper; }) + ++ (import (configPath + /characters.nix) { inherit matchHelper; }) + ++ (import (configPath + /academic.nix) { inherit matchHelper; }) + ++ (import (configPath + /superscript.nix) { inherit matchHelper; }) + ++ (import (configPath + /email.nix) { inherit flake matchHelper; }); + }; in { services.espanso = { @@ -18,146 +36,7 @@ in }; package = pkgs.espanso-wayland; matches = { - base = { - matches = [ - { - trigger = ":up"; - replace = "↑"; - } - { - trigger = ":down"; - replace = "↓"; - } - { - trigger = ":left"; - replace = "←"; - } - { - trigger = ":right"; - replace = "→"; - } - { - trigger = ":neg"; - replace = "¬"; - } - { - trigger = ":conj"; - replace = "∧"; - } - { - trigger = ":disj"; - replace = "∨"; - } - { - trigger = ":imp"; - replace = "→"; - } - { - trigger = ":bicon"; - replace = "↔"; - } - { - trigger = ":forall"; - replace = "∀"; - } - { - trigger = ":exist"; - replace = "∃"; - } - { - trigger = ":therefore"; - replace = "∴"; - } - { - trigger = ":delta"; - replace = "Δ"; - } - { - trigger = ":emdash"; - replace = "—"; - } - { - trigger = ":dag1"; - replace = "†"; - } - { - trigger = ":dag2"; - replace = "‡"; - } - { - trigger = ":glp"; - replace = "GLP-1RA"; - } - { - trigger = ":degree"; - replace = "°"; - } - { - trigger = ":ss1"; - replace = "¹"; - } - { - trigger = ":ss2"; - replace = "²"; - } - { - trigger = ":ss3"; - replace = "³"; - } - { - trigger = ":ss4"; - replace = "⁴"; - } - { - trigger = ":ss5"; - replace = "⁵"; - } - { - trigger = ":ss6"; - replace = "⁶"; - } - { - trigger = ":ss7"; - replace = "⁷"; - } - { - trigger = ":ss8"; - replace = "⁸"; - } - { - trigger = ":ss9"; - replace = "⁹"; - } - { - trigger = ":ss0"; - replace = "⁰"; - } - { - trigger = ":ntt"; - replace = '' - World A) Animals farmed for food. - World B) Humans farmed for food. - - All else equal, what is true of world A that is untrue of world B, that if made true of world B, would make world B permissible?''; - } - { - trigger = ":dotfiles"; - replace = "https://gitlab.com/upRootNutrition/dotfiles"; - } - { - trigger = ":website"; - replace = "https://uprootnutrition.com"; - } - { - trigger = ":mail0"; - replace = email.address0; - } - { - trigger = ":mail1"; - replace = email.address2; - } - ]; - }; + base = baseMatches; global_vars = { global_vars = [ {