reorganize bindings

This commit is contained in:
ngoomie 2023-05-22 23:12:23 -06:00
parent 37c0f561c4
commit 3b040ad1e4
6 changed files with 60 additions and 96 deletions

View File

@ -1,18 +1,12 @@
-- Standard Awesome library
--- awesome stdlib
local gears = require("gears")
local awful = require("awful")
-- Custom Local Library
-- local titlebar = require("anybox.titlebar")
local _M = {}
local modkey = RC.vars.modkey
local cyclefocus = require('cyclefocus')
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
function _M.get()
local clientkeys = gears.table.join(
local client_keys = gears.table.join(
awful.key({ modkey, }, "f",
function (c)
c.fullscreen = not c.fullscreen
@ -60,9 +54,7 @@ function _M.get()
-- {description = "cycle through clients from the same screen and tag", group = "client"})
)
return clientkeys
return client_keys
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -1,22 +1,17 @@
-- Standard awesome library
--- awesome stdlib
local gears = require("gears")
local awful = require("awful")
-- local hotkeys_popup = require("awful.hotkeys_popup").widget
--- others
local hotkeys_popup = require("awful.hotkeys_popup")
-- Menubar library
local menubar = require("menubar")
-- Resource Configuration
--- resource configuration
local modkey = RC.vars.modkey
local terminal = RC.vars.terminal
local _M = {}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
function _M.get()
local globalkeys = gears.table.join(
local global_keys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}),
@ -121,30 +116,25 @@ function _M.get()
-- Resize
--awful.key({ modkey, "Control" }, "Left", function () awful.client.moveresize( 20, 20, -40, -40) end),
--awful.key({ modkey, "Control" }, "Right", function () awful.client.moveresize(-20, -20, 40, 40) end),
awful.key({ modkey, "Control" }, "Down",
awful.key({ modkey, "Control" }, "Down",
function () awful.client.moveresize( 0, 0, 0, -20) end),
awful.key({ modkey, "Control" }, "Up",
awful.key({ modkey, "Control" }, "Up",
function () awful.client.moveresize( 0, 0, 0, 20) end),
awful.key({ modkey, "Control" }, "Left",
awful.key({ modkey, "Control" }, "Left",
function () awful.client.moveresize( 0, 0, -20, 0) end),
awful.key({ modkey, "Control" }, "Right",
awful.key({ modkey, "Control" }, "Right",
function () awful.client.moveresize( 0, 0, 20, 0) end),
-- Move
awful.key({ modkey, "Shift" }, "Down",
awful.key({ modkey, "Shift" }, "Down",
function () awful.client.moveresize( 0, 20, 0, 0) end),
awful.key({ modkey, "Shift" }, "Up",
awful.key({ modkey, "Shift" }, "Up",
function () awful.client.moveresize( 0, -20, 0, 0) end),
awful.key({ modkey, "Shift" }, "Left",
awful.key({ modkey, "Shift" }, "Left",
function () awful.client.moveresize(-20, 0, 0, 0) end),
awful.key({ modkey, "Shift" }, "Right",
awful.key({ modkey, "Shift" }, "Right",
function () awful.client.moveresize( 20, 0, 0, 0) end),
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Menubar
--awful.key({ modkey }, "p", function() menubar.show() end,
-- {description = "show the menubar", group = "launcher"})
awful.key({ modkey, }, "p", function()
awful.util.spawn("rofi -show combi -modes combi,filebrowser -combi-modes \"drun,filebrowser,run\"") end,
{description = "open rofi runner", group = "launcher"}),
@ -154,9 +144,7 @@ function _M.get()
{description = "scrot", group = "launcher"})
)
return globalkeys
return global_keys
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })
------------------
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -1,21 +1,17 @@
-- Standard awesome library
--- awesome stdlib
local gears = require("gears")
local awful = require("awful")
local _M = {}
local modkey = RC.vars.modkey
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- {{{ Key bindings
function _M.get(globalkeys)
------------------
function _M.get(global_keys)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
global_keys = gears.table.join(global_keys,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
@ -39,7 +35,7 @@ function _M.get(globalkeys)
end
end,
{description = "toggle tag #" .. i, group = "tag"}),
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
@ -52,7 +48,7 @@ function _M.get(globalkeys)
end
end,
{description = "move focused client to tag #"..i, group = "tag"}),
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
@ -70,10 +66,8 @@ function _M.get(globalkeys)
)
end
return globalkeys
return global_keys
end
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -1,30 +1,25 @@
-- Standard awesome library
--- awesome stdlib
local gears = require("gears")
local awful = require("awful")
local _M = {}
local modkey = RC.vars.modkey
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
function _M.get()
local clientbuttons = gears.table.join(
local client_buttons = gears.table.join(
awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
end),
end),
awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c)
end),
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c)
end)
)
return clientbuttons
end))
return client_buttons
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })
------------------
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -1,21 +1,16 @@
-- Standard awesome library
--- awesome stdlib
local gears = require("gears")
local awful = require("awful")
local _M = {}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
------------------
function _M.get()
local globalbuttons = gears.table.join(
local global_buttons = gears.table.join(
awful.button({ }, 3, function () RC.mainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
return globalbuttons
return global_buttons
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })
------------------
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -9,7 +9,7 @@ local awful = require("awful")
-- Theme handling library
local beautiful = require("beautiful")
-- Miscellanous awesome library
-- Miscellaneous awesome library
local menubar = require("menubar")
RC = {} -- global namespace, on top before require any modules
@ -35,12 +35,12 @@ local main = {
}
-- Custom Local Library: Keys and Mouse Binding
local binding = {
globalbuttons = require("binding.globalbuttons"),
clientbuttons = require("binding.clientbuttons"),
globalkeys = require("binding.globalkeys"),
bindtotags = require("binding.bindtotags"),
clientkeys = require("binding.clientkeys")
local bindings = {
global_keys = require("bindings.keys.global"),
tags = require("bindings.keys.tags"),
client_keys = require("bindings.keys.client"),
global_buttons = require("bindings.mouse.global"),
client_buttons = require("bindings.mouse.client")
}
-- {{{ Layouts
@ -72,12 +72,12 @@ menubar.utils.terminal = RC.vars.terminal
-- }}}
-- {{{ Mouse and Key bindings
RC.globalkeys = binding.globalkeys()
RC.globalkeys = binding.bindtotags(RC.globalkeys)
RC.global_keys = bindings.global_keys()
RC.global_keys = bindings.tags(RC.global_keys)
-- Set root
root.buttons(binding.globalbuttons())
root.keys(RC.globalkeys)
root.buttons(bindings.global_buttons())
root.keys(RC.global_keys)
-- }}}
-- Keyboard map indicator and switcher
@ -90,8 +90,8 @@ require("deco.statusbar")
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = main.rules(
binding.clientkeys(),
binding.clientbuttons()
bindings.client_keys(),
bindings.client_buttons()
)
-- }}}