Skip to main content

Keyboard layout switcher for sway windows

Project description

sway-xkb-switcher

Description

sway-xkb-switcher records keyboard layout for a sway windows when you leave them. And when you come back it is restore keyboard layout.

This project is forked from https://github.com/inn0kenty/i3-xkb-switcher and adapted to work with sway window manager.

There is also helper switcher for emacs.

On layout switch event emacs-sway-xkb tool checks if focused window is emacs window. In case of emacs window it switches emacs input method.

In case of non-emacs window, emacs-sway-xkb switches wayland keyboard layout.

NOTE: emacs-sway-xkb is able to only detect emacs native window. If you open emacs frame in terminal, it will not detect it.

Install

$ pip install sway-xkb-switcher

Also you can download compiled binary from release page.

Usage

sway-xkb-switcher

$ sway-xkb-switcher

This will track the layout of all your keyboards.

Default layout for new windows

If you like all your new windows start with default layout, you can specify it with parameter --default-lang (-D).

$ sway-xkb-switcher --default-lang "English (US)"

You can obtain list of available layout names from running the following swaymsg command.

$ swaymsg -t get_inputs | grep -A 2 xkb_layout_names

NOTE: Layout names are not literally the same as in sway configuration file.

Debugging / logging

To enable debug mode run with --debug key.

By default it writes logs to stdout. You can specify path by --log-path option.

emacs-sway-xkb

If you are using emacs you can keep emacs with its own state of input method.

Bind some key to switch keyboard layout and completely disable xkb native switching option in your sway config file.

input "1:1:AT_Translated_Set_2_keyboard" {
  xkb_layout us,ru
#  xkb_options grp:alts_toggle,shift:both_capslock
}

bindsym --to-code $mod+n exec emacs-sway-xkb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sway-xkb-switcher-0.3.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

sway_xkb_switcher-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file sway-xkb-switcher-0.3.0.tar.gz.

File metadata

  • Download URL: sway-xkb-switcher-0.3.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.8 Linux/5.4.0-1040-azure

File hashes

Hashes for sway-xkb-switcher-0.3.0.tar.gz
Algorithm Hash digest
SHA256 98679ad53bd0a1c752d1b9931eccf05dcf2c9d5d3047cee84ea169882f990241
MD5 331bd50ad85ec1f92bbefd5a95f9102e
BLAKE2b-256 474fc7f8f79961dcf5cf768680f07eda94d1c67e4429e55c91a294cd5a72d461

See more details on using hashes here.

File details

Details for the file sway_xkb_switcher-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sway_xkb_switcher-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.8 Linux/5.4.0-1040-azure

File hashes

Hashes for sway_xkb_switcher-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12c72982fa7ec9524953ed35a8cc4a950fbf9214083aec1d1a7ae38f90216a2c
MD5 b36286da3951a2621ad482a448ab5bdc
BLAKE2b-256 63d4928ca4e88fb601a95f007a66817b653120228da5895c477a7a1b78cbbe19

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page