Coder Social home page Coder Social logo

xkbswitch's Introduction

xkbswitch

CLI keyboard layout switcher for X11

Usage

I wrote this one (using the code of [xxkb] (http://sourceforge.net/projects/xxkb/)) to allow switching keyboard layouts with individual hotkeys. For example:

# assume we have two layouts configured
$ setxkbmap -layout "en, ru"
# switch to Russian first
$ xkbswitch 1
# switch to English back
$ xkbswitch 0

You could bind these to hotkeys within you window manager and every time you press the hotkey you know which layout is the current one. This also allows to use non-standard hotkeys to switch layouts. Here is example for OpenBox:

<!-- Ctrl+Shift+1 switches to English -->
<keybind key="C-S-1">
  <action name="Execute">
    <command>xkbswitch 0</command>
  </action>
</keybind>

Or you could ensure same layout every time you run a certain program. Example for OpenBox again:

<!-- I want to have input lang set to English when unlocking my screen -->
<keybind key="W-L">
  <action name="Execute">
    <command>sh -c 'xkbswitch 0; slimlock'</command>
  </action>
</keybind>

Installation

The only dependency is libX11.

$ cc -lX11 xkbswitch.c

xkbswitch's People

Contributors

scorpp avatar

Watchers

 avatar

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.