Skip to content

Fierthraix/klavaro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

klavaro

CI Release Crates.io Downloads Docs.rs License AUR bin AUR git

Save the current keyboard layout (xkb_active_layout) to a file on Sway. Useful with i3status.

$ klavaro --help
Print the current xkb_layout in sway.
The default output file is `/tmp/.xkb_lingvo'
USAGE:
    klavaro [OUTPUT_FILE]

Installation

Cargo

cargo install klavaro

Arch Linux / AUR

yay -S klavaro-bin
yay -S klavaro-git

macOS / Homebrew

brew install --cask Fierthraix/tap/klavaro

Nix

nix profile install github:Fierthraix/nur-packages#klavaro

Release Assets

https://github.com/Fierthraix/klavaro/releases/latest

i3status

Your current Sway keyboard layout can be printed in i3status thusly:

~/.i3status.conf
order += "read_file keyboard"

read_file keyboard {
        path = "/tmp/.xkb_lingvo"
        color_good = "#FFFFFF"
}

However, the klavaro program must already be running, which can be accomplished via systemd user service as below.

SystemD User Service

Since sway is a user process, a systemd user service must be used in order to get the SWAYSOCK successfully.

This is the service file needed:

/etc/systemd/user/klavaro.service
[Unit]
Description=klavaro

[Service]
Type=simple
ExecStart=/usr/local/bin/klavaro
Restart=always
RestartSec=1s

[Install]
WantedBy=multi-user.target

Then the service can be started:

systemctl --user enable klavaro # Schedule klavaro on startup.
systemctl --user start klavaro  # Start klavaro immediately.

swaymsg

This is basically equivalent to (but muuch more efficient than)

swaymsg -r -t subscribe -m '["input"]' \
   | jq '.input.xkb_active_layout_name'

and saving the result to a file.

About

Print your current keyboard layout in sway

Resources

License

Stars

5 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors