xkblayout-state/README.md

66 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2010-01-08 04:03:45 +08:00
README
======
Description
-----------
*xkblayout-state* is a small command-line program to get/set the current XKB keyboard layout.
2010-01-08 21:31:15 +08:00
It's a thin wrapper around a slightly version of Jay Bromley's XKeyboard class, the original of which is included in <http://members.dslextreme.com/users/jbromley/files/ruby-xkb.tar.bz2>.
2010-01-08 04:03:45 +08:00
Compilation and installation
----------------------------
2021-04-22 00:58:00 +08:00
- Make sure x11 development libraries are installed (eg. `apt install libx11-dev` on Ubuntu)
2010-01-08 04:03:45 +08:00
- To compile just say: `make`
- To install copy the resulting executable `xkblayout-state` somewhere in your path
2021-11-05 13:12:27 +08:00
Alternatively with docker: `docker build .`
2010-01-08 04:03:45 +08:00
Usage
-----
*xkblayout-state* can be used to either print keyboard layout information on **stdout** or set the currently active layout.
### Printing keyboard layout information
The command to print keyboard layout information is
xkblayout-state print format
2010-01-08 04:31:35 +08:00
*format* is printed to **stdout** with the following substitutions (to include a literal *%* use `%%`):
2010-01-08 04:03:45 +08:00
- `%c` -> The number of the currently active layout
- `%n` -> The name of the currently active layout
- `%s` -> The symbol of the currently active layout
2010-01-08 04:31:35 +08:00
- `%v` -> The variant of the currently active layout (*this is empty if no variant is specified*)
- `%e` -> The variant of the currently active layout (*this is the same as `%s` if no variant is specified*)
2010-01-08 04:03:45 +08:00
- `%C` -> The number of defined layouts
- `%N` -> A list containing the names of the layouts (one per line)
- `%S` -> A list containing the symbols of the layouts (one per line)
2010-01-08 04:31:35 +08:00
- `%V` -> A list containing the variants of the layouts (one per line; *an empty line if no variant is specified for the respective layout*)
2010-01-08 04:41:36 +08:00
- `%E` -> A list containing the variants of the layouts (one per line; *if no variant is specified for the respective symbol, the layout symbol is used*)
2010-01-08 04:03:45 +08:00
### Setting the active keyboard layout
The command to set the currently active keyboard layout is
xkblayout-state set [+-]number
*number* is the number of the layout to activate. It corresponds to the layouts in the order they appear in, for example, `xkblayout-state print %N`, starting from zero. If *number* begins with a plus or minus sign, the *number*'th layout counting from the currently active layout down or up the list is activated. It wraps around if the list is exceeded.
License
-------
*xkblayout-state* is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
*xkblayout-state* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. <http://www.gnu.org/licenses/>