Awesome: cannot Move Focus to a specific Monitor without mouse

Created on 11 Sep 2016  Â·  18Comments  Â·  Source: awesomeWM/awesome

Output of awesome --version:

awesome v3.5.9 (Mighty Ravendark)

• Build: Mar 12 2016 01:11:40 for x86_64 by gcc version 5.3.0 (builduser@rw)
• Compiled against Lua 5.3.2 (running with Lua 5.3)
• D-Bus support: ✔

How to reproduce the issue:

I followed this WIKI but did not work

Actual result:

nothing happened, cannot change focus

Expected result:

I wanna change focus to Monitor1, then toggle

About my two Monitor

my laptop T420 connected a monitor Benq EW2740 by VGA.

Most helpful comment

hi~, it works using ctrl + modkey + j without any configuration in rc.lua and I do not know why, but it works.

All 18 comments

Hello, how did you setup the multi-screen setup:

1) Using XRandr or arandr
2) Using Xaphod mode
3) Using NVIDIA TwinView
4) Using Xinerama
5) Using MOSAIC

If (2) Awesome 3.5 and later don't support Xaphod and wont ever support it again. If (4) probably a configuration error on your side.

Also, does the bug exist in Awesome git-master (@psychon should we add this question to the template?). Move your current rc.lua elsewhere for the test or use a different user account.

I use XRandr, the command is

# for home screen by awesome
$xrandr --output VGA1 --mode 1600x900 --right-of LVDS1 --mode 1920x1080

Since I have no good idea:
Can you change awful.key({modkey, }, "F1", function () awful.screen.focus(1) end) into awful.key({modkey, }, "F1", function () awful.screen.focus(1); naughty.notify{text="foo"} end) to check if this code is actually run when you press mod+F1?

Edit by Elv13: typo in the code

@psychon did not run, because cannot see notify, just like before.

Could you show us your full config with all your modifications? Apparently something is weirdly wrong there if no keybindings work...

OK, my rc.lua

-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")

-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
                     title = "Oops, there were errors during startup!",
                     text = awesome.startup_errors })
end

-- Handle runtime errors after startup
do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
        -- Make sure we don't go into an endless error loop
        if in_error then return end
        in_error = true

        naughty.notify({ preset = naughty.config.presets.critical,
                         title = "Oops, an error happened!",
                         text = err })
        in_error = false
    end)
end
-- }}}

-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init("/usr/share/awesome/themes/default/theme.lua")

-- This is used later as the default terminal and editor to run.
--terminal = "xterm"
terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor

-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"

-- Table of layouts to cover with awful.layout.inc, order matters.
local layouts =
{
    awful.layout.suit.floating,
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
}
-- }}}

-- {{{ Wallpaper
if beautiful.wallpaper then
    for s = 1, screen.count() do
        gears.wallpaper.maximized(beautiful.wallpaper, s, true)
    end
end
-- }}}

-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
end
-- }}}

-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awesome.conffile },
   { "restart", awesome.restart },
   { "quit", awesome.quit }
}

mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
                                    { "open terminal", terminal }
                                  }
                        })

mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                     menu = mymainmenu })

-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}

-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock()

-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
                    awful.button({ }, 1, awful.tag.viewonly),
                    awful.button({ modkey }, 1, awful.client.movetotag),
                    awful.button({ }, 3, awful.tag.viewtoggle),
                    awful.button({ modkey }, 3, awful.client.toggletag),
                    awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
                    awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
                    )
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
                     awful.button({ }, 1, function (c)
                                              if c == client.focus then
                                                  c.minimized = true
                                              else
                                                  -- Without this, the following
                                                  -- :isvisible() makes no sense
                                                  c.minimized = false
                                                  if not c:isvisible() then
                                                      awful.tag.viewonly(c:tags()[1])
                                                  end
                                                  -- This will also un-minimize
                                                  -- the client, if needed
                                                  client.focus = c
                                                  c:raise()
                                              end
                                          end),
                     awful.button({ }, 3, function ()
                                              if instance then
                                                  instance:hide()
                                                  instance = nil
                                              else
                                                  instance = awful.menu.clients({
                                                      theme = { width = 250 }
                                                  })
                                              end
                                          end),
                     awful.button({ }, 4, function ()
                                              awful.client.focus.byidx(1)
                                              if client.focus then client.focus:raise() end
                                          end),
                     awful.button({ }, 5, function ()
                                              awful.client.focus.byidx(-1)
                                              if client.focus then client.focus:raise() end
                                          end))

