Metadata-Version: 2.4
Name: pylayout
Version: 0.1.2
Summary: Module to get and set keyboard layout
Author-email: Roman Smolnyk <poma23324@gmail.com>
Project-URL: Homepage, https://github.com/roman-smolnyk/python-pylayout.git
Keywords: keyboard,layout
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENCE.txt
Requires-Dist: pywin32; platform_system == "Windows"
Dynamic: license-file

# pylayout

`pylayout` is a Python module for getting and setting the current keyboard layout in Windows. It also includes utilities for detecting the language of input characters and translating text between keyboard layouts.

It supports Windows and linux systems.

## Installation

```bash
pip install pylayout
```

## Usage

```python
from pylayout import Layout

layout = Layout(use_cache=False) # use_cache=True reduces calls to the system to acquire list of available layouts speeding up module
print("Current layout:", layout.get())
print("Available layouts:", layout.list())
layout.set("uk") # Set layout to Ukrainian
print("New layout:", layout.get())

# Currently translate and detect_language support only us and uk languages. Can be extended by modifying LAYOUTS dict
char = "ї"
print(f"Language for '{char}':", layout.detect_language(char))
print("Translate 'ghbdsn' from 'en' to 'uk':", layout.translate("ghbdsn", "en", "uk"))
```

## Features

- Get the current keyboard layout
- Set the keyboard layout by language code (e.g., `en`, `uk`)
- List all available keyboard layouts
- Detect the language associated with a given character
- Translate text from one keyboard layout to another (e.g., fix "ghbdsn" typed in the wrong layout)

## Fixes

There are some issues on windows so here are some resources to fix them

- <https://superuser.com/questions/1360623/cant-remove-unneeded-keyboard-layouts-no-such-setting-anywhere>
- <https://superuser.com/questions/957552/how-to-delete-a-keyboard-layout-in-windows-10/1340511#1340511>
