On 2015-08-18, alex wrote:


> However, I still cannot find a way for a single shortcut to do exactly
> what I want.
> That is because LyX does not capture shortcuts used for system keyboard
> layout toggle.

Exactly. Changing the keyboard layout and changing the text language in
LyX are two completely different actions. (Think of the language change
in LyX like of inserting <span language="greek"> in the document...)

> So, it's not possible to set a shortcut of Alt + Shift -> language toggle.
> I would not mind having to use another shortcut, as long as it's only 1,
> to have the appropriate results.

> For example, something like that would require an lfun sequence like:
><layout toggle> ; <language toggle>.
> I still cannot achieve the layout toggle.
> I checked out keyboard mappings a bit, but to no avail.

This is one option: leave the system kbd-layout at English and activate a
LyX-specific "kmap" for Greek.

The existing "greek.kmap" is not the best example to build on, as it only
adds some small modifications (assuming that the system kmap is already

A better example for a to-be-written "Greek on top of English" kmap would
be, e.g., /usr/share/lyx/kbd/czech-prg.kmap. Generally, it would be a major
task, writing \kmap pairs for almost every key.

> Another thing that caught my eye is that you can control LyX from other
> programs using lfuns. So, I though as a last resort solution to write a
> bash script that senses the layout toggle and sends the appropriate
> lfun to LyX. However, in the lfuns manual, I only found a small
> reference to that feature at the beginning. Is there any detailed
> documentation about this?

There is some documentation on the LyX wiki. Once upon a time, I even
wrote a Python package providing an interface to the LyXserver and
uploaded it there.


> On 08/18/2015 11:21 PM, Richard Heck wrote:
>> On 08/18/2015 12:39 PM, alex wrote:
>>> Hello everyone.

>>> I have been using LyX as my LaTeX editor of choice for quite some
>>> time now, and I have found it to be quite helpful. I have also
>>> managed to set up spell checking for both the languages that I am
>>> interested in, English and Greek. However, the way that I currently
>>> toggle between those languages is quite inconvenient. That is, I use
>>> Alt + Shift to toggle between languages (as I usually do), which
>>> achieves the transition from one language to another. However, that's
>>> not enough to get LyX to toggle to the latter language. LyX keeps
>>> spell-checking using the former language. I have to use a second
>>> keyboard shortcut to get LyX to switch languages, as far as
>>> spell-checking goes. For example, I have to use 2 keyboard shortcuts
>>> in order to go from writing English characters with English
>>> spell-checking to writing Greek characters with Greek spell-checking,
>>> and vice versa. Obviously, those are one too many shortcuts.

>>> So, my question is: can LyX be configured so that toggling between
>>> languages is made by one keyboard shortcut, or maybe so that LyX
>>> senses the keyboard layout (GR or US) in use and spell-checks
>>> appropriately?

>> A single shortcut can do more than one thing, if you use the
>> command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:
>>     command-sequence buffer-begin ; buffer-end-select
>> which has the effect of selecting the whole buffer.

>> See the documentation for command-sequence under Help> LyX Functions.

>> Richard

Reply via email to