Cross-Platform Writer Progress

Earlier this year, I mentioned I was doing a rewrite/port of my custom writing software in order to support it on Linux. If you haven’t read about that, I recommend doing that first.

Anyway, my Avalonia UI port is going very well, and it’s now mostly usable on both Windows and Linux Mint. Its source is available on GitHub at

You may recall I wasn’t sure what to do about my document format and rich text editor. Previously, it was based on Microsoft’s FlowDocument, and nothing outside of .NET on Windows supported that. My choices were to wait for the Avalonia team to come around to supporting FlowDocument, or migrate to another document format, one that was not limited to Windows.

So I migrated to another document format. For the rich text editor, I selected Quill, which is a browser-based JavaScript editor. To me, this was a very weird choice, especially since my application is not web-based and I generally hate web-based software. So I needed to embed a web browser. I used the Chromium Embedded Framework (CEF) along with an Avalonia-compatible .NET binding for it called CefNet, and as weird as this is, it works well and its cross-platform. It’s also pretty seamless. You’d have no idea you’re interacting with a web browser!

Quill uses its own document format called Delta, which is really just JSON. JSON is text-based so it stores just as well as the old XML-based FlowDocument in my editor’s SQLite save file. I have a barebones custom converter that converts FlowDocument to Delta. Right now it handles about 95% of my data, and I’ll fix the remaining when I find it. If there are other users of this software, there’s a good chance the importer will miss stuff when you run it, because you are probably using document features I’m not using (lists, certain types of formatting, etc.) I’ll handle these as I become aware of them, but it’s a good idea to keep a backup of your old WPF-based works database so that data is not lost.

I am a big advocate of digital privacy. This new version of the app will NOT load Quill or its resources from the Internet. They will be loaded from offline HTML/JS files packaged with the application. I also cut out as much tracking/telemetry as possible from CEF. Originally, the embedded web browser submitted all kinds of stuff to Google which was ridiculous for a private offline application. I think I got 99.9% of all that shut off or blocked. There may be a couple minor cases left but I haven’t run into them yet. Ultimately, this means the app does not require an Internet connection and nothing within my app is scanning/tracking your data or providing it to outsiders.

No Official Mac Support, Sorry!

I mentioned before that this app would run on Mac once I finish porting to the new toolkit. Unfortunately, now that I’ve done most of the work this will not quite be true. The problem is cost/resources. It is free to develop for Windows and Linux, but Apple expects you to have Apple hardware (which I don’t have), a paid Apple developer account (which I don’t have), and a code-signing certificate (which I don’t have, because they are quite expensive and difficult to get as an individual and not a company).

That said, my codebase should be very, very close to working on Mac. I just can’t test it or officially support/release it. It’s very likely the branch will work if you were to compile it yourself and make a few tweaks to the CefNet startup code. I somewhat dislike the open source mentality of “It’s open source, so just fix the code yourself!” but I have to take that position on this issue. But I will gladly accept pull requests if someone wants to finish Mac support and figure out how to properly distribute it.

You Can Now Print!

I never even considered printing support in the old WPF-based app. But using CefNet, I almost got printing for free. I just call a Print() function on the embedded webview, and the built-in browser prints for me! All I had to do was write up some print CSS for the Quill editor page to clean it up a bit.

Combining Document Formats

The old WPF-based version had two document formats: FlowDocument which was used for manuscript text, and MarkdownDocument which was used for notes and tickets. I was never quite comfortable with that, but FlowDocument was missing features I found useful for notes, and Markdown was very inadequate for a rich text document.

The new Avalonia-based version, however, only uses one document format based on Quill delta. This simplifies things, and avoids mental context-switching when a different document has a totally different UI and set of features. Now, it’s all the same!

Losing Some Features

I am trimming the fat, so to speak, as part of this port. A couple features I never really used are going away.

File Browser

The old File Browser feature allowed you to embed entire files within the works database. I intended this to store cover art, completed manuscripts, and so on, so it’s all packaged up in the works database and you only have to backup/store one file to have everything. However, I never used this feature for anything except storing one Word template file, so I simply canned this feature. So when you update, make sure to pull any important files out of the File Browser first, because they will be nuked as part of the database upgrade.

