add(global_keybindings) generic client and layout

This commit is contained in:
Aire-One 2021-09-27 00:53:37 +02:00
parent 1f00c3775a
commit 3d7c85c3aa
1 changed files with 109 additions and 3 deletions

View File

@ -1,8 +1,10 @@
local aclient = require 'awful.client'
local akey = require 'awful.key'
local aprompt = require 'awful.prompt'
local autil = require 'awful.util'
local ascreen = require 'awful.screen'
local aspawn = require 'awful.spawn'
local atag = require 'awful.tag'
local autil = require 'awful.util'
local menubar = require 'menubar'
@ -12,7 +14,8 @@ local hotkeys_popup = require 'rc.ui.hotkeys_popup'
local mymainmenu = require 'rc.ui.menu.mymainmenu'
local capi = {
awesome = awesome
awesome = _G.awesome,
client = _G.client
}
local control = 'Control'
@ -60,7 +63,110 @@ local global_keybindings = {
function ()
menubar.show()
end,
{ description = 'show the menubar', group = 'launcher' })
{ description = 'show the menubar', group = 'launcher' }),
-- Client focus
akey {
modifiers = { modkey },
key = 'j',
group = 'client',
description = 'Focus next client by index',
on_press = function ()
aclient.focus.byidx(1)
end
},
akey {
modifiers = { modkey },
key = 'k',
group = 'client',
description = 'Focus previous by index',
on_press = function ()
aclient.focus.byidx(-1)
end
},
-- Layout manipulation
akey {
modifiers = { modkey, shift },
key = 'j',
group = 'client',
description = 'Swap with next client',
on_press = function ()
aclient.swap.byidx(1)
end
},
akey {
modifiers = { modkey, shift },
key = 'k',
group = 'client',
description = 'Swap with previous client',
on_press = function ()
aclient.swap.byidx(-1)
end
},
akey {
modifiers = { modkey, shift },
key = 'Right',
description = 'Increase master width factor',
group = 'client',
on_press = function ()
atag.incmwfact(0.01)
end
},
akey {
modifiers = { modkey, shift },
key = 'Left',
description = 'Decrease master width factor',
group = 'client',
on_press = function ()
atag.incmwfact(-0.01)
end
},
-- Tags manipulation
akey {
modifiers = { modkey },
keygroup = akey.keygroup.NUMROW,
description = 'only view tag',
group = 'tag',
on_press = function (index)
local screen = ascreen.focused()
local tag = screen.tags[index]
if tag then
tag:view_only()
end
end
},
akey {
modifiers = { modkey, control },
keygroup = akey.keygroup.NUMROW,
description = 'toggle tag',
group = 'tag',
on_press = function (index)
local screen = ascreen.focused()
local tag = screen.tags[index]
if tag then
atag.viewtoggle(tag)
end
end
},
akey {
modifiers = { modkey, shift },
keygroup = akey.keygroup.NUMROW,
description = 'move focused client to tag',
group = 'tag',
on_press = function (index)
local screen = ascreen.focused()
local client = capi.client.focus
local tag = screen.tags[index]
if client and tag then
client:move_to_tag(tag)
end
end
}
}
return global_keybindings