From f5aa2a1b51726f79df13d9ef91b00736d9b273cc Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 16 Jul 2012 17:59:23 +0200 Subject: [PATCH] keyboard: simplify configuration xmodmap seems to modify the layout and will be kept if we switch to another layout. Therefore, we only need to call it on start. Just move the keyboard configuration to `start.lua`. `keyboard.lua` is just here to manage kbdd. --- rc/keyboard.lua | 28 +++------------------------- rc/start.lua | 10 +++++++++- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/rc/keyboard.lua b/rc/keyboard.lua index b1c34ab..64ea2f6 100644 --- a/rc/keyboard.lua +++ b/rc/keyboard.lua @@ -2,29 +2,6 @@ local icons = loadrc("icons", "vbe/icons") --- Global configuration -if config.hostname == "guybrush" then - os.execute("setxkbmap us,fr '' compose:rctrl ctrl:nocaps") -else - os.execute("setxkbmap us,fr '' compose:rwin ctrl:nocaps") -end - --- Additional mappings -local mappings = { Pause = "XF86ScreenSaver" } -if config.hostname == "guybrush" then - mappings = { XF86AudioPlay = "XF86ScreenSaver" } -end - - - -local function update_mappings() - for src, dst in pairs(mappings) do - os.execute(string.format("xmodmap -e 'keysym %s = %s'", src, dst)) - end -end - -update_mappings() - local qdbus = { check = "qdbus ru.gentoo.KbddService /ru/gentoo/KbddService", next = "qdbus ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.next_layout" @@ -38,13 +15,14 @@ dbus.add_signal("ru.gentoo.kbdd", function(...) local data = {...} local layout = data[2] - update_mappings() + local screen = mouse.screen + if client.focus then screen = client.focus.screen end nid = naughty.notify({ title = "Keyboard layout changed", text = "New layout is " .. layout .. "", replaces_id = nid, icon = icons.lookup({ name = "keyboard", type = "devices" }), - screen = client.focus.screen }).id + screen = screen }).id end) config.keys.global = awful.util.table.join( diff --git a/rc/start.lua b/rc/start.lua index 468eca5..6156496 100644 --- a/rc/start.lua +++ b/rc/start.lua @@ -26,17 +26,25 @@ local execute = { if config.hostname == "naruto" then execute = awful.util.table.join( execute, { + -- Keyboard and mouse "xset m 4 3", -- Mouse acceleration + "setxkbmap us,fr '' compose:rctrl ctrl:nocaps", + "xmodmap -e 'keysym Pause = XF86ScreenSaver'", }) elseif config.hostname == "neo" then execute = awful.util.table.join( execute, { - -- Keyboard configuration + -- Keyboard and mouse "xset m 3 3", -- Mouse acceleration + "setxkbmap us,fr '' compose:rctrl ctrl:nocaps", + "xmodmap -e 'keysym Pause = XF86ScreenSaver'", }) elseif config.hostname == "guybrush" then execute = awful.util.table.join( execute, { + -- Keyboard and mouse + "setxkbmap us,fr '' compose:rwin ctrl:nocaps", + "xmodmap -e 'keysym = XF86ScreenSaver'", -- Wheel emulation "xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation' 8 1", "xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation Button' 8 2",