Ticket Tracker

As a software engineer, my concept of ticket tracking is heavily influenced by Redmine/Trac/Jira/Bugzilla/etc, and my ticket tracker reflected that. But it was actually way too heavyweight, and so I am removing it. All tickets and ticket history will be lost as part of the database upgrade to the new version.

What’s Left?

I have a ton of small tweaks and fixes to work on, but it’s mostly usable at this point. (Export to Word is very much still a work in progress.) I have not created a release yet, but that should happen in the upcoming weeks. In the meantime, the avalonia branch is buildable and usable to anyone who wants to build it in Visual Studio. Check it out here:

Well, that’s all I have for now. Thanks for reading!

2022 Update: Audiobooks, Book 4 Progress, and Writer Updates

Hello readers! Been a while since I’ve posted, so here’s an update on how things are going.

Coming Soon: Audiobooks Through Audible

I’m joining Audible! This means my collection will eventually be available in audiobook format, narrated by myself. Rescue at Waverly is fully narrated and uploaded to Audible, and I’m waiting for some beta listener feedback before I click the publish button. It’s around 8 hours in length. In addition, I have about a third of Rebellion at Ailon recorded, but it (as well as most later titles) will be around 15 hours in length so I’m going to wait on feedback for Waverly before I do too much work on these.

Here I am, recording in my home studio.

Progress Update on Mercenary Ascent

To put it bluntly, I am way, way behind on my fourth novel, Mercenary Ascent. My existing manuscript had become a disorganized collection of short stories, and it wasn’t driving forward the story I need to tell. As a result, I’m doing a “do-over” of it. I came up with a new outline, I’m copying in old things from the manuscript that are still usable, and I’m trying to create a more focused, driven story.

One hard part is I’m dealing with a large amount of general burnout in almost everything, and it’s been difficult to find motivation to work on this project. I finally found an environment where I can be productive (sitting outside at one of my city’s lakes) but the “spring” weather has been so terrible (cold, rainy, and sometimes snowy) that that hasn’t been much of an option. I hope I can make significant progress this summer. As an aside, I know I’m not the only person dealing with burnout these days, and I’m finding just how important it is to change up your environment and surroundings in order to make yourself productive again.

My Writer Application Is Coming To Linux And Mac, Finally!

Lastly, I am finally taking efforts to make my writer application cross-platform, because I am primarily a Linux Mint user and I’d like this to work on that OS. Currently, it is Windows-only because it uses the Windows Presentation Foundation (WPF) as the UI toolkit. I have a branch in git where I am porting the project over to .NET 6 and a UI framework called Avalonia UI, which is supported on Windows, Linux, and Mac.

Avalonia is extremely similar to WPF (still uses XAML and databinding, and the syntax is around 90% compatible), so most of my existing code is porting over with only minor changes. Performance has improved a lot, too! I really don’t know what the state of WPF/.NET on Windows is these days, but it seems to have some significant performance issues. Mostly the mouse hitches around a lot, there’s stuttering and microfreezes, and sometimes lost keystrokes. I thought it was a problem with my application, but I’ve noticed all WPF applications (including some versions of Microsoft Visual Studio) act this way on my Windows 10 machine, so there’s a deeper issue there.

Avalonia does not have that stuttering at all. So even if I didn’t care about cross-platform support, it would be worth the switch just to fix the performance issues and reduce frustration. In any case, it’ll help me migrate more fully into Linux as my primary OS, and in theory the application will also work on Macs although I will not be able to test or officially support Apple. Officially, this app will be supported on Windows 10 and Linux Mint. Unofficially, it should run on anything that supports .NET 6.0.

There is one big problem with Avalonia, however: it doesn’t have an implementation of FlowDocument or a rich text editor. My documents are completely based upon the FlowDocument type, so that part is still Windows-only. There are tickets and chatter on Avalonia’s GitHub page regarding this issue, so I believe they’ll have a solution eventually. So, my plan is to port as much of my application over to Avalonia as possible, which should be pretty much everything except the actual document editor. At that point I’ll have to re-evaluate things. Maybe by then Avalonia will have a rich text editor, and then the final porting will be easy.

