Replacing Autokey in Wayland

Many Linux distros are leaving xorg (x11) for Wayland, as display server protocol. Unfortunately not all the applications are ready for Wayland.

In particular Autokey, a very useful application to expand text and automatize typing operations, is not (yet) compatible with Wayland.

A quite good replacement of Autokey is Espanso. But there are also some limitations:

  • Espanso has big problems in LibreWriter (abbreviations are often expanded with errors). Similar problems there were also with Autokey in LibreWriter, but Autokey was able to provide some workarounds.
  • Espanso, unlike Autokey, can provide a very small range of hotkeys (such as ctrl + alt + d): Espanso can use only hotkeys with ctrl (not with alt or shift) and a few letters. I.g. “x01” means “ctrl + a”. You can find the whole range of possible combinations here.

However, as long as the main typing operations are in LibreWriter, or Kate, you can use that applications possibilities to expand text.

in LibreWriter there are at least two possibilities (to expand an abbreviation):

  • tools – > autocorrect
  • tools -> autotext

In Kate you can use snippets to create something similar to Autokey.

I.g. to create a snippet to wrap selected text with the tag <h1>, you can add this code as snippet code:

${rangeCommand("<h1>%%1</h1>", "title")}

Choose the title as you prefer (obviously without spaces), and a key combination, i.g. ctrl+1.

Don’t forget to add, in the javascript section (the tab scripts) this code

function rangeCommand(command, def) {
    if (view.selectedText().length > 0) {
        return command.replace("%%1", view.selectedText());
    } else {
        return command.replace("%%1", def);
    }
}

In this way, you will be able to add a title <h1> to your selected text.

LibreWiter header and footer

This feature is very useful if you write a book: have headers page with the book title on left pages and chapter title on right pages, and page number at the bottom, for example.

  1. To add a header to a page, choose Insert – Header and Footer – Header, and then select the page style for the current page from the submenu.
  2. You can also choose Format – Page, click the Header or Footer tab, and then select Header on or Footer on. Clear the Same content left/right check box if you want to define different headers and footers for even and odd pages.
  3. Then you can add the field you want, such as page number or book title (with Insert -> Field).
  4. Inserting chapter title is a bit more complex: Choose Insert -> More fields and then click the Document tab. Click “Chapter” in the Type list and “Chapter number and name” (or “Chapter name”) in the Format list and select the level (typically the second one: “2”). Click Insert and then click Close.

LibreWriter styles strange behavior

It could happen that apply a (custom) style doesn’t work as expected, i.g. even you have in that style a margin-left this margin is not applied, or it is only temporarily.

To solve you can try removing unused custom styles. Or making that style non hierarchically depending from other styles.

off-line comparation of two documents

You can use LibreOFfice (OpenOffice), following these steps (see here):

«In order to compare documents you need to have the original document and the one that is edited. To compare them:

  1. Open the edited document that you want to compare with the original document.
  2. Select Edit > Compare Document.
  3. An open document dialog appears»

working with LO alphabetical index

In LibreWriter the best way to create and edit an alphabetical index is to use a concordance file, in wich you can add, edit or delete entries (otherwise you can only add entries).

As “alternative entry” you can set the name actually shown in your index.