我正在尝试执行ALT + TAB行为。
我想知道用户何时持有ALT键。
为什么这个发布功能不能工作?
awful.key(
{},
'Alt_L',
function()
altHold = true
end,
function()
altHold = false
end
),不切实际的解决方案:
awful.key(
{},
'Alt_L',
function()
altHold = true
end
),
awful.key(
{'Mod1'},
'Alt_L',
nil,
function()
altHold = false
end
)这是可行的,但任何其他热键与ALT已不再工作。
其他解决方案:
keygrabber.run(
function (mod, key, event)
-- Stop alt-tabbing when the alt-key is released
if gears.table.hasitem(mod, "Mod1") then
if (key == "Alt_L" or key == "Escape") and event == "release" then
-- Make it visible
if key == "Escape" then
-- Cancel client selection
end
else
-- Raise clients in order to restore history
-- raise chosen client on top of all
-- restore minimized clients
end
end
keygrabber.stop()
-- Pressed tab
elseif key == "Tab" and event == "press" then
if gears.table.hasitem(mod, "Shift") then
-- Move to previous client on Shift-Tab
cyclePreview(-1)
else
-- Move to next client on each Tab-press
cyclePreview( 1)
end
end
end
end
)这是Troglobit稍作修改的版本:
[https://github.com/troglobit/awesome-switcher/blob/master/init.lua#L470-L525\](https://github.com/troglobit/awesome-switcher/blob/master/init.lua#L470-L525%5C)
这将在ALT + TAB按下时调用。
在保存ALT时,下一个TAB按下调用previewCycle()函数。
如果ALT被释放,它将选择选择的客户端。
逃避取消所选内容。
发布于 2022-04-15 13:55:24
随机猜测:当密钥释放时,"alt“修饰符是活动的,因此您需要使用Mod1作为修饰符(是Alt Mod1吗?)我不完全确定)。但是当然,键绑定不会对按键做出反应,所以您需要两个键绑定。
https://stackoverflow.com/questions/71819818
复制相似问题