aboutsummaryrefslogtreecommitdiff
path: root/README.adoc
blob: d225bbbfc224db29cdbcfa8f950c304f9d6560da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
StarDict Terminal UI
====================

'sdtui' aims to provide an easy way of viewing translation as well as other
kinds of dictionaries in your terminal, and is inspired by the dictionary
component of PC Translator.  I wasn't successful in finding any free software
of this kind, GUI or not, and thus decided to write my own.

The project is covered by a permissive license, unlike vast majority of other
similar projects, and can serve as a base for implementing other dictionary
software.  I wasn't able to reuse _anything_ for StarDict.

image::sdtui.png[align="center"]

Further Development
-------------------
While I've been successfully using sdtui for a long time now, some work has to
be done yet before the software can be considered fit for inclusion in regular
Linux and/or BSD distributions.  Help is much appreciated.

An approximate list of things that need to be resolved:

 - the tab bar and the text input field don't handle overflows well
 - figure out a way to become capable of displaying most StarDict dictionaries

Packages
--------
Regular releases are sporadic.  git master should be stable enough.  You can get
a package with the latest development version from Archlinux's AUR.

Building and Running
--------------------
Build dependencies: CMake, pkg-config, asciidoctor +
Runtime dependencies: ncursesw, zlib, ICU, termo (included),
                      glib-2.0, pango, xcb, xcb-xfixes (the latter two optional)

 $ git clone --recursive https://git.janouch.name/p/sdtui.git
 $ mkdir sdtui/build
 $ cd sdtui/build
 $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DWITH_X11=ON
 $ make

To install the application, you can do either the usual:

 # make install

Or you can try telling CMake to make a package for you.  For Debian it is:

 $ cpack -G DEB
 # dpkg -i sdtui-*.deb

Having the program installed, simply run it with a StarDict '.ifo' file as an
argument.  It is however highly recommended to configure it, see below.

Extensions
----------
As the original StarDict is a bit of a clusterfuck with regard to collation of
dictionary entries, I had to introduce an additional `collation` field into the
'.ifo' file.  When sdtui discovers this field while reading the dictionary, it
automatically reorders the index according to that locale (e.g. "cs_CZ").
This operation may take a little while, in the order of seconds.

Configuration
-------------
To get a nicer look in 256color terminals, create _~/.config/sdtui/sdtui.conf_
with the following.  Note that it is intended for black-on-white terminals.

....
[Settings]
center-search = true
underline-last = false
hl-common-prefix = true
watch-selection = true

[Colors]
header = reverse
header-active = ul
search = ul
even = 16 231
odd = 16 255
....

The `watch-selection` option makes the application watch the X11 primary
selection for changes and automatically search for selected text.  This feature
requires XCB.  Wayland is currently unsupported, but would require a compositor
supporting the wlr-data-control protocol.  Luckily, some compositors, such as
Sway, synchronize selections with Xwayland.

You can also set up some dictionaries to be loaded at startup automatically:

....
[Dictionaries]
name1 = ~/path/to/dict.ifo
name2 = ~/another/dict.ifo
....

The names define how they will appear in the tab bar.

Dictionaries
------------
Unfortunately this application only really works with specific dictionaries.
Word definitions have to be in plain text, separated by newlines.

You may use the included transform tool to transform existing dictionaries that
are almost useful as they are, e.g. after stripping XML tags.  You might want to
fix up the `sametypesequence` of the resulting '.ifo' file afterwards, and run
dictzip on the resulting '.dict' file.

https://mega.co.nz/#!axtD0QRK!sbtBgizksyfkPqKvKEgr8GQ11rsWhtqyRgUUV0B7pwg[
CZ <--> { EN, DE, PL, RU } dictionaries]

Contributing and Support
------------------------
Use https://git.janouch.name/p/sdtui to report any bugs, request features,
or submit pull requests.  `git send-email` is tolerated.  If you want to discuss
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.

Bitcoin donations are accepted at: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9

License
-------
This software is released under the terms of the 0BSD license, the text of which
is included within the package along with the list of authors.