mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 02:18:12 +09:00
normcap-translate
This commit is contained in:
@@ -125,6 +125,7 @@ in
|
||||
(execute "W-l" "loginctl lock-session")
|
||||
(execute "W-v" "vicinae vicinae://launch/clipboard/history?toggle=true")
|
||||
(execute "W-j" "nani-translate-primary")
|
||||
(execute "W-S-j" "normcap-translate")
|
||||
(execute "W-C-j" "${lib.getExe' pkgs.xdg-utils "xdg-open"} naniapp://translate")
|
||||
(execute "W-space" "ghostty +toggle-quick-terminal")
|
||||
(execute "W-p" "wdisplays")
|
||||
|
||||
@@ -117,6 +117,11 @@ in
|
||||
action.spawn = [ "nani-translate-primary" ];
|
||||
hotkey-overlay.title = "Translate Primary Selection";
|
||||
};
|
||||
"Mod+Shift+J" = {
|
||||
repeat = false;
|
||||
action.spawn = [ "normcap-translate" ];
|
||||
hotkey-overlay.title = "OCR and Translate with Nani";
|
||||
};
|
||||
"Mod+Ctrl+J" = {
|
||||
repeat = false;
|
||||
action.spawn = [
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{ 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
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
description = "NormCap OCR screen capture";
|
||||
|
||||
includes = [
|
||||
"applications.nani"
|
||||
];
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
"applications.loupe"
|
||||
"applications.linux-wallpaperengine"
|
||||
"applications.nautilus"
|
||||
"applications.normcap"
|
||||
"applications.papers"
|
||||
"applications.qalculate-gtk"
|
||||
"applications.resources"
|
||||
|
||||
Reference in New Issue
Block a user