There are other options, none of which I’m too enthused about. I could migrate my data to some other format and do something weird like embed a GTK or Qt rich text view into the app. I did look into AvaloniaEdit because a lot of people recommend it, and while it’s a cool project, it’s meant for coding and not document creation. It would take some significant hacking to make it fit my purposes, but I haven’t ruled it out yet. Lastly, I could do something completely custom, which I really don’t want to do. This app was only possible because the FlowDocument/RichTextEditor in WPF did all the document editing for me, allowing me to focus development efforts on all the supporting features outside of the document editor.

An early build of TJ Mott’s Writer running on Linux Mint. Progress!

Anyways, that’s all I have to share at the moment. Thanks for reading!

TJ Mott’s Writer – Video Overview

Hello, readers. If you’ve been following this blog, you know I released my custom software for writers as free and open source. I’m going to start a video tutorial series to cover some of the basics and help you get started. I just finished uploading the first video, which is a brief overview of the application’s features. Take a look here. (Also, it’s up to version 0.2.1.)

I don’t have much more to say right now. I’m still slowly making progress on my fourth science fiction novel, “Mercenary Ascent.” I’m also doing some work on a fantasy novel, but I’m not prepared to share much about it yet except that it involves black magic and grenade launchers. I came up with the premise while sick with a fever, reading some C.S. Lewis, and playing Quake: Champions…

TJ Mott’s Writer – Version 0.1.0 Release

Hello everyone,

Today I created the first public release of my own word processor, writing/publishing tool. This is a beta release, version 0.1.0, but I am currently able to use it for my writing tasks. This is a free, open-source application for Windows, and you can find out more here or download the installer at the project’s GitHub page. Here’s a direct link for the version 0.1.0 installer.

The actual word processing side is fairly basic since my needs are pretty simple. It’s based on Microsoft’s FlowDocument model, and I hooked up a few basic editing/formatting controls in the Ribbon at the top (half of them may not work since I don’t really use them…FYI). Nothing special to it; I mostly followed the online WPF RichTextBox samples and kept it pretty basic. Word has a billion times more features. Anyway, it does what I need, and it has the capability to export to a Word document which is what you’d submit when publishing. Here’s a screenshot from the opening scene of Rescue at Waverly:

But for me, the real power in this application is the way it organizes information, allowing you to easily move sections/chapters around without risk of copy-paste errors, as well as the Markdown document system used for creating notes and reference material. Here’s the main view, with some components partially expanded:

Some of the notes I’ve started to compile. Most of my notes are still kept in a personal Redmine website, but my plan is to host all these features within this application itself:

There’s a ticket tracker and file browser, but mine are currently empty so I have no meaningful screenshots to show. However, I’m using SQLite’s full-text search to search everything: titles, contents, notes, tickets, etc. Here’s a slightly-redacted screenshot of that:

And that’s really all I have to show for now. It’s free for download and use, so if you’re interested, go ahead and install it. If you find any issues, let me know.


TJ Mott

Nerd Alert – My Custom Software for Writing

Boring Update About My Second Novel

First off, I assure you all that Book 2 of the Thaddeus Marcell chronicles is mostly written now. I’m nearly done with my first draft of “Rebellion at Ailon” and then comes the editing process. I feel much more experienced and confident this time around, and so I think that this first draft will be pretty close to the final published version, apart from some polishing, fixing up consistency issues, replacing some placeholder names with real character names, spending some serious time with a thesaurus, and so on. In any case, I’m feeling very comfortable with my self-imposed publishing deadline of January 2019.

But none of that is really the topic today. Instead, I want to talk about far more interesting things: word processors.

Now, if you’re done laughing and you’re still here, cool. If you didn’t know, I’m a software engineer at my day job. Writing is just a side hobby that I enjoy and sometimes it draws in a few extra bucks. But who says the two can’t be combined? (Yes, even my side projects have side projects…)

