Closed Kabouik closed 4 years ago
Hi, thanks for showing interest! In general, things that can be accomplished already are not prioritized, but a PR may be accepted. Selective responses:
your terminal can already be themed, and I'm not sure an app can control font size or line spacing (can vim?). there could be an option to control the number of blank lines between paragraphs, but that seems like configuration for the sake of configuration
I feel now that images shouldn't be supported - when I used epr, it was annoying to open an image only to find essentially a fancy line break, and the majority of images were like that. Even for maps, I would go online to search for something high res anyway. If you really want images, foliate seems nice.
epubs are zipped web pages, so image/css/html support can be combined as simply 'better epub support'
for the next release i plan to improve search highlighting, add support for links (footnotes), and make line size configurable
edit: next release will probably be at least a few weeks away, overlapping text formatting is tricky
added a line width flag on master. it would be easy enough to add flags to start at a specific chapter or line, but it's kind of awkward if you think about it - what does 'chapter 5' mean? chapters can start at the cover, so 'the 5th chapter' could put at you at the first chapter of the story. and within a chapter is even worse, page and line number depend on the viewport. we could index by word, character, byte, but how useful is that really? maybe it would make sense to have search flags, but you can just launch and then search (well, i have to add toc search).
what's the use case for starting with table of contents open? would a useful heuristic be to open the toc if there is no saved state (it's a new epub)?
Thanks, I'll try it!
You're right, maybe it's not useful. I was thinking it could be nice to open directly the chapter you want instead of the last active page (which should still be the default of course), could be useful for non-linear books, like manuals. If you check a table of contents and confirm the chapter you want, it's easier to type a command to reach it directly than turn pages. But maybe bk
supports mouse events to click directly on the TOC item? I didn't try it in a terminal that supports mouse so maybe I just missed that. Also, adding --page
and/or --chapter
flags would cause other issues: how do we manage saved state? Should bk
overwrite the saved state when it's launched with those flags? It seems to be a corner case that causes more issues than benefits, just forget the idea (and sorry for the suggestion).
As for --toc
(or similar), the idea was just to facilitate checking the content of a book without turning pages or without any user action when the book is open. It could have been combined with automated scripts, like nnn
's preview-tui
plugin for instance, to preview TOCs of any hovered epub instead of the cover. But in most cases, I agree that the first page (cover) is enough for previewing, and when the user explicitly wants to check the content of a book, I guess opening the book and pressing Tab
is perfectly acceptable too.
Not sure if the issue is only on my end, but I can't display the help with the latest master version:
$ bk --help
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnusedArgsLeft(["--help"])', src/main.rs:519:16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[nemo@Sailfish Templates]$ RUST_BACKTRACE=1 bk
[nemo@Sailfish Templates]$ RUST_BACKTRACE=1 bk --help
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnusedArgsLeft(["--help"])', src/main.rs:519:16
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:486
11: rust_begin_unwind
at src/libstd/panicking.rs:388
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:101
13: core::option::expect_none_failed
at src/libcore/option.rs:1272
14: bk::main
15: std::rt::lang_start::{{closure}}
16: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
17: std::panicking::try::do_call
at src/libstd/panicking.rs:297
18: std::panicking::try
at src/libstd/panicking.rs:274
19: std::panic::catch_unwind
at src/libstd/panic.rs:394
20: std::rt::lang_start_internal
at src/libstd/rt.rs:51
21: main
22: __libc_start_main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
bk
itself still works and can display epub files, the issue is only with showing the help. I believe it was working before (but the previous version I had was installed from crates.io).
Oh, my bad. I was sure it did but I must have mixed it up with something else, sorry. It works now with argh, thanks.
added -t --toc
switch to start w/ toc open. i'm curious, how often do you view epubs of manuals / reference material? i hadn't considered that use case; the previous position has less value. i usually use a pdf or a web page for technical docs, and epubs for fiction.
Nice, thank you! I noticed you made it so when quitting bk -t /path/to/epub
, it goes to the last saved location first, so that it can be restored later, that's cool.
Most of my manuals books are in PDF indeed, but I got some .epubs and I think it's becoming more frequent now that electronic books are getting more popular. I also have some books on history that are not really manuals, but still can be very long and convoluted, so being able to preview the TOC from nnn
's preview-tui
plugin without actually opening the .epub in a dedicated terminal will be nice. Since bk
can't display images, I believe displaying the TOC in a preview might be more relevant for that use case than the first page, but I agree it is perhaps a rare use case.
added --meta
to print metadata and exit, might be useful for previews. the output is kind of messy tho.
added text reflow on term resize, search highlighting is kept after search. closing, feel free to make individual issues
Awesome! I just updated, thanks.
On 2020-07-10 06:00 James Campos notifications@github.com wrote:
added text reflow, search highlighting is kept after search. closing, feel free to make individual issues
--
You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/aeosynth/bk/issues/1#issuecomment-656469415
bk
is exactly what I was looking for, a terminal epub reader that is easy to install on any platform or architecture. Thanks for your work!Just wanted to comment on the to-do list you posted in the README and add a few random ideas:
bk
, or maybe add another keybinding to update configuration file according to the current viewing options)This is just my humble wishlist (yet long, I know, but no preessure, I'm enjoying
bk
already with its minimal features), thanks!