{"id":2893,"date":"2024-03-04T16:56:34","date_gmt":"2024-03-04T15:56:34","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2893"},"modified":"2024-03-04T17:07:18","modified_gmt":"2024-03-04T16:07:18","slug":"replacing-autokey-in-wayland","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2893","title":{"rendered":"Replacing Autokey in Wayland"},"content":{"rendered":"\n<p>Many Linux distros are leaving xorg (x11) for Wayland, as display server protocol. Unfortunately not all the applications are ready for Wayland.<\/p>\n\n\n\n<p>In particular Autokey, a very useful application to expand text and automatize typing operations, is not (yet) compatible with Wayland.<\/p>\n\n\n\n<p>A quite good replacement of Autokey is <a href=\"https:\/\/espanso.org\/\">Espanso<\/a>. But there are also some limitations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Espanso has big problems in <strong>LibreWriter<\/strong> (abbreviations are often expanded with errors).  Similar problems there were also with Autokey in LibreWriter, but Autokey was able to provide some workarounds.<\/li>\n\n\n\n<li>Espanso, unlike Autokey, can provide a very small range of <strong>hotkeys<\/strong> (such as ctrl + alt + d): Espanso can use only hotkeys with ctrl (not with alt or shift) and a few letters. I.g. &#8220;x01&#8221; means &#8220;ctrl + a&#8221;. You can find the whole range of possible combinations <a href=\"https:\/\/ss64.com\/ascii.html\">here<\/a>.<\/li>\n<\/ul>\n\n\n\n<p>However, as long as the main typing operations are in LibreWriter, or Kate, you can use  that applications possibilities to expand text.<\/p>\n\n\n\n<p>in <strong>LibreWriter<\/strong> there are at least two possibilities (to expand an abbreviation):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>tools &#8211; &gt; autocorrect <\/li>\n\n\n\n<li>tools -&gt; autotext <\/li>\n<\/ul>\n\n\n\n<p>In <strong>Kate<\/strong> you can use <a href=\"https:\/\/docs.kde.org\/stable5\/en\/kate\/kate\/kate-application-plugin-snippets.html\">snippets<\/a> to create something similar to Autokey.<\/p>\n\n\n\n<p>I.g. to create a snippet to wrap selected text with the tag <code>&lt;h1&gt;<\/code>, you can add this code as snippet code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>${rangeCommand(\"&lt;h1&gt;%%1&lt;\/h1&gt;\", \"title\")}<\/code><\/pre>\n\n\n\n<p>Choose the title as you prefer (obviously without spaces), and a key combination, i.g. <code>ctrl+1<\/code>.<\/p>\n\n\n\n<p>Don&#8217;t forget to <strong>add<\/strong>, in the javascript section (the tab <strong>scripts<\/strong>) this code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function rangeCommand(command, def) {\n    if (view.selectedText().length &gt; 0) {\n        return command.replace(\"%%1\", view.selectedText());\n    } else {\n        return command.replace(\"%%1\", def);\n    }\n}<\/code><\/pre>\n\n\n\n<p>In this way, you will be able to add a title <code>&lt;h1&gt;<\/code> to your selected text.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=2893\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;Replacing Autokey in Wayland&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[647,565,1,566,723],"tags":[854,127,853,850,326,39,852,851],"class_list":["post-2893","post","type-post","status-publish","format-standard","hentry","category-linux","category-office","category-senza-categoria","category-webmaster","category-writer","tag-autocorrect","tag-autokey","tag-autotext","tag-espanso","tag-kate","tag-librewriter","tag-snippets","tag-wayland"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2893"}],"version-history":[{"count":7,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2893\/revisions"}],"predecessor-version":[{"id":2902,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2893\/revisions\/2902"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}