You are not logged in.

#1 2014-11-16 09:23:50

artur.balabanov
Member
Registered: 2014-11-16
Posts: 2

setxkbmap with keyboard shortcuts and xmodmap

I'm using Arch with Awesome WM. I have configured awesome to work with setxkbmap: I have a widget and when I click on it or when I press Alt+Shift it changes the layout.

kbdcfg = {}
kbdcfg.cmd = "setxkbmap"
kbdcfg.layout = { { "us", "" }, { "bg", "phonetic" } }
kbdcfg.current = 1  -- us is our default layout
kbdcfg.widget = wibox.widget.textbox()
kbdcfg.widget:set_markup(" <b>" .. kbdcfg.layout[kbdcfg.current][1] .. "</b> ")
kbdcfg.switch = function ()
  kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
  local t = kbdcfg.layout[kbdcfg.current]
  kbdcfg.widget:set_markup(" <b>" .. t[1] .. "</b> ")
  os.execute( kbdcfg.cmd .. " " .. t[1] .. " " .. t[2])
end

 -- Mouse bindings
kbdcfg.widget:buttons(
 awful.util.table.join(awful.button({ }, 1, function () kbdcfg.switch() end))
)

However, when I'm in the `bg` layout and use some shortcut (e.g. Ctrl-C) it doesn't work and it's very annoying to constantly switch between the layouts for such a trivial task.

Also, I have disabled CapsLock (via xmodmap) and map it to another modifier key and now I have mapped CapsLock+[hjkl] to right/down/up/left and I have some other mappings. But when I switch to my other layout, these mappings are disabled, and when I reenable them (using xmodmap ~/.Xmodmap), they, of course, don't work: when I press the key `j` it prints `j` instead of `й` (how it should be). Here is my .Xmodmap:

keycode 66 = Mode_switch NoSymbol
keycode 39 = s S dollar dollar
keycode 43 = h H Left Left
keycode 44 = j J Down Down
keycode 45 = k K Up Up
keycode 46 = l L Right Right
keycode 54 = c C Caps_Lock Caps_Lock

Is there a way to solve these problems, and if so - how? Thank you!

Offline

Board footer

Powered by FluxBB