Are you nuts? Why In The World Would You Write Your Own Word Processor?!?!

When I started writing the Thaddeus Marcell Chronicles (probably around 2016-ish is when I got serious about the project, though it’s been on my radar since junior high school and I’ve probably had half a dozen aborted attempts since then) I switched back and forth between Microsoft Word and LibreOffice, depending on whether I was on a Windows or a Linux PC. Towards the end of 2017, I ran into some major annoyances while editing Rescue at Waverly. My biggest problem was how much I needed to move things around. Scenes and chapters got cut and pasted all over the place while smoothing out the story flow. But the document was difficult to navigate. Word and LibreOffice outlined inconsistently and didn’t always get along, and I found myself doing document-wide searches on a few remembered phrases just to get me close to the section I was trying to find.

But I’m a software engineer, right? I don’t have to put up with this! I’m gonna go make my own word processor! With blackjack and hookers! My main goal was to improve document organization so I could easily navigate it and move things around. Overall, it’s really basic and tailored specifically to my use. Sometimes it’s buggy, and it’s definitely not at all fit for public consumption. It saves everything to an XML document and I still sometimes have to hand-edit the XML to do a few things because sometimes that’s faster than adding the feature to the application itself.

The Amazing WpfApp1.exe

It’s written in C#, using WPF (Windows Presentation Foundation) for the user interface and targeting .NET Framework 4.5.something-or-other. Unfortunately, using WPF means it will not run on Linux even with Mono or Wine, but oh well. C# is my best programming language and I had to compromise somewhere in the interest of developing something quickly. In this case I lost the ability to write on over half of my personal PC’s.

Here’s a couple screenshots of the main window. Yes, it’s titled “MainWindow” and yes that’s because I never bothered setting window titles myself. (Such details weren’t important for a tool I wrote for myself.)

List of series (a.k.a. my evil plans for the next decade of my life)

Showing the chapters and scenes within a book

Here’s a top-down overview of the involved data structures necessary to understand the application, as illustrated above:

  1. Universe: A Universe is a single XML file containing a collection of related stories.
  2. Series: This is what you’d expect. A series is a collection of related books, usually with a common theme, characters, and plotline. As you can see above, I have plans for three series in the Thaddeus Marcell universe.
  3. Book: This is also what you’d expect. Rescue at Waverly is a book. Rebellion at Ailon is a book. I have many such book ideas outlined above. Have fun speculating. 🙂
  4. Chapter: Okay, I need to quit starting definitions this way, but this is what you’d expect. Here, a chapter is a collection of Scenes. Chapters are somewhat arbitrary. I’m sure there are rules out there somewhere, but I don’t know the rules and I don’t play by the rules.
  5. Scene: A scene is a single narrative section. In my writing, a change of scene usually involves a change in point of view or narrator, or a skip in time. You can see some scenes listed under the chapters above. Scene names are only for me, they are never included in the published work so sometimes I get pretty goofy with them just so I can remember it.
  6. Trash: You don’t delete stuff, at least not intentionally. If I delete something, it only gets hidden and moved into the Trash. It takes a conscious effort to “Show Trash” and then delete stuff later. I just clicked on “Show Trash” for this screenshot, and I couldn’t tell you what half the deleted things were supposed to be. Many of them are empty scenes. I guess I need to empty the trash sometime.
  7. Showing the Trash. Okay, I admit I deleted the USPSA scene because my fellow IDPA Safety Officers would have my head about it.

How I Organize Things

I quickly learned how to abuse chapters. Now, when setting up an outline I create a “chapter” for each subplot, and fill it with scenes. Later, during the editing process, I move the scenes out and interleave them into the real chapters that end up in the published version, and the subplot chapters get trashed.

I also have the ability to color the scene names in the main window. You can get a glimpse of that in the trash screenshot above, where some entries have red text and others are black. This is arbitrary. I use it to flag sections I know are done, or mark ones that really need some more work, or to mark scenes for possible deletion.

Abusing chapters to organize subplots – with bonus not-quite-spoilers on Rebellion!

