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.

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.

customize color palette in LibreOffice

You can create a your own palette file,

  • with .soc extension
  • and with a content like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ooo:color-table xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ooo="http://openoffice.org/2004/office">
<draw:color draw:name="panna" draw:color="#faf7d2"/>
<draw:color draw:name="mattone" draw:color="#bc5a1f"/>
<draw:color draw:name="OldLace" draw:color="#FDF5E6"/>
<draw:color draw:name="Cornsilk" draw:color="#FFF8DC"/>
</ooo:color-table>
  • then you have to put it (also as symlink) in /libreoffice/share/palette.

You will be able to choose that palette (with the same name of the file .soc), and you will be able to use your preferred colors highlighting words in LibreWriter, for example.

ancient greek in LibreOffice

Some days ago I wrote this: 

a simple maquillage, unfortunately

I mean ancient greek font so that you can, typing ‘a’ get immediatly ‘α’. So far the free most interesting true type font (the only recognised by LibreOffice) is SPIonic.

You can see more details here

With this font you can tranform the word “Nomos” in “Nomov“, with few mouse clics (basically with the font menu, even though in this case you have to convert the final sigma as well). 

caveat

Absolutely to avoid the “AncientGreek” extension: cumbersome, useless and very aggressive (after removing leaves you with modified shortcuts, including some basic like ctrl + z, ctrl + b and F3).Vey bad!

 a new solution

I noticed that the above solution works only within LibreOffice: if you copy a greek word in another program, you get a no-greek text (with latin encoding). That’s why I call it now a maquillage.
A possible, better solution is go to a website that easyly encode your text in ancient greek, such as this.

embed database data in odt file

 the problem

In odt it is possible to insert some database data as fields in a odt file, but when you change data in phpmyadmin I get
1) a correct update in the data source view above the text,
2) not in the odt file (body: where
are the fields): the fields texts remain unchanged, even after doing the
command “update fields” (both from menu and from keyboard: F9, or
shift+ctrl+F9).

a solution

A workaround is to use insert – section to insert a part of a php file via localhost.

  1. you will see in your odt file the content of the (section=div, of the) php file, as in the picture following:
    image description
  2. insert -> section -> link -> file name “http://localhost/[path]/[filename].php” -> section (the “id” name you have chosen in php file, i.g. inserting a <div id=”biblio”>[php/mysql code]</div> the section name will “biblio”)

Of course, you must previously

  • activate a php/mysql server in local
  • and possibly have some knowledge of html/php source code.

share (embedding) text between odt documents (librewriter)

Impossible use cross-reference or dde-link for more than a paragraph.
So the only way (to share more than a paragraph) are sections:

  1. define the area you want share in the file A as a bookmark;
  2. in the file B insert -> section -> as link – choose the file and the bookmark
  3. the text boormarked in A will be visible in B

n.b.
It is not necessary a master document.

cambiare formattazione ai campi in LibreOffice

Change style in fields:
I campi in LibreWriter, a mio parere, hanno di default uno sfondo troppo scuro, che rende difficile la leggibilità del testo. Per cui si può modificarne lo sfondo, come segue:

Modify option Field Shadings in Option -> Tools -> LibreOffice -> Application Colors -> Cat: Text Document according to you preferred color (light grey, f.e.).