for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
                           awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
                           awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })

    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])

    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])

    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)

    mywibox[s]:set_widget(layout)
end
-- }}}

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}

-- {{{ Key bindings
globalkeys = awful.util.table.join(
    awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
    awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
    awful.key({ modkey,           }, "Escape", awful.tag.history.restore),

    awful.key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "k",
        function ()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "w", function () mymainmenu:show() end),

    -- Layout manipulation
    awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
    awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey,           }, "Tab",
        function ()
            awful.client.focus.history.previous()
            if client.focus then
                client.focus:raise()
            end
        end),

    -- Standard program
    awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift"   }, "q", awesome.quit),

    awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
    awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
    awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
    awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
    awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
    awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
    awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
    awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),

    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- shift screen focus
    awful.key({modkey, }, "F1", function () awful.screen.focus(1); naughty.notify{text="foo"} end),
    awful.key({modkey,  },"F2",function() awful.screen.focus(2) end),
    awful.key({modkey,  },"F3",function() awful.screen.focus(3) end),
    awful.key({modkey,  },"F4",function() awful.screen.focus(4) end),

    -- Prompt
    awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),

    awful.key({ modkey }, "x",
              function ()
                  awful.prompt.run({ prompt = "Run Lua code: " },
                  mypromptbox[mouse.screen].widget,
                  awful.util.eval, nil,
                  awful.util.getdir("cache") .. "/history_eval")
              end),
    -- Menubar
    awful.key({ modkey }, "p", function() menubar.show() end)
)

clientkeys = awful.util.table.join(
    awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
    awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
    awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
    awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
    awful.key({ modkey,           }, "n",
        function (c)
            -- The client currently has the input focus, so it cannot be
            -- minimized, since minimized clients can't have the focus.
            c.minimized = true
        end),
    awful.key({ modkey,           }, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end)
)

-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
    globalkeys = awful.util.table.join(globalkeys,
        -- View tag only.
        awful.key({ modkey }, "#" .. i + 9,
                  function ()
                        local screen = mouse.screen
                        local tag = awful.tag.gettags(screen)[i]
                        if tag then
                           awful.tag.viewonly(tag)
                        end
                  end),
        -- Toggle tag.
        awful.key({ modkey, "Control" }, "#" .. i + 9,
                  function ()
                      local screen = mouse.screen
                      local tag = awful.tag.gettags(screen)[i]
                      if tag then
                         awful.tag.viewtoggle(tag)
                      end
                  end),
        -- Move client to tag.
        awful.key({ modkey, "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = awful.tag.gettags(client.focus.screen)[i]
                          if tag then
                              awful.client.movetotag(tag)
                          end
                     end
                  end),
        -- Toggle tag.
        awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = awful.tag.gettags(client.focus.screen)[i]
                          if tag then
                              awful.client.toggletag(tag)
                          end
                      end
                  end))
end

clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))

-- Set keys
root.keys(globalkeys)
-- }}}

-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     raise = true,
                     keys = clientkeys,
                     buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
      properties = { floating = true } },
    { rule = { class = "pinentry" },
      properties = { floating = true } },
    { rule = { class = "gimp" },
      properties = { floating = true } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    --   properties = { tag = tags[1][2] } },
}
-- }}}

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
        if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
            and awful.client.focus.filter(c) then
            client.focus = c
        end
    end)

    if not startup then
        -- Set the windows at the slave,
        -- i.e. put it at the end of others instead of setting it master.
        -- awful.client.setslave(c)

        -- Put windows in a smart way, only if they does not set an initial position.
        if not c.size_hints.user_position and not c.size_hints.program_position then
            awful.placement.no_overlap(c)
            awful.placement.no_offscreen(c)
        end
    end

    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
        -- buttons for the titlebar
        local buttons = awful.util.table.join(
                awful.button({ }, 1, function()
                    client.focus = c
                    c:raise()
                    awful.mouse.client.move(c)
                end),
                awful.button({ }, 3, function()
                    client.focus = c
                    c:raise()
                    awful.mouse.client.resize(c)
                end)
                )

        -- Widgets that are aligned to the left
        local left_layout = wibox.layout.fixed.horizontal()
        left_layout:add(awful.titlebar.widget.iconwidget(c))
        left_layout:buttons(buttons)

        -- Widgets that are aligned to the right
        local right_layout = wibox.layout.fixed.horizontal()
        right_layout:add(awful.titlebar.widget.floatingbutton(c))
        right_layout:add(awful.titlebar.widget.maximizedbutton(c))
        right_layout:add(awful.titlebar.widget.stickybutton(c))
        right_layout:add(awful.titlebar.widget.ontopbutton(c))
        right_layout:add(awful.titlebar.widget.closebutton(c))

        -- The title goes in the middle
        local middle_layout = wibox.layout.flex.horizontal()
        local title = awful.titlebar.widget.titlewidget(c)
        title:set_align("center")
        middle_layout:add(title)
        middle_layout:buttons(buttons)

        -- Now bring it all together
        local layout = wibox.layout.align.horizontal()
        layout:set_left(left_layout)
        layout:set_right(right_layout)
        layout:set_middle(middle_layout)

        awful.titlebar(c):set_widget(layout)
    end
