echuraev / keyboard_layout Goto Github PK
View Code? Open in Web Editor NEWKeyboard switcher for Awesome WM with additional layouts
License: MIT License
Keyboard switcher for Awesome WM with additional layouts
License: MIT License
Hey @echuraev
Thanks for the package.
Don't you know if there is any way to remember what keyboard layout was selected previously for a window?
Like Chrome has EN and Skype has RU.
When I switch from Skype (RU) to Chrome (EN) the input method is also change. It usually called Allow different layouts for individual windows
Line 50 in e579660
This line caused problems for me. The reason is that, I use the following config:
kbdcfg.add_primary_layout("English (US)", "EN", "us")
kbdcfg.add_primary_layout("Czech (QWERTY)", "CZ", "cz(qwerty)")
Since the layout's name doesn't get wrapped in quotes, the cz(qwerty)
layout causes problems. I fixed it by modifying my local copy as such:
os.execute(kbdcfg.cmd .. " \"" .. layout.subcmd .. "\"")
My use case is that I alternate between US and US Dvorak. For both, I have a setxkbmap
option and I then reload ~/.xmodmaprc
. I use this rather unfortunate line:
kbdcfg.add_primary_layout("Dvorak", "DV", "-option\" compose:ralt dvorak && xmodmap ~/.xmodmaprc && echo \"")
This is to "hack" into the os.execute
that is done by the code.
A much more elegant solution would be to have a add_primary_layout
with named arguments name
, icon
, full_command
, cmd_argument
, with the last two optional, although one of the two should be there. For instance:
kbdcfg.add_primary_layout_opt { name = "Dvorak", icon = "DV",
full_command = "setxkbmap -option compase:ralt dvorak && xmodmap ~/.xmodmaprc" }
xbdcfg.add_primary_layout_opt { name = "US", icon = "US", cmd_argument = "us" }
Alternatively, we could specify the command when creating kbdcfg
as:
cmd = "setxkbmap -option compose:ralt \"{}\" && xmodap ~/.xmodmaprc"
… but this does not provide the same flexibility.
Awesome cannot find a command kbdcfg. Which package do i need to install?
how would you add the the variants (US-INTL-ALTGR, in my case) in this? i'm quite confused how to write them at the .add_primary_layout part
┌─(^.^)-(~)
└─> setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: us,us
variant: altgr-intl,
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us(altgr-intl)+us:2+inet(evdev)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(altgr-intl)+us:2+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
Many users like to put their modules, widgets, plugins, etc, in another folder to be more organized, instead of putting them in the root of the awesome config directory.
For example:
I have the modules
folder where I put all the third party libs and modules. When requesting this lib, I just call it like this:
local kblayout = require("modules.keyboard_layout")
or
local kblayout = require("modules/keyboard_layout")
As your init.lua is, the call is absolute, not allowing to use in a custom directory to improve the organization.
How I can map CAPS LOCK switching language?
Widget works fine without any startup error and keybinding works fine. The layout is changing, but you know no widget icon showing on the wibar. Added the code to do that as given in the documentation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.