Merge pull request #3045 from ArenaL5/keys

Add a method to select a layout directly, without cycling through the whole list
This commit is contained in:
mergify[bot] 2020-05-12 20:33:31 +00:00 committed by GitHub
commit 814d701c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 1 deletions

View File

@ -372,6 +372,18 @@ awful.keyboard.append_global_keybindings({
end
end
end,
},
awful.key {
modifiers = { modkey },
keygroup = "numpad",
description = "select layout directly",
group = "layout",
on_press = function (index)
local t = awful.screen.focused().selected_tag
if t then
t.layout = t.layouts[index] or t.layout
end
end,
}
})

View File

@ -218,6 +218,7 @@ function widget.new(args)
KP_Multiply = "Num*",
KP_Subtract = "Num-",
KP_Add = "Num+",
KP_Enter = "NumEnter",
-- Some "obvious" entries are necessary for the Escape sequence
-- and whitespace characters:
Escape = "Esc",

View File

@ -32,6 +32,10 @@ local gobject = require("gears.object")
-- and its derivative. This is usually the number 1-9 followed by 0.
-- * **arrows**: The Left/Right/Top/Bottom keys usually located right of the
-- spacebar.
-- * **fkeys**: The keys F1 through F12 located at the topmost row of any
-- keyboard, plus F13 through F35 on specialist keyboards.
-- * **numpad**: The number keys on the keypad to the right of the letters and
-- the arrow keys. Not present in every keyboard.
--
-- @property keygroup
@ -333,7 +337,20 @@ key.keygroups = {
{"Right" , "Right" },
{"Up" , "Up" },
{"Down" , "Down" },
}
},
fkeys = {},
numpad = {
{"#87" , 1},
{"#88" , 2},
{"#89" , 3},
{"#83" , 4},
{"#84" , 5},
{"#85" , 6},
{"#79" , 7},
{"#80" , 8},
{"#81" , 9},
{"#90" , 10},
},
}
-- Technically, this isn't very popular, but we have been doing this for 12
@ -341,6 +358,9 @@ key.keygroups = {
for i = 1, 10 do
table.insert(key.keygroups.numrow, {"#" .. i + 9, i == 10 and 0 or i})
end
for i = 1, 35 do
table.insert(key.keygroups.fkeys, {"F" .. i, "F" .. i})
end
-- Allow key objects to provide more than 1 key.
--