Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Japanese immersion assistant for learners (Windows/Linux)

License

NotificationsYou must be signed in to change notification settings

fauu/Kamite

Repository files navigation

A desktop language immersion companion for learners of Japanese

Note

This is alpha software.

Kamite is desktop software to aid learning Japanese through immersion in nativemedia. It brings Japanese text from those media into a web browser interface,enabling lookup with pop-up dictionaries (such asYomichan)and websites (such asDeepL Translate), and more.

Kamite_Main_Demo.mp4

(Featured in the above demo video: [All shots] Firefox,Sway. [Shot 1]Gomics-vmanga reader (Kaguya-sama wa Kokurasetai, ch. 140);Yomichan (dictionaries:JMDict, Kanjium Pitch Accents, Narou Freq, VN Freq). [Shot 2]mpv(Suzumiya Haruhi no Yuuutsu (2006), ep. 9). [Shot 3] Summer Pockets;Textractor;contrib/kamite-toggle-visibility.shscript;waycorner.)

Highlights

Kamite supports Linux* and Windows (macOS support planned for the beta release).

(*Linux: Xorg, wlroots, GNOME Wayland, Plasma Wayland. OCR-ing arbitrary screenareas not supported on GNOME Wayland and Plasma Wayland.)

Kamite is cost-free and is licensed under the GNU AGPL v3 or later.

Table of contents

  1. Installing Kamite
  2. Updating Kamite
  3. Launching Kamite
  4. Troubleshooting
  5. User interface overview
  6. Text extraction
  7. Text use
  8. Custom commands (Launching external executables)
  9. Keyboard shortcuts
  10. Launch options
  11. Config
  12. Style customization
  13. Command API
  14. Privacy
  15. Development
  16. License

Installing Kamite

Linux

Arch User Repository

An AUR package is available under the namekamite-bin (installs to/opt/kamite).

Debian/Ubuntu-based

A Debian (.deb) package is available among the files on theReleases page.Install with:

sudo apt install /path/to/[package-file].deb

Uninstall with:

sudo apt remove kamite-bin

Generic

Download the latest release package from theReleases page and extract itto the location where you want to keep the program files. You can now launchKamite with thebin/kamite executable inside the extracted directory.

An optionalinstall.sh script is provided in the release package that cancreate a link tobin/kamite in the/usr/bin/ directory, as well as install aDesktop entry and program icons for application launchers. The files created bythe installation script can be removed by running:

install.sh --uninstall

Windows

Download the latest release package from theReleases page and extract itto the location where you want to keep the program files. You can now launchKamite usingKamite.exe inside the extracted directory.

Updating Kamite

When updating, please checkthe Changelog for breaking chagesin the newer versions.

Linux Generic and Windows

To update, remove the oldkamite directory and extract the new release packagein its place.

Launching Kamite

Kamite can be launched:

  • Linux: either direclty using thebin/kamite executable in theprogram directory or through a desktop launcher (assuming the.desktop filewas installed);

  • Windows: using one of:Kamite.exe,Kamite.com (provides consoleoutput), orKamite (Debug).bat (enables Debug mode and provides consoleoutput).

Besides theconfig file, Kamite supports configuration throughlaunch options. SeeLaunch options.

Kamite’s main user interface is a webpage served by a local server that shouldbe opened in your web browser. The default address ishttp://localhost:4110.

The web client is only guaranteed to work without issues on the most recentversions of Firefox and Chrome.

Upon launch, Kamite will, by default: 1) navigate to the above address in thedefault web browser, 2) open an auxiliary “Control” window, which lets youmonitor the program’s status as well as exit it. Both those behaviours can bedisabled by setting theconfig keyslaunchBrowser andcontrolWindow, respectively, tono. Disabling the latter is useful whenKamite is run from the command line, making the control window redundant.

Multiple config profiles can be prepared for Kamite and chosen between at thetime of its launch. SeeConfig profiles.

Troubleshooting

To better diagnose problems, launch Kamite from a console window with thelaunch option--debug. (On Windows, this can be done simplyby double-clicking the providedKamite (Debug).bat script). This will makeKamite print detailed error messages and add a Debug tab to the client (the bugicon) where image snapshots of OCR operations appear for inspection.

If something does not seem to work properly or is confusing in a way that is notdispelled by what is written in this README, do not hesitate tocreate a GitHubIssue.

User interface overview

Below are some non-obvious tips regarding the interface that might come useful.

  • Double-clicking on thecurrent chunk activates the chunk edit mode. To exitit, either click away or pressCtrl +Enter.

  • Thenotebook can be temporarily resized by dragging its edge with the mouse(in order for the setting to persist, however, it must be set in theconfigfile).

  • You can have incoming text chunk inserted into the current chunk instead ofentirely replacing it. To do that, enter the chunk edit mode as describedabove and either: 1) place the caret where you want the incoming chunk to beinserted or 2) select the part of the current chunk that you wish replacedwith it.

  • Thecharacter counter and thesession timer can be frozen/paused andrestarted by, respectively, short-clicking and long-clickng on them.

  • Thesession timer can be set up to pause automatically after a period ofinactivity. For example, addsessionTimer.autoPause.after: 45s to auto-pauseafter 45 seconds of inactivity.

  • Thesession timer can be set to be paused initially after launching theprogram (sessionTimer.startPaused: yes to enable).

Text extraction

The first task when using Kamite is to get text from the immersion material intothe program. In Kamite’s terminology, a single incoming piece of text is calledachunk.

The method of getting text chunks into Kamite will depend on the kind of thesource material:

Anime/video text extraction

Extracting text chunks from video is by default supported through integrationwith thempv video player.Primary video subtitles from mpv are treatedby Kamite as incoming chunks. Ifsecondary subtitles are present, they aretreated aschunk translations.

To enable the connection between Kamite and mpv, the latter must be launchedwith the following exact value for theinput-ipc-server parameter:

Linux:

mpv file.mkv --input-ipc-server=/tmp/kamite-mpvsocket

Windows (PowerShell):

