File: test-keyboard-layout-changes.lua

package info (click to toggle)
awesome 4.3-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,468 kB
  • sloc: ansic: 14,508; sh: 526; makefile: 46
file content (37 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- Test for bug #1494: Using xmodmap freezes awesome since it re-queries the
-- keyboard layout many, many times. (xmodmap applies each change on its own)

local runner = require("_runner")
local spawn = require("awful.spawn")
local GLib = require("lgi").GLib

local done
local timer = GLib.Timer()

local steps = {
    function()
        assert(awesome._modifiers.Control)
        return true
    end,
    function(count)
        if count == 1 then
            -- POSIX allows us to use awk
            local cmd = "awk 'BEGIN { for(i=1; i<=1000;i++) print \"keycode 107 = parenleft\" }' | xmodmap -"
            spawn.easy_async({"sh", "-c", cmd}, function()
                awesome.sync()
                done = true
            end)
        end
        if done then
            -- Apply some limit on how long awesome may need to process 'things'
            return timer:elapsed() < 5
        end
    end,
    function()
        assert(awesome._modifiers.Control)
        return true
    end,
}
runner.run_steps(steps)

-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80