The Main Editor Window

Here’s a screenshot of the main editor that opens when I edit a scene. Each window only shows one scene at a time, but I can have several such windows open simultaneously when I need compare different scenes/chapters. I don’t think Word or LibreOffice really know how to do that.

Scene editor windows

My Dirty Little Secret

Okay, so I didn’t really write a word processor. Not like you’re probably thinking, if you aren’t a coder and you’ve somehow survived reading this far. Actually, most of the main editor window is just an out-of-the-box System.Windows.Controls.RichTextBox instance, which gave me just about everything I needed for a basic word processor without writing much code. Thanks, Microsoft! I simply dropped in a RichTextBox, hooked up some editing buttons (most of which I’ve never actually used or even tested, and I’m sure some of them will BSOD all PC’s within half a mile of me if I actually click on them), and a few extras like the bug-ridden-but-I-don’t-care zoom control and some basic document statistics.

Despite its importance, this really is the smallest part of the application. I spent at most an hour putting this editor window together, and the vast majority of that time was spent coding the search feature that I’ve only used maybe three times ever. Overall, this editor probably has 2% of the features of Word or LibreOffice, but it’s the 2% I care about so it works well for me.

To me, the real value is in the rest of the application, not in the editor itself. I spent most of my time elsewhere developing seemingly-trivial things like reordering scenes, renaming chapters, collecting statistics, and exporting portions to Word format using a template that’s close-ish to what I need to upload to the Kindle Direct Publishing website.

And context-menu handlers! So many context-menu handlers! Most of the application’s C# code (incorrectly) lives inside event handlers in MainWindow.xaml.cs. There are some 600-lines of context-menu and button handling here!

My Visual Studio solution

(Don’t critique my solution too harshly. This is an internal my-use-only tool I never intended to release. I didn’t quite follow things like “best practices” or MVC/MVVM/whatever the cool kids call it these days. It grew very organically and I’d be a bit embarrassed by it if I was releasing this as a product. It’s not even checked into source control! Yes my code is bad and I should feel bad.)

A Couple Other Interesting Tools

You’ve seen most of the application already. Most of what’s left is pretty boring, but I’m a bit proud of these two parts.

Statistics Dialog example, apparently for Chapter 7.

Here, I can see statistics on a selection. This can be for a single scene, a chapter, or an entire story. I realize this looks very boring and mundane at first, but Word/LibreOffice only gives you document-wide statistics. It wasn’t easy for me to figure out how long chapters or scenes were. Now, it’s trivial. It also works great with how I organize things while drafting. Since I (mis)use chapters to organize subplots during the initial writing phase, I can view statistics on the “Crew Mutiny” subplot and see how long it is. Then I can decide if I need to add to it, or trim it down because it’s taking up too much of the story.

Which leads to this bizarre and colorful thing that makes that even easier:

Redacted screenshot of the pacing dialog for Rebellion at Ailon

This window breaks up a selection and helps you compare lengths. There’s a thick black border around each chapter (in this case, each “chapter” is a subplot for Rebellion). Within that is a colorful box for each scene. And all the boxes are proportionally scaled, e.g. a box that is twice as big contains twice as many words. It’s far from perfect. The scaling means the text on smaller sections is cut off and can’t be seen. Oh well.

This is extremely useful for me to figure out pacing. For example, how far does the reader need to go until such-and-such event happens? Is it way too close to the beginning of the work even though in my mind it should be near the end? Or is a subplot involving minor characters growing too large and beginning to dominate the novel? (Not-quite-spoiler alert: Rebellion originally had an entire subplot following Commodore Wilcox’s Yellow Fleet that I decided to move into the third novel.)

This view isn’t quite as useful later on, but it’s been invaluable while outlining and writing out a first draft. Although it is a bit prettier on a finished work:

Not-redacted pacing dialog for Rescue at Waverly

So, there’s a sneak peak into the mind of a software engineer who can’t even do non-software side projects without ending up writing software anyway. Maybe someday I’ll clean this up and release it under an MIT or BSD license. But no promises.