
Greetings.
I am the author of the program to automatically switch the keyboard layout, working under Linux. This program is xneur or
X Neural Switcher .
When I started this program, there was nothing supposed to replace Punto Swither for linux. Please note, I wrote it for myself personally, almost everything always works for me. I share it only because the program is useful to people.
')
In future articles, I will examine the existing (and existing) counterparts, and explain why they are all that you can not use, and what a cool program xneur.
I’m doing the program on the strength of one hour a week, so it’s silly to blame me for slow development. I make money also by programming, but not at all related to linux.
Over the past 6 years, I occasionally stumbled upon specific bugs like Xlib and DE, which I had to find mutual understanding with.
Now I want to talk about the preparation of xneur, describe the settings and share "little football tricks."
This part of the articles under the number 0 is devoted to the simplest - the description. You'd be surprised how much xneur knows from what Punto can't.
For those who have tried for a long time, but not mastered. I am always open to dialogue. If something does not work somewhere, let me know all the necessary information, and I will try to solve your problem.
What is X Neural Switcher.
X Neural Switcher - a program to automatically switch keyboard layouts, depending on the typed text. Those. when typing, if it is typed in the wrong layout, xneur will automatically (or upon request) switch the language to the desired one.
When working in automatic mode, xneur automatically determines the layout of the entered text and changes the language for you. In this mode, it is possible to set exclusion applications, in which the automatic mode will be replaced with manual mode.
When working in manual mode, xneur does not track the dialing, but allows you to automatically change the layout of the last typed word (Pause / Break button), the last typed line (Ctrl + Break key combination), the selected text (Shift + Break key combination) and other useful functions.
All the above shortcuts work in automatic mode. If for any reason you are not satisfied with the pre-configured combinations, you can always change them in the program settings. The program also allows you to create your own shortcut keys to run any applications.
Currently, the program supports eighteen languages: Armenian, Belarusian, Bulgarian, Czech, Georgian, German, Greek, English, Estonian, French, Kazakh, Lithuanian, Latvian, Polish, Moldavian (Romanian), Russian, Spanish, Ukrainian and Uzbek.
For the above languages, the program has heuristic analysis algorithms, but, nevertheless, the program can work with other languages ​​if there are aspell or myspell dictionaries for it.
The main features of the program.
- Switching. Automatic or manual layout switching. At the same time, xneur is able to self-educate, which is sometimes useful for difficult words that do not fall under dictionary words or under heuristic analysis, for example, padonkaff slang or personally your favorite distorted words.
- Typography. Xneur can help you turn your text into a more refined look. For example, turn the word “Tako” into “such”, or turn off the accidentally turned on caps, or replace two spaces with a comma, or turn it ®, (tm) or © into beautiful®, ™ or ©.
- You can specify one layout for all copies of the application, or use your personal one in each.
- For standard switching actions you can assign your own shortcut key. Moreover, you can assign keyboard shortcuts for your scripts or launch applications.
- You can assign your key combination to enable a specific layout or to switch them around.
- If you are too lazy to type words completely, you can use autocompletion. Xneur will memorize frequently typed words and complement the not fully typed word.
- You yourself can specify applications in which xneur will work in automatic, manual mode, or will not work at all.
- If you feel comfortable, you can customize the sound design of keystrokes or other events, display on-screen or pop-up notifications about switching.
- When you often have to type the same text, you can try using substitution abbreviations. By typing “pr” and pressing your key combination, you will send the other person “Hi. All fine :)". It's so lazy to answer stupid questions.
- There is a diary in xneur. At any time we can see the log of the typed text with a breakdown by date and by the application in which it was typed. Yes, this is a keylogger version. Then I will tell you how to configure xneur as a keylogger.
- If you often play full-screen games, you can turn off xneur in all full-screen applications.
- So. ALL xneur features are disabled! I don’t like any option - just turn it off.
Thus, if you master the fine tuning, you will always cook the xneur to your liking.
Program installation.
The source texts of the latest versions of xneur and gxneur are available at
xneur.ru/downloadsTo install from source, you will need the following packages (I’ll give you a way to install packages for Ubuntu, but you will understand what you need to install):
sudo apt-get install build-essential automake1.9 libtool flex libx11-dev libgstreamer0.10-dev libopenal-dev libpcre3-dev libnotify-dev zlib1g-dev libaspell-dev libxosd-dev libenchant-dev
To build gxneur (interface for configuration) you still need to install these packages:
sudo apt-get install libglade2-dev libgtk2.0-dev libgconf2-dev libappindicator-dev
Installation is carried out by a standard set of commands (again, I quote for Ubuntu).
./configure make sudo make install
To remove a program installed in this way, you can use the command
sudo make uninstall
Now we will analyze the program configuration options, in case you have some packages missing or you just want to disable them.
For reference, you can use ./configure --help.
- --with-sound [= ARG] Building a program with ARG = [yes | no | gstreamer | openal | aplay] [default = yes]. Those. You can use the following engines for sound design: Gstreamer (default), OpenAL or aplay utility.
- --with-debug Build a program with an internal debug showing the location of memory leaks in the program in the console.
- --without-keylogger Building a program without keylogger functions (for paranoids)
- - -with-spell [= ARG] Build the program using the enchant dictionary engine (used in LibreOffice, firefox, etc.) or aspell, or without the support of dictionaries at all. (ARG = [yes | no | enchant | aspell] [default = yes]
- )
- --without-xosd Build the program without xosd screen notification support.
- --without-libnotify Build a program without pop-up message support.
- --without-plugins Build program without plugins support.
But since it’s too lazy to compile a program from source, I have two PPAs for Ubuntu users.
sudo add-apt-repository ppa:andrew-crew-kuznetsov/xneur-stable
sudo add-apt-repository ppa:andrew-crew-kuznetsov/xneur-unstable
The first repository contains basic releases, the second contains rolling releases (nightly builds).
Description of configuration parameters.
Now let's look at what will allow us to fine-tune xneur, namely its configuration file.
We analyze it on the options. I will give a brief description of each option and explain in which cases it is better to use it.
Version 0.15.0Describes the current version of the program. For the most part, generally does not affect anything.
ManualMode NoManual mode option. If set to Yes, automatic switching will be disabled everywhere, except for the applications specified in the corresponding setting.
Loglevel traceThe level of messages that xneur will pour into the console.
Error is only an error.
Warning - previous, plus warnings about problems that do not affect the operation of the program.
Log - previous, plus a little more.
Debug - the previous, plus debug messages of the program.
Trace - the previous one, plus generally everything that happens in xneur.
ExcludeLanguage deThe option allows multiple applications and serves to indicate the layout with which and to which the switching will not be carried out.
DefaultXkbGroup 0Defines the default layout for newly launched applications.
ExcludeApp rdesktopWith this option, you can completely exclude the application from processing. Multiple use is allowed.
SetAutoApp GeditThis option defines applications in which the automatic switching mode will be forcibly enabled, regardless of the ManualMode option.
SetManualApp AnjutaThis option defines applications in which manual switching mode will be forcibly enabled, regardless of the ManualMode option.
AddBind Action KeyDefines a key for an action to switch layouts or other things. The Action list is in your configuration file.
AddAction Control Alt f Firefox Browser firefoxDefines a key to perform a custom action.
ReplaceAbbreviation ini Andrey Crew KuznetsovDefines a list of abbreviations for substitution abbreviations.
ReplaceAbbreviationIgnoreLayout YesDetermines whether to consider the current layout when replacing abbreviations. If set to Yes, the program will replace the abbreviation “q” and “qw” with “ytsuken”.
PlaySounds NoTurns the soundtrack on or off.
SoundVolumePercent 15Determines the volume of the program sounds as a percentage of the system volume.
AddSound AutomaticChangeWord Enable /usr/share/xneur/sounds/itemback.wavThis option indicates for which action and which sound to use. The list of actions for which you can hang the notification is in your configuration file.
EducationMode YesIt's simple. Whether or not to include a self-learning program for your lexicon.
LayoutRememberMode YesRemember layout for each window or one layout for all windows? You decide.
LayoutRememberModeForApp WineThis option will force xneur to use the same layout for all application windows. I have a common layout everywhere in Wine.
SaveSelectionMode YesYou selected and changed the text with xneur. If this option is enabled, the selection will remain after the change, making it possible to further switch.
RotateLayoutAfterChangeSelectedMode NoDetermine whether to switch the system layout, if the selected text is corrected.
SendDelay 0The delay before sending the intercepted keystroke back to the application.
Logsave yesTurn on the keylogger, i.e. save the typed text to a file.
Logsize 10,000,000We determine the size of the file with logs (in bytes).
LogMail to_me@mail.ruIf the option is defined, then the log of the typed text will be sent to this email.
LogHostIP 127.0.0.1Host that provides email services (mail server for sending, which does not require a login and password). Perhaps the indication is not ip, and the name.
LogPort 25Port mail server.
CorrectIncidentalCaps YesOption to correct a random caps.
CorrectTwoCapitalLetter YesOption to correct TWO capital letters.
CorrectCapitalLetterAfterDot YesCorrects a lowercase letter in uppercase after a dot or exclamation point.
CorrectTwoSpaceWithCommaAndSpace YesFix double space for comma.
CorrectTwoMinusWithDash YesFixes a double minus on the dash.
CorrectCWithCopyright YesFixes © on ©
CorrectTMWithmark YesCorrects (tm) on ™.
CorrectRWithRegistered YesCorrects ® on ®.
FlushBufferWhenPressEscape YesIf this option is enabled, then when you press Escape, the internal toggle buffer will be reset.
FlushBufferWhenPressEnter NoIf this option is enabled, then when pressing Enter, the internal switching buffer will be reset.
DontProcessWhenPressEnter NoThe word will not be processed if Enter is pressed, which is convenient in messengers.
ShowOSD NoShow on-screen messages. Outdated
FontOSD - * - * - * - * - * - * - 32 - * - * - * - * - * - * - uFont selection for screen messages. Outdated
AddOSD XneurStart Enable X Neural Switcher launchedThis option indicates for which action and which screen message to use. The list of actions for which you can hang the notification is in your configuration file.
ShowPopup YesShow popup messages.
PopupExpireTimeout 1500Interval display pop-up messages. In this implementation, the display library does not work.
AddPopup XneurStart Enable X Neural Switcher launchedThis option indicates for which action and which pop-up message to use. The list of actions for which you can hang the notification is in your configuration file.
CheckOnProcess YesCheck the word on the fly or after clicking Entrer. I prefer on the fly.
DisableCapsLock YesDisable caps completely.
CorrectSpaceWithPunctuation NoRemove spaces before punctuation.
Autocompletion YesEnable word completion.
AddSpaceAfterAutocompletion NoAdd space after autocompletion.
AutocompletionExcludeApp Gnome-terminalIn these applications, auto-completion will be disabled.
TroubleshootBackspace NoDisable autoswitch if backspace is pressed.
TroubleshootLeftArrow YesDisable autoswitch if left arrow is pressed.
TroubleshootRightArrow YesDisable autoswitch if the right arrow is pressed.
TroubleshootUpArrow YesDisable autoswitch if the up arrow is pressed.
TroubleshootDownArrow YesDisable autoswitch if down arrow is pressed.
TroubleshootDelete NoDisable autoswitch if Delete is pressed.
TroubleshootSwitch YesDisable autoswitch if you switch layout.
TroubleshootFullScreen YesDisable autoswitch if the application is in full screen mode.
CompatibilityWithCompletion YesCrutch for compatibility with autocompletion in other applications.
TrackingInput YesDisabling this option will lead to a complete failure of the program to intercept the keyboard.
TrackingMouse YesDisabling this option will lead to a complete failure of the program to intercept the mouse.
DontSendKeyRelease NoDo not send a KeyRelease keyboard event. Very specific thing, it is better not to change the value of the option.
What's next?
In the future I plan to talk about:
- Algorithms xneur.
- Xneur as a keylogger, with an example of a working config.
- Well and other interesting about xlib, programs under linux and all that.
Following parts
X Neural Switcher - Cookbook (Part 1). Forerunners and analogues
X Neural Switcher - Cookbook (Part 2). Algorithms