babluboy / bookworm

A simple ebook reader for Elementary OS
GNU General Public License v3.0
1.34k stars 102 forks source link

Build for Windows #229

Open kshitijpatil opened 5 years ago

kshitijpatil commented 5 years ago

How do I build this project to run on Windows?

babluboy commented 5 years ago

@kshitijpatil Thanks for your interest in Bookworm but I haven’t given a thought about Windows compatibility.

I know that vala can be compiled for windows. But then several components like the mobi Library in python, pdf2html binary and the way Bookworm runs a background process is Linux/ unix specific, not sure how it will work under windows.

However the library management and epub reading should work if the code can be compiled in windows

GoHoo commented 5 years ago

Would love if someone made it work on windows.

smaragdus commented 5 years ago

On Windows a library manager and e-book reader like Bookworm is badly needed- there are some old and not so good (in most cases- abandoned) readers but library management is close to impossible for those who detest Calibre.

babluboy commented 5 years ago

This Issue has to get a lot of work to implement, all the linux command line work that happens in the background in Bookworm has to be converted into code i.e. looking at running process, grep for words, python scripts execution, etc.

Once that is done, vala code with gtk can be ported into windows.

6uhrmittag commented 5 years ago

Just to provide a workaround: looks like bookworm works 90% from inside the Windows Subsystem for Linux (WSL) with installed X-server on the host.

  1. Install WSL (I'm using Ubuntu 18lts)
  2. Install bookwork
  3. follow x-server instructions: https://www.scivision.dev/x11-gui-windows-subsystem-for-linux/
  4. start xming
  5. in WSL: run com.github.babluboy.bookworm

Bookworm 1.1.0 starts in borderless mode.

issues i noticed (I don't know whether this is caused by WSL, xming or bookworm):

bookwornwin

Great work so far! Once the PDFtoHTML is improved, it's probably a good alternative to http://getpolarized.io.

smaragdus commented 5 years ago

@6uhrmittag Polar Bookshelf is Electron monstrosity.

babluboy commented 5 years ago

@6uhrmittag Many thanks for this work around. I will post this alternatives for windows on the Bookworm website so that other users can benefit. Could you please try to see if the following gets rid of the dbus warning: sudo apt install dbus-x11

Is the PDFtoHTML very slow on WSL? Maybe I will find a better alternative to convert PDF to html for displaying the text on bookworm.

6uhrmittag commented 5 years ago

@babluboy I did some more testing and it turns out some things are broken that I didn't noticed in the beginning. It still works for displaying, annotating and collecting epub files.

sudo apt install dbus-x11

Thanks! It did stop most of the debug messages. Startup feels faster too!

I did some more testing to provide feedback. Maybe this brings windows support a bit further - I'm totally aware that you don't support Windows, so this list is mostly for future testing/improvement(and because it's fun to explore new software ;D):

starting bookworm

I still get debug info in the terminal but mut not as much. Startup does feel faster.

marvin@dd: com.github.babluboy.bookworm 
(com.github.babluboy.bookworm:7082): Gtk-DEBUG: 20:58:14.613: Connecting to session manager 
(com.github.babluboy.bookworm:7082): Gtk-DEBUG: 20:58:14.619: Failed to get the GNOME session proxy: The name org.gnome.SessionManager is not owned
(com.github.babluboy.bookworm:7082): Gtk-DEBUG: 20:58:14.622: Failed to get the Xfce session proxy: The name org.xfce.SessionManager is not owned
(com.github.babluboy.bookworm:7082): Gtk-DEBUG: 20:58:14.626: Failed to get an inhibit portal proxy: The name org.freedesktop.portal.Desktop is not owned 
Failed to get the memory usage 

main window

Debug info when adding a book

When I click + to add a file, I get a terminal output but the import works without issues. This could be caused by LinuxSubsystem since the window shows the Windows mount too... I read about issues with file paths in the LinuxSubsystem... but it's debug only and doesn't affect the usage.

(com.github.babluboy.bookworm:6385): Gtk-DEBUG: 20:38:46.999: Failed to create D-Bus proxy: Could not connect: No such file or directory 

I cant mark a book with left click.

The book opens immediately and I get a terminal output. When I jump back the book is marked and I can edit it. Marking with right-click works

[FATAL 20:40:49.438859] [Gtk] gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed 

I can't edit book info in list mode

This is probably connected to the issue above..

I can't delete a book.

Nothing happends in the UI and I get the terminal output:

[FATAL 20:42:51.506796] [Gtk] gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed 

Settings

Darkmode doesn't work

Switching on works, it's still on after restart but has no effect on the UI. This is probably due to x11/Windows

Book mode

Search doesn't work

"No matches found" with terminal output:

[WARNING 20:53:13.325995] utils.vala:110: Error encountered in execution of sync command [/usr/share/bookworm/scripts/tasks/com.github.babluboy.bookworm.search.sh "/home/mar
vin/.config/bookworm/books/javapocketguide.epub/OEBPS/app03.html" "java"]: Failed to execute child process “/usr/share/bookworm/scripts/tasks/com.github.babluboy.bookworm.se
arch.sh” (No such file or directory)
[WARNING 20:53:13.428148] utils.vala:110: Error encountered in execution of sync command [/usr/share/bookworm/scripts/tasks/com.github.babluboy.bookworm.search.sh "/home/mar
vin/.config/bookworm/books/javapocketguide.epub/OEBPS/ix01.html" "java"]: Failed to execute child process “/usr/share/bookworm/scripts/tasks/com.github.babluboy.bookworm.sea
rch.sh” (No such file or directory)

PDF

Looks like the conversion of the cover didn't go well.

Left epub, right PDF. Both untouched files directly from humblebundle. Other images inside the ebook are fine. Text layout is broken too, but this is more of an issue by the converter... epub: booksworm_epub pdf: bookworm_pdf

Link inside the ebook doesn't work

Links inside the ebook, from the table of content doesn't work. Not related to windows but converting PDF. Error:

Error opening file /javapocketguide.pdf.html: No such file or directory

Is the PDFtoHTML very slow on WSL? Maybe I will find a better alternative to convert PDF to html for >displaying the text on bookworm.

Speed is fine, but it looks like converting doesn't work well with complex layouts. So, not windows related but converting PDF in general :(

babluboy commented 5 years ago

@6uhrmittag Many thanks for the comprehensive testing on this work around for windows using WSL. Its better than I had thought. Here are some initial thoughts:

1- starting bookworm/ Debug info when adding a book: Since this is just debug info, it should not matter. Maybe if the application is not started from terminal i.e. by double click then there is no window for the debug.

2- I can't edit book info in list mode: You would nee to be in select mode first (click the tick button on the footer in library view) and then click on a book to select it. Once selected, the book can be deleted by clicking on the - button on the footer. Hopefully the above works, let me know.

3- I can't delete a book: The output you have suggested does not help, maybe you follow the process above to select the book and then delete it.

4- Darkmode doesn't work: This was a vala gtk theme setting, maybe WSL does not support it. Need to look at what is the issue. https://github.com/babluboy/bookworm/blob/ff67cb2bb72fc494001aade59cac9ae80c4e8a9c/src/dialog.vala#L449

5- Search doesn't work : Search uses the following linux utilities, hopefully they work on WSL - will be great if you can check and install missing ones. The search is executed with this command: https://github.com/babluboy/bookworm/blob/ff67cb2bb72fc494001aade59cac9ae80c4e8a9c/data/scripts/com.github.babluboy.bookworm.search.sh#L8 (1) html2text, (2) tr, (3) grep

6- PDF Conversion: Yes, this is a problem on linux as well and I'm looking for better ways to convert PDF to HTML which preserves the layout better

7- Link inside the ebook doesn't work: Does the find and grep command work on WSL. I will check on this, but as far as I remember, once I qualify the link target as a local file, I use the find command to search it up within the extracted contents of the ebook and load the file if found.

Thanks again for the work in testing this on WSL, if we can get the book deletion and search functions working, then this work around is definitely one people can use.