end)

client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

Hm, I still have no idea. Next random idea:

Use some key which you know works instead of Mod+F1. For example Mod+u (or Mod+w or Mod+k or...):

 awful.key({modkey, }, "u", function () awful.screen.focus(1); naughty.notify{text="foo"} end),

or just F1:

 awful.key({}, "F1", function () awful.screen.focus(1); naughty.notify{text="foo"} end),

Second idea: Run "xev" in a terminal and press Mod+F1. Show us what output xev generates for that key press (and perhaps also for some other key combinations like "just F1" or "Mod+i").

By the way: What's your keyboard layout? Anything "fancy"?

Firstly thanks for your kind help @psychon,

and I just use English US keyboard layout, and use fcitx for other input,

no work to change key to modkey+u or +w or just F1.

here is Mod+F1,+F2,+F3+F4 output of xev

$ xev
Outer window is 0x1c00001, inner window is 0x1c00002

PropertyNotify event, serial 8, synthetic NO, window 0x1c00001,
    atom 0x27 (WM_NAME), time 469654870, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x1c00001,
    atom 0x22 (WM_COMMAND), time 469654870, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x1c00001,
    atom 0x28 (WM_NORMAL_HINTS), time 469654870, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x1c00001,
    parent 0x1c00001, window 0x1c00002, (10,10), width 50, height 50
border_width 4, override NO

PropertyNotify event, serial 14, synthetic NO, window 0x1c00001,
    atom 0x14d (WM_PROTOCOLS), time 469654871, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00002, override NO

ReparentNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, parent 0x4000dc,
    (0,0), override NO

MapNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, override NO

ConfigureNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (0,0), width 178, height 178,
    border_width 0, above 0x0, override NO

PropertyNotify event, serial 28, synthetic NO, window 0x1c00001,
    atom 0x160 (WM_STATE), time 469654879, state PropertyNewValue

ConfigureNotify event, serial 29, synthetic YES, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (1602,2), width 178, height 178,
    border_width 2, above 0x0, override NO

PropertyNotify event, serial 29, synthetic NO, window 0x1c00001,
    atom 0x172 (_NET_WM_DESKTOP), time 469654893, state PropertyNewValue

ConfigureNotify event, serial 29, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (0,0), width 957, height 1059,
    border_width 0, above 0x0, override NO

ConfigureNotify event, serial 29, synthetic YES, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (2562,20), width 957, height 1059,
    border_width 1, above 0x0, override NO

VisibilityNotify event, serial 30, synthetic NO, window 0x1c00001,
    state VisibilityUnobscured

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,0), width 957, height 10, count 3

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,10), width 10, height 58, count 2

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (68,10), width 889, height 58, count 1

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,68), width 957, height 991, count 0

EnterNotify event, serial 30, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469654925, (4,91), root:(2566,111),
    mode NotifyNormal, detail NotifyAncestor, same_screen YES,
    focus NO, state 16

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusIn event, serial 30, synthetic NO, window 0x1c00001,
    mode NotifyNormal, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  4294967237 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyPress event, serial 30, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469657612, (4,91), root:(2566,111),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469657772, (4,91), root:(2566,111),
    state 0x50, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469657852, (4,91), root:(2566,111),
    state 0x50, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469657884, (4,91), root:(2566,111),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469658772, (4,91), root:(2566,111),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469658940, (4,91), root:(2566,111),
    state 0x50, keycode 68 (keysym 0xffbf, F2), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469659020, (4,91), root:(2566,111),
    state 0x50, keycode 68 (keysym 0xffbf, F2), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469659084, (4,91), root:(2566,111),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469660140, (4,91), root:(2566,111),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469660308, (4,91), root:(2566,111),
    state 0x50, keycode 69 (keysym 0xffc0, F3), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469660388, (4,91), root:(2566,111),
    state 0x50, keycode 69 (keysym 0xffc0, F3), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469660412, (4,91), root:(2566,111),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469661508, (4,91), root:(2566,111),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469661636, (4,91), root:(2566,111),
    state 0x50, keycode 70 (keysym 0xffc1, F4), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469661716, (4,91), root:(2566,111),
    state 0x50, keycode 70 (keysym 0xffc1, F4), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469661772, (4,91), root:(2566,111),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673650, (4,92), root:(2566,112),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673666, (3,92), root:(2565,112),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673674, (3,93), root:(2565,113),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673682, (1,96), root:(2563,116),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673690, (0,99), root:(2562,119),
    state 0x10, is_hint 0, same_screen YES

LeaveNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469673698, (-2,103), root:(2560,123),
    mode NotifyNormal, detail NotifyAncestor, same_screen YES,
    focus YES, state 16

FocusOut event, serial 33, synthetic NO, window 0x1c00001,
    mode NotifyNormal, detail NotifyNonlinear
^C

and Mod+a, +b, +c, +d output of xev

$ xev
Outer window is 0x1c00001, inner window is 0x1c00002

PropertyNotify event, serial 8, synthetic NO, window 0x1c00001,
    atom 0x27 (WM_NAME), time 470216675, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x1c00001,
    atom 0x22 (WM_COMMAND), time 470216675, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x1c00001,
    atom 0x28 (WM_NORMAL_HINTS), time 470216675, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x1c00001,
    parent 0x1c00001, window 0x1c00002, (10,10), width 50, height 50
border_width 4, override NO

PropertyNotify event, serial 14, synthetic NO, window 0x1c00001,
    atom 0x14d (WM_PROTOCOLS), time 470216675, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00002, override NO

ReparentNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, parent 0x4000dd,
    (0,0), override NO

MapNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, override NO

ConfigureNotify event, serial 28, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (0,0), width 178, height 178,
    border_width 0, above 0x0, override NO

PropertyNotify event, serial 28, synthetic NO, window 0x1c00001,
    atom 0x160 (WM_STATE), time 470216685, state PropertyNewValue

ConfigureNotify event, serial 29, synthetic YES, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (1602,2), width 178, height 178,
    border_width 2, above 0x0, override NO

PropertyNotify event, serial 29, synthetic NO, window 0x1c00001,
    atom 0x172 (_NET_WM_DESKTOP), time 470216696, state PropertyNewValue

ConfigureNotify event, serial 29, synthetic NO, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (0,0), width 957, height 1059,
    border_width 0, above 0x0, override NO

ConfigureNotify event, serial 29, synthetic YES, window 0x1c00001,
    event 0x1c00001, window 0x1c00001, (2562,20), width 957, height 1059,
    border_width 1, above 0x0, override NO

VisibilityNotify event, serial 30, synthetic NO, window 0x1c00001,
    state VisibilityUnobscured

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,0), width 957, height 10, count 3

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,10), width 10, height 58, count 2

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (68,10), width 889, height 58, count 1

Expose event, serial 30, synthetic NO, window 0x1c00001,
    (0,68), width 957, height 991, count 0

EnterNotify event, serial 30, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470216731, (10,40), root:(2572,60),
    mode NotifyNormal, detail NotifyVirtual, same_screen YES,
    focus NO, state 16

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusIn event, serial 30, synthetic NO, window 0x1c00001,
    mode NotifyNormal, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  4294967237 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyPress event, serial 30, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470225263, (10,40), root:(2572,60),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470226487, (10,40), root:(2572,60),
    state 0x50, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XmbLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470226599, (10,40), root:(2572,60),
    state 0x50, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470227855, (10,40), root:(2572,60),
    state 0x50, keycode 56 (keysym 0x62, b), same_screen YES,
    XLookupString gives 1 bytes: (62) "b"
    XmbLookupString gives 1 bytes: (62) "b"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470227951, (10,40), root:(2572,60),
    state 0x50, keycode 56 (keysym 0x62, b), same_screen YES,
    XLookupString gives 1 bytes: (62) "b"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470228791, (10,40), root:(2572,60),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470230303, (10,40), root:(2572,60),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470230791, (10,40), root:(2572,60),
    state 0x50, keycode 54 (keysym 0x63, c), same_screen YES,
    XLookupString gives 1 bytes: (63) "c"
    XmbLookupString gives 1 bytes: (63) "c"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470230863, (10,40), root:(2572,60),
    state 0x50, keycode 54 (keysym 0x63, c), same_screen YES,
    XLookupString gives 1 bytes: (63) "c"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470231303, (10,40), root:(2572,60),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470231775, (10,40), root:(2572,60),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470232223, (10,40), root:(2572,60),
    state 0x50, keycode 40 (keysym 0x64, d), same_screen YES,
    XLookupString gives 1 bytes: (64) "d"
    XmbLookupString gives 1 bytes: (64) "d"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470232303, (10,40), root:(2572,60),
    state 0x50, keycode 40 (keysym 0x64, d), same_screen YES,
    XLookupString gives 1 bytes: (64) "d"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470232663, (10,40), root:(2572,60),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x1c00002, time 470237605, (10,41), root:(2572,61),
    state 0x10, is_hint 0, same_screen YES

EnterNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237613, (9,43), root:(2571,63),
    mode NotifyNormal, detail NotifyInferior, same_screen YES,
    focus YES, state 16

KeymapNotify event, serial 33, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237613, (9,43), root:(2571,63),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237621, (8,46), root:(2570,66),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237629, (8,51), root:(2570,71),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237637, (7,55), root:(2569,75),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237645, (6,60), root:(2568,80),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237653, (5,65), root:(2567,85),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237661, (4,69), root:(2566,89),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237669, (2,73), root:(2564,93),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237677, (1,78), root:(2563,98),
    state 0x10, is_hint 0, same_screen YES

MotionNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237685, (0,81), root:(2562,101),
    state 0x10, is_hint 0, same_screen YES

LeaveNotify event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 470237693, (-1,84), root:(2561,104),
    mode NotifyNormal, detail NotifyAncestor, same_screen YES,
    focus YES, state 16

FocusOut event, serial 33, synthetic NO, window 0x1c00001,
    mode NotifyNormal, detail NotifyNonlinear
^C

I can't see anything special/weird in there. It all just looks fine. However, the fact that xev gets mod+F1 means that awesome didn't grab it for sure...

However, the key code for F1 is 67:

KeyPress event, serial 33, synthetic NO, window 0x1c00001,
    root 0xc5, subw 0x0, time 469657772, (4,91), root:(2566,111),
    state 0x50, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

So, another idea:

 awful.key({modkey}, "#67", function () awful.screen.focus(1); naughty.notify{text="foo"} end),
 awful.key({}, "#67", function () awful.screen.focus(1); naughty.notify{text="foo"} end),

If one of these two (mod+F1 and just plain F1) works, then awesome fails to translate "F1" into its keycode.

With the above idea, here is something else to try:

local k = key{ key = "F1" }
naughty.notify({ timeout = 600, text = "keysym = " .. (k.keysym or "nil") .. "; key = " .. (k.key or "nil") .. "; modifiers = " .. k.modifiers })

This just displays the result of awesome's translation of F1 into a keysym (and could be run via awesome-client or just by appending to the end of your config)

no changing and display nothing

The following doesn't show anything?!?!?!?

echo 'local k = key{ key = "F1" } ; naughty.notify({ timeout = 600, text = "keysym = " .. (k.keysym or "nil") .. "; key = " .. (k.key or "nil") .. "; modifiers = " .. k.modifiers })' | awesome-client

This sounds a lot like you are not actually editing your config file. This really _must_ have some effect.

I did not echo this command but just appended it to the end of rc.lua.

finally, I got some sweet error when I used echo that command, thank god.

the error is

Oops, an error happened
[string "local k = key {key="F1"};naught.noify(..."]:1: attempt to index a nil value(global 'naughty')

Ah, sorry. For the echo version it needs to be require("naughty") instead of naughty, so:

echo 'local k = key{ key = "F1" } ; require("naughty").notify({ timeout = 600, text = "keysym = " .. (k.keysym or "nil") .. "; key = " .. (k.key or "nil") .. "; modifiers = " .. k.modifiers })' | awesome-client

the new error message is

Oops, an error happened
[string "local k = key {key="F1"};naught.noify(..."]:1: attempt to concatenate a table value(field 'modifiers')

Give me a year and I will produce a working version...

echo 'local k = key{ key = "F1" } ; require("naughty").notify({ timeout = 600, text = "keysym = " .. (k.keysym or "nil") .. "; key = " .. (k.key or "nil") .. "; modifiers = " .. require("gears.debug").dump_return(k.modifiers) })' | awesome-client

OK, no error again and show message is

keysym=F1; key=F1; modifiers=

and the message is showed in another monitor(also error messages) but the focus does not be moved.

Weird. I have no idea why the key binding for F1 does not work.
Edit: Sorry :-(

hi~, it works using ctrl + modkey + j without any configuration in rc.lua and I do not know why, but it works.

Was this page helpful?
0 / 5 - 0 ratings