mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 05:48:12 +09:00
45 lines
900 B
Nix
45 lines
900 B
Nix
{ pkgs, ... }:
|
|
let
|
|
normcap = pkgs.normcap.override {
|
|
tesseract4 = pkgs.tesseract4.override {
|
|
enableLanguages = [
|
|
"chi_sim"
|
|
"jpn"
|
|
"eng"
|
|
];
|
|
};
|
|
};
|
|
|
|
normcapTranslate = pkgs.writeShellApplication {
|
|
name = "normcap-translate";
|
|
|
|
runtimeInputs = [
|
|
normcap
|
|
pkgs.jq
|
|
pkgs.xdg-utils
|
|
];
|
|
|
|
text = ''
|
|
captured_text="$(
|
|
normcap \
|
|
--cli-mode \
|
|
--screenshot-handler grim \
|
|
--show-introduction False \
|
|
--update False \
|
|
--detect-codes False \
|
|
--notification False \
|
|
-l jpn eng chi_sim
|
|
)" || exit 0
|
|
[ -n "$captured_text" ] || exit 0
|
|
encoded_text="$(printf '%s' "$captured_text" | jq -sRr @uri)"
|
|
exec xdg-open "naniapp://translate?source=$encoded_text"
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
home.packages = [
|
|
normcap
|
|
normcapTranslate
|
|
];
|
|
}
|