C:\Program` Files\mpv\mpv file.mkv--input-ipc-server=\\.\pipe\kamite-mpvsocket

Alternatively, the line

input-ipc-server=<above_path>

can be put into thempv config file.

In the former case, mpv will only be open for communication with Kamite whenlaunched with the specified parameter. In the latter—it will be open always.

For more on the communication mechanism used, see thempv reference for JSON IPC.

To run mpv with an external subtitle file, use the--sub-file launchparameter (it can be repeated for multiple subtitle files). To assign a givensubtitle track asprimary (assumed by Kamite to be the Japanese subtitles) andsecondary (assumed to be the translations), respectively, use the--sid and--secondary-sid mpv launch parameters. Which subtitle IDs to specify can beglanced by pressingF9 in mpv while the video file is opened and thesubtitles loaded.

Note

Subtitles hidden within mpv will still be recognized by Kamite.

Warning

The subtitle extraction functionality will not work with subtitles thatare stored as images, not as text.

See also:mpv reference: Subtitle options.

Below are excerpts from example scripts used to quickly launch an anime episodein mpv in such a way that it is immediately set up to work with Kamite.

Linux:

mpv"/path/to/video/"*"Some Anime Name"*"E$1"*".mkv"\# Episode no. passed as an argument to the script  --input-ipc-server=/tmp/kamite-mpvsocket \  --sub-file="/path/to/external/subtitles/$1.jp.srt" \  --sid=2\# ID of the Japanese subtitles provided externally  --secondary-sid=1\# ID of the English subtitles embedded in the video file (to be used as translations)  --secondary-sub-visibility=no \  --save-position-on-quit \  --profile=jpsub# An optional custom profile that can set a special subtitle font and size, etc. It must be defined separately in the mpv config file: see https://mpv.io/manual/stable/#profiles

Windows (PowerShell):

# See the Linux example above for more informationparam ([String]$ep)# $ep will be replaced with the first parameter to the# script (here assumed to be the episode number)C:\Program` Files\mpv\mpv"\path\to\video\*Some Anime Name*E$ep.mkv"`--input-ipc-server=\\.\pipe\kamite-mpvsocket`--sub-file="\path\to\external\subtitles\$ep.jp.srt"`--sid=2`--secondary-sid=1`--secondary-sub-visibility=no`--save-position-on-quit`--profile=jpsub

Tip: Auto-pausing at the start/end of subtitles

This can be useful for beginners whose comprehension is not yet at the levelneeded to follow even simple video content at natural pace. Thesub-pause-advanced mpv script can be used for this purpose. Here are someexample learning workflows enabled by that script:

  • Pause at the end of each Japanese subtitle in order to read it in Kamite.(Useful when you cannot read proper texts yet and it is advantageous tosubstitute with short anime dialogues.)

  • Do the above, but only when you stumble while reading the subtitle live andyou explicitly request pause at the end of the subtitle by pressing a definedrequest key. (Useful once you progress to the level at which you can oftenread easier lines live.)

  • Pause at the start of each {known language} subtitle and automatically unpauseafter the time sufficient to read it (calculated by the script based on thesubtitle’s length), so that you can then fully concentrate on understandningthe Japanese spoken line, with the comprehension “training wheel” in the formof knowing roughly what it’s supposed to say. (Useful for beginner listeningpractice.)

For more information, see the script’s README in its GitHub repository linkedabove.


Kamite can be useful even when viewing media without Japanese subtitles, forexample as an area where heard words and phrases can be typed in and looked up.

When viewing media with translated subtitles only, Kamite can be instructed totreat them as translations for unknown chunks and display them as such, byenabling “Translation-only mode” in the Settings tab or by launching with theconfig keychunk.translationOnlyMode set toyes.


Related Wiki sections:

Manga/visual text extraction

Kamite integrates with several alternative OCR (Optical Character Recognition)solutions to enable visual extraction of text from manga pages and othercontent displayed on screen. The available OCR engines are:

“Manga OCR” in either variant is the recommended choice for manga.The online version requires practically no special setup, but involvesscreenshots of portions of your screen being sent to a third party. The localversion, on the other hand, requires a somewhat involved setup and extra systemresources.

By default, OCR is disabled. The necessary setup steps are:

  1. Set theconfig keyocr.engine to one of:mangaocr_online,mangaocr,hiveocr_online,easyocr_online,ocrspace, ortesseract.

  2. Set up the selected engine:

  3. (Linux/Xorg and wlroots platforms only)Set up extra OCR dependencies

Setting up “Manga OCR” Online

Warning

The “Manga OCR” Online engine depends on a third-party online service(a Hugging Face Space by Detomo)—using it involves sendingscreenshots of portions of your screen to third parties. (SeePrivacy)

The “Manga OCR” Online does not require any extra setup.

Remember toset up extra OCR dependenciesif necessary, and to launch Kamite with the config keyocr.engine set tomangaocr_online.

Setting up “Manga OCR” (Local)

Note

“Manga OCR” will use up to 2.5 GB of disk space. During launch, it will use upto 1 GB of additional RAM.

Recommended option: installation using pipx
  1. InstallPython andpip (the Windows Python installeralready includes pip)

  2. Installpipx

    Windows:

    C:\Users\<user>\AppData\Local\Programs\Python\Python310\python.exe-m pipinstall--user pipx

    Thepython.exe location will vary depending on the installer and theinstallation options.

  3. Installmanga-ocr

    Linux:

    pipx install manga-ocr

    Windows:

    C:\Users\<user>\AppData\Local\Programs\Python\Python310\python.exe-m pipxinstall manga-ocr

Kamite will now be able to use “Manga OCR”. On the first launch of Kamite withocr.engine set tomangaocr, “Manga OCR” will take some time to download itsmodel (around 450 MB). If there are issues, try running the (Linux)manga_ocr, (Windows)C:\Users\<user>\.local\pipx\venvs\manga-ocr\Scripts\manga_ocr.exe executableinstalled by pipx and examining its output.

Deinstallation
  1. Runpipx uninstall

    Linux:

    pipx uninstall manga-ocr

    Windows:

    C:\Users\<user>\AppData\Local\Programs\Python\Python310\python.exe-m pipxuninstall manga-ocr
  2. Delete leftover Hugging Face Hub files:

(Linux)~/.cache/huggingface/hub/models--kha-white--manga-ocr-baseor a ~450 MB file in~/.cache/huggingface/transformers/.

(Windows)C:\Users\<user>\.cache\huggingface\hub\models--kha-white--manga-ocr-base or a~450 MB file inC:\Users\<user>\.cache\huggingface\transformers.

Troubleshooting “pipx "Manga OCR" installation absent…”

If pipx did not install to the default path expected by Kamite, you will have tospecify the path manually in theconfig file:

ocr: {  mangaocr: {# Linux default    pythonPath:"/home/<user>/.local/pipx/venvs/manga-ocr/bin/python"# Windows default    pythonPath:"""C:\Users\<user>\.local\pipx\venvs\manga-ocr\Scripts\python.exe"""  }}

The above paths are the defaults, which you will need to modify according tothe output you get from running

Linux:

pipx list

Windows:

C:\Users\<user>\AppData\Local\Programs\Python\Python310\python.exe-m pipxlist
Custom installation

If you install “Manga OCR” not through pipx, you will need to manually specify apath to a Python main executable (or a wrapper for it) that runs within anenvironment where themanga_ocr module is available. For example, if installedglobally and the system Python executable is onPATH under the namepython,then the appropriate configuration will be simply:

ocr: {  mangaocr: {    pythonPath: python  }}

Note

After deinstallation, there will be a ~450 MB leftover model file in(Linux)~/.cache/huggingface/transformers/, (Windows)C:\Users\<user>\.cache\huggingface\transformers.

Setting up Hive OCR Online

Warning

The Hive OCR Online engine depends on a third-party online service (a HuggingFace Space by seaoctopusredchicken)—using it involves sendingscreenshots of portions of your screen to third parties. (SeePrivacy)

The Hive OCR Online engine does not require any extra setup.

Remember toset up extra OCR dependenciesif necessary, and to launch Kamite with the config keyocr.engine set tohiveocr_online.

Setting up EasyOCR Online

Warning

The EasyOCR Online engine depends on a third-party online service (a HuggingFace Space by tomofi)—using it involves sending screenshotsof portions of your screen to third parties. (SeePrivacy)

The EasyOCR Online engine does not require any extra setup.

Remember toset up extra OCR dependenciesif necessary, and to launch Kamite with the config keyocr.engine set toeasyocr_online.

Setting up OCR.space

Warning

OCR.space is an online service—using it involves sending screenshots ofportions of your screen to a third party. (SeePrivacy)

The usage of theOCR.space free API is limited. The limits are defined by theprovider as “Requests/month: 25000, Rate Limit: 500 calls/DAY”.

  1. Register for a free API key

    Fill the form athttps://ocr.space/ocrapi/freekey. You will need toprovide your email address, to which the key will be sent.

  2. Put the API key in Kamite’sconfig file:

    [!WARNING]This is unsafe plain-text storage. Do not do this if you deem your key toosensitive for this kind of storage.

    secrets: {  ocrspace:"THE KEY GOES HERE"}
  3. (Optional—for games) Change the subengine from the default (“1”)

    The OCR.space service itself provides multiple OCR engines. Japanese issupported by engines “1” and “3”. Kamite uses engine “1” by default. If youwish to use engine “3”, specify the following configuration:

    ocr: {  ocrspace: {    engine: 3  }}

    Engine “3” is useless for manga and slower than engine “1”, but it may bemore accurate for, e.g., particular games.

Remember toset up extra OCR dependenciesif necessary, and to launch Kamite with the config keyocr.engine set toocrspace.

Setting up Tesseract OCR

  1. Install Tesseract

    Linux: Tesseract is available in the default repositories of mostdistributions. For example, undertesseract-ocr on Ubuntu or undertesseract on Arch Linux.

    Windows: It is recommended to usethe installer provided byUB Mannheim.

  2. Install Tesseract models selected for use with Kamite

    Downloadtesseract_traineddata_jpn_Kamite.zipand extract the.traineddata files from the archivedirectly intoTesseract’stessdata directory:

    • Linux: usually/usr/[local/]share/tessdata or/usr/share/tesseract-ocr/<VERSION>/tessdata;

    • Windows: the default for the UB Mannheim installer isC:\Program Files\Tesseract-OCR\tessdata.

  3. If Tesseract is not available onPATH under the executable nametesseract (which it will not on Windows), set theconfig keyocr.tesseract.path to its executable’s path:

    Windows (UB Mannheim installer default):

    ocr: {  tesseract: {    path:"""C:\Program Files\Tesseract-OCR\tesseract.exe"""# Note the triple quotes  }}

Once the setup has been completed, you can launch Kamite with the config keyocr.engine set totesseract.

Setting up extra OCR dependencies

On some platforms, external programs are needed for text recognition relatedtasks. You need to install them on your own.

Linux/Xorg extra OCR dependencies
slop
Used for selecting a screen region or point.
Linux/wlroots extra OCR dependencies
slurp
Used for selecting a screen region or point.
grim
Used for taking screenshots for OCR.
wlrctl
(Optional) Necessary to trigger a mouse click for OCR Auto Block Instant mode.

OCR usage

Text recognition can be initiated by:

Warning

On Linux / GNOME Wayland and Plasma Wayland, only the following ofthe above are available:

The OCR commands directly available to the user are the following:

Manual block OCR

OCR manual block buttonOCR manual block vertical buttonOCR manual block horizontal button

Select an area around a block of text and Kamite will OCR the area as is.

For thetesseract engine, this command has separate vertical and horizontalvariants that must be chosen manually depending on the orientation of the textblock.

Auto block OCR

OCR auto block button

Select a point within a block of text; Kamite will try to infer the extent ofthe block and then OCR the resulting area.

This should be good enough for > 90% of typical manga text blocks, but theblock detection algorithm has a lot of room for improvement.

Note

(Linux/Xorg) On Xorg, the point selection mechanism cannot be restricted tojust a point, meaning that when the mouse is pressed and dragged, a rectanglearea will be selected instead of a point. If this happens, Kamite willconsider the center of this area as the selected point.

Manual rotated block OCR

OCR manual block rotated button

Delimit a rotated block of text; Kamite will derotate the resulting areaselection and OCR it.

The delimitation of a rotated block is made with three mouse clicks indetermined spots, as shown in the following illustrations:

OCR rotated block reference

Clicks 1 and 2 must be made at the start and end of the initial edge of the textrespectively. Click 3 can be anywhere along the closing edge (pictured as greenabove).

Note

The current implementation of rotated block OCR guesses the text orientationbased on the rotation angle. This means the feature will fail in unusual cases,such as a block of horizontal text positioned vertically. The currentassumption is that those cases are very rare, but if you find use-cases wherethey are not, pleasecreate a GitHub Issueso that the assumption can be updated and the implementation reconsidered.

Region OCR

OCR region button

Define a screen area in the config file and Kamite will OCR it as isusing theconfigured OCR engine.

This is intended as an alternative for games that do not work withTextractor orAgent.

Here it is recommended to try OCR engines in the following order: Hive OCR,EasyOCR, OCR.space, and “Manga OCR” (in terms of the likelihood that they aregoing to be up to the task). (For OCR.space, be sure to tryOCR.space engine “3” specifically).

Below is an illustration of setting up a region in theconfig file.

ocr: {  regions: [${REGIONS.exampleGameTextbox}${REGIONS.someOtherRegionOmittedBelow}  ]}REGIONS: [  exampleGameTextbox: {# (1 character) This symbol will appear on the region’s button    symbol: E# This description will appear in the region’s button tooltip    description:"OCR Example Game's textbox"# The screen coordinates of the region’s top-left corner    x: 350    y: 800# The screen dimensions of the region    width: 1000    height: 150# Try to automatically narrow the region’s screenshot to just text before# OCR-ing it.# NOTE: The implementation of this function is currently very basic. It#       might not prove helpful in most use-cases    autoNarrow: no  }]keybindings: {  global: {    ocr: {      region: [# Global keybinding for the above-defined region        { symbol: E, key: metashift E }      ]    }  }}
Obtaining region parameters

To obtain the desired region coordinates and dimensions, use Kamite’s RegionHelper mode: Launch Kamite from console with the launch option--regionHelper,select the desired areas, and copy the resulting region specifications from theconsole output.

Note

(Windows) To get console output on Windows, you must launch Kamite using theKamite.com executable, notKamite.exe.

Region OCR quality

Some of the engines that can potentially handle this specific task work much morereliably when the screenshot they are provided with is narrowed to just the text.And since the current auto-narrowing algorithm is poor, for now it might bebest—when necessary—to create separate regions for each possible line count ofthe target text box (i.e., first region encompassing just one line of text,second region encompassing the first and the second line, and so on) and choosebetween them on the fly.

See also:Config,Visual novel / game text extraction,Alternative software for visual novels / games.


Using alternative OCR variants (Tesseract OCR only)

When using the Tesseract OCR engine, Kamite executes Tesseract multiple timesfor each OCR request on modified versions of the input image. This is in orderto somewhat compensate for the inferior results Tesseract gives.

When all the resulting text variants are identical, they are simply merged andpresented as one. When there are differing alternative variants, however, theone determined the most likely to be the most accurate is displayed normally asthecurrent chunk, whereas the remaining variants appear under a newOCRVariants tab placed at the left edge of the notebook’s tab bar.

Through the OCR Variants view, you can replace the current chunk with one of theother variants by clicking the Pick button next to the corresponding variant.You can also make text selections within both the current chunk and thevariants, which, upon clicking the Pick button, will lead to a partial textreplacement.

The OCR Variants view highlights characters that are unique to its variant tomake it easier to identify potential replacements for a misrecognized characterin the current chunk.

OCR directory watcher

Kamite can watch a specified directory for new/modified images and perform textrecognition on them automatically. This is especially useful for platforms thatdo not support global OCR commands (Linux / GNOME Wayland and Plasma Wayland).

To enable the directory watcher, specify the directory path in theconfigfile:

ocr: {  watchDir:"/full/path/to/the/directory"# Linux variant  watchDir:"""C:\path\to\the\directory"""# Windows variant}

This can be used in conjunction with a platform-specific screenshot tool, forexampleGNOME Screenshot on GNOME Wayland andSpectacle on Plasma Wayland.

Note that Kamite treats the entire input image as a single text block.Consequently, the provided images should be area screenshots containing just thetext block to be recognized—not the entire screen or application window.

Web browser userscript for convenient OCR

Kamite One-Click OCR is a simple browser userscript that enables convenientshortcuts for issuing OCR commands to Kamite (useful when reading manga directlyin the browser):

  • Middle-click on a text block to automatically recognize it.

  • Middle-hold-click anywhere within the webpage to initiate a manual blockrecognition selection.

To install the script, first install a userscript browser extension such asViolentmonkey orTampermonkey, and then follow this link:Kamite One-Click OCR.user.js.

Thenyou need to specify on which websites the script will be active:

  1. Open your userscript browser extension.

  2. Click on the cog icon (“Open dashboard”).

  3. FindKamite One-Click OCR and edit it:

    Tampermonkey: Click on the script name.
    Violentmonkey: Click the</> (“Edit”) icon below the script name.

  4. Switch to theSettings tab.

  5. Add user match rules for desired websites.

    Example configuration enabling the script on two specific websites:

    Enter underUser matches (Tampermonkey) or@match rules (Violentmonkey):

    https://twitter.com/*https://metaurl.app/*

On first use, you might be prompted to confirm that you allow the script to makeweb requests to Kamite’s backend server.

You can switch to using the right mouse button instead of the middle by going totheCode tab and changingconst MOUSE_BUTTON = 1 to say= 2. Note thatthis will disable the browser context menu that normally opens on right-click.

Linux manga viewer with Kamite integration

Gomics-v is a manga viewer for Linux that includes simple Kamite integration:

  • Right-click on a text block to automatically recognize it.

  • Right-hold-click anywhere in the area where images are displayed toinitiate a manual block recognition selection.

The integration must be enabled in Gomics-v underPreferences › Kamite.


Related Wiki sections:

Visual novel / game text extraction

Kamite can receive text extracted from other programs throughTextractorandAgent text extractor programs:

There is also a RPG Maker MV/MZ plugin that can directly extract text from gamesusing those engines: seecontrib/KamiteSendRPGMaker.js(usage instructions are in the plugin file).

Other integrations can be created using theCommand API.

Tip

For games that cannot be integrated using the above means, theRegion OCR feature might prove an alternative.

Textractor integration

An extension forTextractor is available that sends lines of textextracted by it from other programs to Kamite.

To install theKamite Send Textractor extension:

  1. CopyKamite Send.xdll from either theextra/textractor/x86 (32-bitTextractor) orextra/textractor/x64 (64-bit Textractor) within the releasepackage to the main Textractor directory (the one containingTextractor.exe).

    [!NOTE]If you installed Kamite from AUR, the files will be in/opt/kamite.

  2. In Textractor, press theExtensions button, right-click in the extensionlist, chooseAdd extension and select theKamite Send.xdll file copiedearlier.

For Textractor’s text processing extensions (such as Remove Repeated Characters)to be executed before sending the text to Kamite, position Kamite Sendbelowthem on the extensions list.

Want to prevent Textractor from inserting unnecessary hooks? Check outTextractor-HookAllowlist.

Changing the default Textractor extension endpoint

By default, the extension expects Kamite to listen for commands at the addresslocalhost:4110. If it is running on a different address (e.g., because youhave Textractor in a virtual machine and Kamite on the host), the extensionneeds to be configured correspondingly. To do so, create aKamite Send.txtfile next toKamite Send.xdll in the Textractor directory, containing Kamite’snetwork address from the perspective of the machine running Textractor, e.g.:

host=192.0.0.10:4110

Agent integration

To receive text (and, optionally, machine translations) from theAgent textextractor:

  1. Addintegrations.agent.enable: yes toconfig.

  2. In Agent, go toTranslate tab and enable the optionWebSocketServer (youcan then browse tohttp://127.0.0.1:9001/ to confirm that it is enabled).

With this setup, Kamite should receive text from Agent.

Tip

(Linux) To hook Wine games, you can run the Windows version of Agent throughWine (you might need an older version of Wine, such as 6.14).


Related Wiki sections:

Clipboard

Text can be pasted from clipboard by pressingCtrl +V inKamite’s browser tab.

The Kamite browser client can automatically pick up clipboard text with aclipboard inserter browser extension (Firefox,Chrome) (assumes default extension settings).

Watcher script

Clipboard can also be watched automatically without the Clipboard Inserterextension, but with a clipboard watcher script that sends changed clipboardcontent to Kamite:

Custom source / alternative method text extraction

Custom sources and alternative text extraction methods can be integrated usingtheCommand API.

Filtering and transforming incoming text

Kamite has the ability to discard incoming chunks that match a user-providedpattern and to perform text replacements on incoming chunks according touser-provided rules.

Both features are based onregular expressions, which can be learned using thefollowing resources:

  • RegexOne — interactive regular expression tutorial.
  • regex101 — regular expression tester and explainer.

Note

The particular regular expression engine used by Kamite is Java’s, whichhas some particularities. Therefore,Java’s own regular expression referencemight also come useful (note thatregex101 can be instructed to use the Javaflavour of regex through the menu on the left side of the page).

Filtering chunks

To enable the chunk filter, specify chunk reject patterns in theconfig(chunk.filter.rejectPatterns). The patterns are regular expressions againstwhich incoming chunks will be tested. If any part of the chunk matches againstany of the patterns, the entire chunk will be discarded. For exmple, thefollowing configuration:

chunk: {  filter.rejectPatterns: ["^Textractor""(?s).{91}"  ]}

will discard both chunks beginning with the string of charactersTextractorand chunks that are above 90 characters in length.The first of those filters isalready included in thedefault config that is created automatically when noconfig file exists.

Warning

Regular expressions containing the backslash (\) character must (generally)be specified within triple instead of single quotes (that is,""" instead of"). See the section Transforming chunks (following) for an example.

Note

Kamite will automatically reload the patterns once a config file ismodified. There is no need to restart the program. The simplest way to testthe filter is by pasting (Ctrl +V) prepared chunks intothe client’s browser tab and observing whether they are allowed through.

Transforming chunks

To enable the chunk transformer, specify chunk transform rules in theconfig (chunk.transforms). The rules are objects consisting of: 1)a regular expression defining the replacement target, 2) a string specifyingthe replacement text. For example, the following configuration:

chunk: {  transforms: [    { replace:"""\R""", with:"" }    { replace:".+?「(.+?)」$", with:"$1" }  ]}

will remove (replace with an empty string) any line break characters as well asremove the names of speakers and quotation marks from dialogue lines formattedas<name>「<dialogue>」 (this will be replaced with just<dialogue>. The$1 in thewith field is a special reference that will be replaced with thetext captured in the first and onlymatch group definedwithin thereplace field). The rules will be applied in the specified order.

Warning

Regular expressions containing the backslash (\) character must (generally)be specified within triple instead of single quotes (that is,""" instead of"). See the first transform in the example above for illustration.

Note

Kamite will automatically reload the transform definitions once a configfile is modified. There is no need to restart the program. The simplest wayto test the transforms is by pasting (Ctrl +V) preparedchunks into the client’s browser tab and observing whether they come outmodified as expected.

Text use

What can be done with the text once it has been collected into the program?

Editing and transforming the text

Depending on the source and the extraction method, the text coming into theprogram might contain mistakes or other features that need to be changed for itto be usable further. Kamite offers various text editing and transformationfeatures that might be useful for that task.

The main chunk text can be selected character by character using the mouse andtransformed using actions that appear in theaction palette near it, which aremade available depending on the existence and the content of the selection.Characters can also be deleted by pressingDelete orBackspace.

To enter chunk edit mode, which allows for direct insertion of typed text,double-click the main area or pressCtrl +Enter(+Shift to clear). To exit it, click away from the input field orpressCtrl +Enter.

Pop-up dictionary

The basic task around which Kamite is designed is using a third-party pop-updictionary browser extension to learn through deciphering text you understandonly partially. The examples of such extensions areYomichan,rikaikun, and10ten Japanese Reader.

For Yomichan,its website contains a basic installation and usageguide. Additional dictionaries and setup tips for can be found in other places,such asAnimecards: Setting up Yomichan,TheMoeWay: Yomichan Setup Tutorial, orAnacreon DJT:Yomichan Frequency Dictionaries.

Lookups

You can use the text chunks within Kamite as inputs for lookups on externalwebsites. The text that will be used as the lookup input normally corresponds tothe selection in thechunk history window, which, absent user intervention, isthe entire current chunk. If instead there is an active text selection withinthe current chunk, it is only the selection that will be used for lookups.

By default, Kamite embeds the following sites for quick lookups:https://www.deepl.com/,https://ichi.moe/,https://jpdb.io/. It also bydefault provides a button for Google Images lookup in a new browser tab.

Tip

A faster and more robust alternative to using DeepL as a Kamite lookup is touse a scripting-friendly DeepL API client in combination with Kamite’s customcommand mechanism.
The Wiki containsa Linux recipe for how to use theDeepLX program to get DeepL translations into Kamite’s chunktranslation component on button click.

Optional userscripts are provided for the embedded sites that modify their lookwhen embedded into Kamite to improve their user experience. To install or updatethe scripts, first install a userscript browser extension such asViolentmonkeyorTampermonkey, and then open the links below and follow the prompt.

DeepL and jpdb require yet another intervention to work. A browser extensionto slightly modify the responses from those sites is required to make them availablefor embedding.

  1. Install the SimpleModifyHeaders browser extension(Firefox,Chrome)

  2. In the extension’s configuration screen, set the fieldUrl Patterns tohttps://www.deepl.com/*;https://jpdb.io/*

  3. Below that, enter the following parameters (for DeepL):

    FieldValue
    ActionDelete
    Header Field Namecontent-security-policy
    Apply onResponse
  4. ClickNew line and enter the following into the second line of fields (forjpdb):

    FieldValue
    ActionDelete
    Header Field NameX-Frame-Options
    Apply onResponse
  5. ClickSave.

  6. ClickSTART in the top-right corner.

    DeepL and jpdb embeds should now work.

Alternatively, you can have DeepL and jpdb lookups open in a new browser tab bysimply adding the linenewTab: yes to the corresponding lookupconfigentries.

Custom lookups

Kamite supports adding custom lookups. Below is an illustration of the processusing the websiteImmersion Kit as an example lookup target.

  1. Add an object describing the target to theLOOKUP_TARGETS object in themain config file:

    LOOKUP_TARGETS: {# This key can be anything  immersionKit: {# (1-3 characters) The symbol will appear on the lookup button    symbol: IMK# The name will appear in the lookup button’s tooltip    name: Immersion Kit# {} is a placeholder that will be replaced with the lookup text    url:"https://www.immersionkit.com/dictionary?keyword={}"# (Optional) Whether to open the lookup in a new browser tab or embedded    newTab: yes  }}
  2. Add the above-created lookup target to thelookup.targets list:

    lookup: {  targets: [${LOOKUP_TARGETS.immersionKit}# Has to match the key defined above  ]}

Auto-generated furigana

Kamite can add auto-generatedfurigana annotations to the current chunk.Please keep in mind that the auto-generated annotations will frequently beincorrect. To enable this feature:

  1. Get the necessary library file (a morphological analyzer with anincluded dictionary).

    Downloadkuromoji-unidic-kanaaccent-e18ff911fd.jar and put itdirectly in:

    • Linux: either$XDG_DATA_HOME/kamite or, if that is not set,$HOME/.local/share/kamite;

    • Windows: same directory as theconfig file (usuallyC:\Users\<user>\AppData\Roaming\kamite).

  2. Setchunk.furigana.enable: yes in the config file and start Kamite; or, toenable temporarily, start Kamite and switch on the “Enable furigana” settingin the Settings tab.

There is an option to hide the generated furigana annotations until the basetext is hovered with the mouse (chunk.furigana.conceal: yes).

Saving text to a file for external use

Kamite can be instructed to save all chunks that appear in the client into atext file for further use (for example, for purposes of statistical analysis ofthe texts you read). To enable chunk logging, specify the path (in theconfig) of the directory where the text files ought to be saved:

chunk: {  log.dir:"/path/to/the/directory"# Linux variant  log.dir:"""C:\path\to\the\directory"""# Windows variant}

Kamite will then create a dated log text file in that directory for each session(that is, one each time the program is started), to which chunks appearing inthe client will be appended live, one chunk per line (note: to that end, linebreaks within chunks will be replaced with their literal representation,\n,so that actual line break characters demarcate chunks).

To disable logging, either remove thelog.dir definition before startingKamite or simply comment it out by putting the# character in front of it.

Custom text use

Text from Kamite can be forwarded to external programs using Custom commands(see below). Example uses:

Custom commands (Launching external executables)

You can add buttons to thecommand palette that execute specified systemexecutables. Those executables can optionally receive data from Kamite asarguments.

Below is an excerpt from a config file illustrating how to define a customcommand.

commands: {  custom: [${CUSTOM_COMMANDS.exampleCustomCommand}${CUSTOM_COMMANDS.anotherExampleCustomCommand}  ]}CUSTOM_COMMANDS: {  exampleCustomCommand: {# (1-3 characters) The symbol that will appear on the command's button    symbol: CMD# The name that will appear in the command button's tooltip    name: Examplecommand# (String list) The system command to execute.# The first element in the list is the executable, the rest are the# arguments. The arguments can be specific placeholders to be filled by# Kamite at execution time.    command: ["/path/to/the/executable.sh","some argument","{effectiveText}"]  }}

Note

(Windows) To execute a PowerShell script, setcommand to, e.g.,["powershell.exe", """C:\path\to\the\script.ps1""", "first argument"] (notethe triple quotes). The execution of PowerShell scripts is disabled by defaultin the system. To enable it, start PowerShell with the Run as Administratoroption and execute the commandSet-ExecutionPolicy RemoteSigned. Be awarethat this lowers system security.

The supported placeholder arguments for custom commands are:

{effectiveText}
Equivalent to the text used for lookups at the given moment. If there is aselection in the current chunk, just the selection will be used. Otherwise,the text selected in thechunk history view will be used.

{originalEffectiveText}
Same as{effectiveText}, except yields theoriginal text for chunks thathave it. Chunks have original text if their text was modified by Kamite’sautomatic correction procedure or user-provided transforms.

Keyboard shortcuts

Kamite is designed under the assumption that the user’s main activity in theprogram will be hovering over the current chunk text with the mouse fordictionary lookups. Support for keyboard shortcuts is therefore very basic, forthe time being.

Client-only keyboard shortcuts

The following shortcuts apply only within the Kamite’s browser tab.

Backspace,Delete
Delete selected text from the current chunk.

Ctrl +A
Select the entire current chunk text.

Ctrl +C
Copy text depending on what is selected in the current chunk, the current chunktranslation and chunk history.

Ctrl +Alt +C
Copyoriginal text depending on what is selected in the current chunk or chunkhistory. Original text is available in the case when Kamite’s built-incorrections or user-specified transforms have been applied to the text.Otherwise, this acts the same asCtrl+c.

Ctrl +V
Paste text from clipboard.

Ctrl +Enter
Enter chunk edit mode.

Ctrl +Shift +Enter
Enter chunk edit mode erasing the current chunk text.

Chunk edit mode keyboard shortcuts

Ctrl+Enter
Exit chunk edit mode.

Media player keyboard shortcuts (client)

The following shortcuts work only when a media player is connected.

Space
Pause/unpause the playback.


Seek -1 seconds.

Alt +
Seek to the start of the current subtitle.


Seek +1 seconds.

Global keyboard shortcuts

Linux/Xorg and Windows

Below is an excerpt from aconfig file illustrating how to set upglobal keyboard shortcuts and what actions are available for binding.

keybindings: {  global: {    ocr: {      manualBlock: …      manualBlockRotated: …      autoBlock: …# Instant detection under mouse cursor      autoBlockSelect: …# Must click to select a point      region: [        { symbol: …, key: … }      ]    }  }}

The values must be strings in theJava Swing’sgetKeyStroke() format describing the key combinations tobe assigned to the corresponding actions. Some examples of such strings are:

  • meta S (meansWin +S),
  • ctrl shift 1,
  • INSERT.

Linux/wlroots

Global shortcuts on the Linux/wlroots platform must be created manually with theuse of theCommand API. The details of the process will differdepending on the compositor used.

Below is an example of setting up global keyboard shortcuts in Sway’s configfile:

bindsym$mod+sexec"dbus-send --type=method_call --dest=io.github.kamitejp /Receiver io.github.kamitejp.Receiver.command string:'ocr_manual-block'"bindsym$mod+dexec"dbus-send --type=method_call --dest=io.github.kamitejp /Receiver io.github.kamitejp.Receiver.command string:'ocr_auto-block'"

Launch options

Windows: To launch Kamite with extra options, either: 1)create a shortcut toKamite.exe, open its Properties, and append the optionsto the Target string after…\Kamite.exe (e.g.,…\Kamite.exe[space]--profile=myprofile) or 2) append them when invokingKamite.exe orKamite.com from a console window.

First, there are the basic launch options that are read before the config file:

--help
Prints the usage message and exits.

--version
Prints the program version and exits.

--profile=<profile-id>[,<second-profile-id>]+
Instructs Kamite to load the profile config files with the specified IDs. SeeConfig profiles.

--debug[=all]
Instructs Kamite to print debug messages to console as well as to enablecertain extra features in the client that are useful for debugging purporses.
Setting the value toall will instruct Kamite to additionally display debugmessages from the third-party dependencies.

--regionHelper
Launches Kamite in Region Helper mode used to obtain coordinates of screenregions. Useful forRegion OCR.

Beyond that,all simple config settings can be overridden throughcorrespondingly-named launch options. For example, launching Kamite with theoption--ocr.engine=none will give that value precedence over whatever thevalue of the keyocr.engine in the effective config is.

Config

Kamite is configured through a config file placed in the directory:

  • Linux: either$XDG_CONFIG_HOME/kamite or, if that is not set,$HOME/.config/kamite;

  • Windows:%AppData%\kamite (usuallyC:\Users\<user>\AppData\Roaming\kamite).

The main config file must have the nameconfig.hocon.

The config file’s format isHOCON, which is a superset of JSON.

A default config file is automatically placed by Kamite in the expecteddirectory if absent on launch.

Warning

(Windows) On unupdated Windows 10 installations as well as earlier Windowsversions, the system Notepad will not be able to properly display the configfile. In that case, please use another text editor.

Warning

When providing values that containin backslashes (\), for example Windowspaths, you must enclose them within triple quote marks ("""). For example:ocr.tesseract.path: """C:\Program Files\Tesseract-OCR\tesseract.exe""".

Live reload

The config will be automatically reloaded if one of the files is modified.However,only select changes will be applied immediately. To apply others,Kamite will still have to be restarted.The config keys for which the relevantchanges are applied immediately are marked with[RELOADABLE] in the followingsection.

Full config example

Below is an example config file illustrating all the possible options with theirdefault values ( represents no default value):

# Whether to launch Kamite with the control window or in console onlycontrolWindow: yes# Whether to open the client in the default web browser upon launching KamitelaunchBrowser: yeschunk: {# (Milliseconds) The minimum allowed delay between successive incoming chunks# before they begin to be throttled  throttleMS: 1000# [RELAODABLE] Perform slight formatting corrections on incoming chunks  correct: yes# [RELOADABLE] Allow flashing backgrounds of chunk texts in the client's# interface when they are changed or copied  flash: yes# [RELOADABLE] Treat incoming chunks as translations and create a new chunk# for each translation. Useful when watching media with just the translation# subtitles  translationOnlyMode: no# [RELOADABLE]  furigana: {# Add auto-generated furigana annotations to the current chunk. Note that# this feature requires an extra download (see the Auto-generated furigana# section in the README).# WARNING: The auto-generated furigana will frequently be incorrect    enable: no# Hide the furigana annotations behind rectangles, reveal on mouse hover    conceal: no  }# [RELOADABLE]  log: {# A path of the directory where text files with chunks appearing in the# client should be saved. Chunk logging is disabled when this key is absent    dir: …  }# [RELOADABLE]  filter: {# A comma-delimited list of strings representing regular expressions against# which incoming chunks will be matched. If there is at least one match, the# matching chunk will be rejected entirely. See the "Filtering chunks"# section of the Readme    rejectPatterns: […]  }# [RELOADABLE] A *list* of objects describing text replacement rules for# incoming chunks. See the "Transforming chunks" section of the Readme  transforms: [    {# A regular expression whose match will be replaced in incoming chunk texts.# Enclose in triple quotes to avoid problems with special characters      replace: …# The replacement text. Supports match groups (`$1` stands in for the 1st# capture group in the `replace` regular expression, and so on)      with: …    }  ]}commands: {# [RELOADABLE]  player: {# Show extra media player controls (seek -+1 second, seek to the start of# the current subtitle)    showExtra: yes  }# [RELOADABLE] A *list* of custom commands that allow launching system# executables through buttons in Kamite's command palette. See the# "Custom commands" section of the Readme  custom: [    {# (1-3 characters) The symbol that will appear on the command's button      symbol: …# The name that will appear in the command button's tooltip      name: …# (String list) The system command to execute. Can contain certain# placeholders which will be filled in by Kamite at the moment of the# command’s activation      command: …    }  ]}# For development only. See the "Development" page in the Wikidev: {  serveStaticInDevMode: no}integrations: {# [RELOADABLE]  agent: {# Whether to receive text from a running instance of Agent (the option# `WebSocketServer` must be enabled in Agent)    enable: no# The address of the Agent's WebSocket server through which text is# received by Kamite. (There should be no need to override the default# value unless you run Agent and Kamite on different network hosts)    host:"127.0.0.1:9001"  }}keybindings: {# Global keybindings. See the "Keyboard shortcuts" section of the Readme.# WARNING: Not all platforms support global keybindings  global: {    ocr: {# A key combination to assign to the command. See the "Keyboard shortcuts"# section of the Readme for the format specification.      manualBlock: …      manualBlockRotated: …      autoBlock: …# Instant detection under mouse cursor      autoBlockSelect: …# Must click to select a point# Bindings for user-defined OCR regions by symbol      region: [        { symbol: …, key: … }      ]    }  }}# [RELOADABLE]lookup: {# A list of lookup targets that will be displayed in the notebook’s tab bar.# Consult the default config for further illustration of configuring lookups  targets: [    {      symbol: …# (1-3 characters) The symbol will appear on the lookup button      name: …# The name will appear in the lookup button's tooltip# The lookup's URL that should contain the placeholder {} which will be# replaced with the lookup text by Kamite      url: …# Open the lookup in a new browser tab or embed it into Kamite’s notebook      newTab: no    }  ]}ocr: {# The OCR engine to use: none, tesseract, mangaocr, mangaocr_online, ocrspace,#                        easyocr_online, hiveocr_online  engine: none# (Directory path) Watch the specified directory for new/modified images and# OCR them automatically  watchDir: …  tesseract: {# (File path) The path to Tesseract’s executable    path:"tesseract"  }    mangaocr: {# (File path) A path to a python executable that provides access to the# `manga_ocr` module. If absent, a system-dependent default is used which# assumes that manga-ocr was installed through pipx into the default# location    pythonPath: …  }  ocrspace: {# (1, 3) The OCR.space engine to use (see # https://ocr.space/OCRAPI#ocrengine)    engine: 1  }# [RELOADABLE] A *list* of OCR regions, for each of which a region recognition# command button will be displayed in the command palette. See the# "OCR region" section of the Readme for details  regions: [    {      symbol: …# (1 character) The symbol will appear on the region’s button      description: …# The description will appear in the region’s button tooltip# (Numbers) The screen coordinates of the regions’s top-left corner      x: …      y: …# (Numbers) The screen dimensions of the region      width: …      height: …# Try to automatically narrow the region’s screenshot to just text before# OCR-ing it.# NOTE: The implementation of this function is currently very basic. It#       might not prove helpful in most use-cases      autoNarrow: no    }  ]}server: {# The port on which to run the client and the API  port: 4110}# [RELOADABLE]sessionTimer: {  autoPause: {# Whether to enable auto-pausing the session timer after a period of# inactivity. (Overriding this particular option is only useful for# disabling auto-pausing from a profile config or from the command-line in# case the `after` option has been set in an earlier config)    enable: yes# (Time duration) The inactivity time interval after which to pause the# session timer. Example valid values: `30s`, `5m`. (If this option is set,# auto-pausing can still be disabled by setting `enable` to `no`)    after: …  }# Whether to pause the session timer initially at program launch  startPaused: no}# [RELOADABLE]ui: {# The client's user interface layout (standard, standard_flipped)  layout: standard# Hide non-essential interface elements until mouse hover  focusMode: no  notebook: {# Automatically collapse the client's notebook to just its tab bar,# expanding only when it's being interacted with    collapse: no# (25-90) The height of the client's notebook as a percentage of the total# browser inner window height    height: 60  }}update: {# Whether to check for updates on program launch and, if one is available,# print a notification to the Control GUI and the console  check: yes}# Secrets used for authentication to third-party services.# WARNING: This is unsafe plain-text storage. Do not put data here that you deem#          too sensitive for this kind of storagesecrets: {# The OCR.space API key  ocrspace: …}

Substitution (variables)

The config format supports substitution. You can define your own keys and thenuse them when specifying values for the keys read by Kamite, listed above. Forexample, the following configuration:

chunk.log.dir:${MY_HOME_DIRECTORY}"documents/kamite-chunk-logs"ocr.mangaocr.pythonPath:${MY_HOME_DIRECTORY}".local/pipx/venvs/manga-ocr/bin/python"MY_HOME_DIRECTORY:"/home/my-username/"

will be resolved to:

chunk.log.dir:"/home/my-username/documents/kamite-chunk-logs"ocr.mangaocr.pythonPath:"/home/my-username/.local/pipx/venvs/manga-ocr/bin/python"

Kamite will warn you if you specify an unknown key in a config file, sincemistyping their names is a common source of mistakes. But it will at the sametime ignore keys whose names start with a capital letter, under the assumptionthey are your own keys, likeMY_HOME_DIRECTORY in the example above. For thisreason,it is advised to name your own keys using capital letters to avoidconfusion and false positive warnings.

Config profiles

Kamite supports having a set of different config files for different use-cases.

Creating in the config directory a file namedconfig.example-profile.hoconand then launching Kamite with thelaunch option--profile=example-profile will instruct Kamite to take into account both themainconfig.hocon file and theconfig.example-profile.hocon file, withvalues from the latter taking precedence.

The values from all config files are resolved within a common context, whichmeans that the files share the objects defined in them. For example, this worksas expected:

config.hocon

lookup: {  targets: [${LOOKUP_TARGETS.deepl}${LOOKUP_TARGETS.jpdb}${LOOKUP_TARGETS.googleImages}  ]}LOOKUP_TARGETS: {  deepl: {    symbol: DEP    name: DeepL    url:"https://www.deepl.com/translator#ja/en/{}"  }  jpdb: {    symbol: JDB    name: jpdb    url:"https://jpdb.io/search?q={}"  }  googleImages: {    symbol: GLI    name: Google Images    url:"https://www.google.com/search?q={}&tbm=isch"    newTab: yes  }}

config.no-translations.hocon

lookup: {  targets: [${LOOKUP_TARGETS.googleImages}  ]}

Given the above configuration, launching normally showsdeepl,jpdb, andgoogleImages lookups, whereas launching with--profile=no-translations showsonlygoogleImages lookup.

Combined profile (multiple extra config files)

Several extra config files can be loaded at once. To achieve that, specifymultiple profile IDs with the--profile launch option, separating them bycommas, e.g.,--profile=first-profile,second-profile. The values from theleftmost profile’s config file will have the highest precedence.

Style customization

If present, Kamite loads thecustom.css file from the root of theconfigdirectory, which can contain style customizations for the client.Refer to your web browser’s Inspector view to see what CSS variables can beoverridden and what ids and class names the various elements on the page can bereferred to with.

Below is an examplecustom.css file to illustrate how to go about thecustomization.

:root {--color-bg: navy;--color-bg-hl: navy;--color-bg2: blue;--color-fg: fuchsia;}#character-counter* {font-size:28px;}.notebook-tab {border:3px dashed green;}#chunk-label:after {content:"Design is my passion edition";color: yellow;}

The root client element is assigned CSS classesprofile-X, whereX standsfor each profile specified at launch. Style customizations can therefore bedefined per profile. For example, the followingcustom.css:

.profile-vn {--color-bg: purple;}

will recolor the background to purple only when the program was launched withthe profile namedvn.

Styling recipes

Kamite black theme

Examples of ready-made style customizations, including a black color theme, canbe found on theStyling recipes Wiki page.

Command API

Kamite can receive commands sent programmatically, which makes it simple toit integrate with all kinds of custom workflows.

Available commands are distinguished bycommand kind, which is made up of twosegments:command group andcommand name. For example, kindocr_regioncorresponds to the groupocr and the nameregion.

The command parameters are required unless they are marked as optional or adefault value is specified.

Sending commands

Below are examples illustrating the available means of issuing commands toKamite through its API.

DBus (Linux)

dbus-send --type=method_call \  --dest=io.github.kamitejp /Receiver io.github.kamitejp.Receiver.command  string:"chunk_show"\# command kind, i.e. "{command_group}_{command_name}"  string:'{"chunk": "This is the chunk text"}'# JSON object of command parameters

HTTP

Linux:

curl -i -X POST \  -d'{"chunk": "This is the chunk text"}' \  localhost:4110/cmd/chunk/show# {kamite_host}/cmd/{command_group}/{command_name}

Windows (PowerShell):

$body=@{"chunk"="This is the chunk test"}Invoke-RestMethod-Method'Post'`-Uri'http://localhost:4110/cmd/chunk/show'`-Body"$($body|ConvertTo-Json)"

Command listing

See theCommand API listingpage in the Wiki.

Privacy

Kamite never saves your data to disk.

Kamite only sends data through the internet in the following circumstances:

  • Whenupdate.checkis not set tono, a connection togithub.com ismade on every launch in order to check for the availability of a newer versionof Kamite.

  • Whenocr.engine is set tomangaocr_online, screenshots of portions of yourscreen are sent toa Hugging Face Space by detomo for textrecognition.

  • Whenocr.engine is set tohiveocr_online, screenshots of portions of yourscreen are sent to aHugging Face Space by seaoctopusredchickenfor text recognition.

  • Whenocr.engine is set toeasyocr_online, screenshots of portions of yourscreen are sent to aHugging Face Space by tomofi for textrecognition.

  • Whenocr.engine is set toocrspace, screenshots of portions of your screenare sent toOCR.space for text recognition.

Screenshots sent to third parties can be inspected in the client’s Debug tab(seeTroubleshooting). They are labelled as “Remote OCR”.

Development

Kamite is built mainly with Java andSolidJS (TypeScript).

For more information see theDevelopment page in the Wiki.

License

Kamite
Copyright (C) 2021-2023 Piotr Grabowski

This program is free software: you can redistribute it and/or modify it underthe terms of the GNU Affero General Public License as published by the FreeSoftware Foundation, either version 3 of the License, or (at your option) anylater version.

This program is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License alongwith this program. If not, seehttps://www.gnu.org/licenses/.

Third-party components

The Kamite repository and the Kamite release package include the followingthird-party components (as well as their subcomponents):

ComponentLicense
Apache Log4jApache-2.0
hypfvieh/dbus-javaMIT
JacksonApache-2.0
JavalinApache-2.0
jkeymasterLGPL-3.0
Java Native Access (JNA)Apache-2.0
jsoupMIT
Kuromoji UniDic Kana AccentApache-2.0
Noto Sans JapaneseOFL
RobotoApache-2.0
SLF4JMIT
SolidMIT
Solid Styled ComponentsMIT
tscfgApache-2.0
Typesafe ConfigApache-2.0

Kamite also includes components adapted from third-party code. Seehttps://github.com/fauu/Kamite/search?q=adapted for the listing, includingthe original license notices.


[8]ページ先頭

©2009-2025 Movatter.jp