Giter Site home page Giter Site logo

tmux-keyboard-layout's Introduction

Tmux Keyboard Layout plugin

Plugin that shows current keyboard layout.

Usage

set -g status-right '#{keyboard_layout}'

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins:

set -g @plugin 'imomaliev/tmux-keyboard-layout'

Press prefix + I to install it.

Manual Installation

Clone the repo:

$ git clone https://github.com/imomaliev/tmux-keyboard-layout.git ~/clone/path

Add this line to your .tmux.conf:

run-shell ~/clone/path/keyboard-layout.tmux

Reload TMUX environment with:

$ tmux source-file ~/.tmux.conf

Configurations

Change option scope (default g - global)

Follows same rules as set-option

Special case: To set scope to session use '-', because by default session scope used when no param is provided.

set -g @keyboard_layout:option_scope '-'

Change output length (default 16)

Make output length equal to 2

set -g @keyboard_layout:length 2

License

MIT

tmux-keyboard-layout's People

Contributors

imomaliev avatar uladar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tmux-keyboard-layout's Issues

KeyboardLayout Name doesn't exist except 'ABC'

When Keyboard Layout is not English, there is no "KeyboardLayout Name" in ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSource

My Environment

  • cpu: Apple Silicon M2
  • os: macOS Monterey 12.6
  • tmux: 3.3.a

In My Shell

  • When Keyboard Layout is English
$ defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources
(
        {
        "Bundle ID" = "com.apple.PressAndHold";
        InputSourceKind = "Non Keyboard Input Method";
    },
        {
        InputSourceKind = "Keyboard Layout";
        "KeyboardLayout ID" = 252;
        "KeyboardLayout Name" = ABC;
    }
)
  • When Keyboard Layout is Korean
$ defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources
(
        {
        "Bundle ID" = "com.apple.PressAndHold";
        InputSourceKind = "Non Keyboard Input Method";
    },
        {
        "Bundle ID" = "com.apple.inputmethod.Korean";
        "Input Mode" = "com.apple.inputmethod.Korean.2SetKorean";
        InputSourceKind = "Input Mode";
    }
)
  • When Keyboard Layout is Japanese
$ defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources
(
        {
        "Bundle ID" = "com.apple.PressAndHold";
        InputSourceKind = "Non Keyboard Input Method";
    },
        {
        "Bundle ID" = "com.apple.inputmethod.Kotoeri.RomajiTyping";
        "Input Mode" = "com.apple.inputmethod.Japanese";
        InputSourceKind = "Input Mode";
    }
)

Add support for Linux

From what I can tell, this plugin only works for MacOS - would there be any appetite for me to add support for Linux?

For example, using setxkbmap and awk I can get my keyboard layout:

> setxkbmap -query | awk '/layout/ {print $2}'
gb

We could add an if statement to get_keyboard_layout.sh to check the OS of the user and return the correct keyboard layout based on the user's OS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.