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 gears = require("gears")
local awful = require("awful") local awful = require("awful")
-- Custom Local Library
-- local titlebar = require("anybox.titlebar")
local _M = {} local _M = {}
local modkey = RC.vars.modkey local modkey = RC.vars.modkey
------------------
local cyclefocus = require('cyclefocus')
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _M.get() function _M.get()
local clientkeys = gears.table.join( local client_keys = gears.table.join(
awful.key({ modkey, }, "f", awful.key({ modkey, }, "f",
function (c) function (c)
c.fullscreen = not c.fullscreen c.fullscreen = not c.fullscreen
@ -60,9 +54,7 @@ function _M.get()
-- {description = "cycle through clients from the same screen and tag", group = "client"}) -- {description = "cycle through clients from the same screen and tag", group = "client"})
) )
return clientkeys return client_keys
end end
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) 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 gears = require("gears")
local awful = require("awful") local awful = require("awful")
-- local hotkeys_popup = require("awful.hotkeys_popup").widget --- others
local hotkeys_popup = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup")
-- Menubar library
local menubar = require("menubar") local menubar = require("menubar")
--- resource configuration
-- Resource Configuration
local modkey = RC.vars.modkey local modkey = RC.vars.modkey
local terminal = RC.vars.terminal local terminal = RC.vars.terminal
local _M = {} local _M = {}
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _M.get() function _M.get()
local globalkeys = gears.table.join( local global_keys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help, awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}), {description="show help", group="awesome"}),
@ -140,11 +135,6 @@ function _M.get()
awful.key({ modkey, "Shift" }, "Right", awful.key({ modkey, "Shift" }, "Right",
function () awful.client.moveresize( 20, 0, 0, 0) end), 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.key({ modkey, }, "p", function()
awful.util.spawn("rofi -show combi -modes combi,filebrowser -combi-modes \"drun,filebrowser,run\"") end, awful.util.spawn("rofi -show combi -modes combi,filebrowser -combi-modes \"drun,filebrowser,run\"") end,
{description = "open rofi runner", group = "launcher"}), {description = "open rofi runner", group = "launcher"}),
@ -154,9 +144,7 @@ function _M.get()
{description = "scrot", group = "launcher"}) {description = "scrot", group = "launcher"})
) )
return globalkeys return global_keys
end end
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) end }) return setmetatable({}, { __call = function(_, ...) return _M.get(...) end })

View File

@ -1,20 +1,16 @@
-- Standard awesome library --- awesome stdlib
local gears = require("gears") local gears = require("gears")
local awful = require("awful") local awful = require("awful")
local _M = {} local _M = {}
local modkey = RC.vars.modkey local modkey = RC.vars.modkey
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function _M.get(global_keys)
-- {{{ Key bindings
function _M.get(globalkeys)
-- Bind all key numbers to tags. -- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout. -- 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. -- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do for i = 1, 9 do
globalkeys = gears.table.join(globalkeys, global_keys = gears.table.join(global_keys,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- View tag only. -- View tag only.
@ -70,10 +66,8 @@ function _M.get(globalkeys)
) )
end end
return globalkeys return global_keys
end end
-- }}} -- }}}
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.get(...) 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 gears = require("gears")
local awful = require("awful") local awful = require("awful")
local _M = {} local _M = {}
local modkey = RC.vars.modkey ------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _M.get() function _M.get()
local clientbuttons = gears.table.join( local client_buttons = gears.table.join(
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:emit_signal("request::activate", "mouse_click", {raise = true})
end), end),
awful.button({ modkey }, 1, function (c) awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c) awful.mouse.client.move(c)
end), end),
awful.button({ modkey }, 3, function (c) awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c) awful.mouse.client.resize(c)
end) end))
) return client_buttons
return clientbuttons
end 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 gears = require("gears")
local awful = require("awful") local awful = require("awful")
local _M = {} local _M = {}
------------------
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _M.get() function _M.get()
local globalbuttons = gears.table.join( local global_buttons = gears.table.join(
awful.button({ }, 3, function () RC.mainmenu:toggle() end), awful.button({ }, 3, function () RC.mainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
) )
return global_buttons
return globalbuttons
end 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 -- Theme handling library
local beautiful = require("beautiful") local beautiful = require("beautiful")
-- Miscellanous awesome library -- Miscellaneous awesome library
local menubar = require("menubar") local menubar = require("menubar")
RC = {} -- global namespace, on top before require any modules RC = {} -- global namespace, on top before require any modules
@ -35,12 +35,12 @@ local main = {
} }
-- Custom Local Library: Keys and Mouse Binding -- Custom Local Library: Keys and Mouse Binding
local binding = { local bindings = {
globalbuttons = require("binding.globalbuttons"), global_keys = require("bindings.keys.global"),
clientbuttons = require("binding.clientbuttons"), tags = require("bindings.keys.tags"),
globalkeys = require("binding.globalkeys"), client_keys = require("bindings.keys.client"),
bindtotags = require("binding.bindtotags"), global_buttons = require("bindings.mouse.global"),
clientkeys = require("binding.clientkeys") client_buttons = require("bindings.mouse.client")
} }
-- {{{ Layouts -- {{{ Layouts
@ -72,12 +72,12 @@ menubar.utils.terminal = RC.vars.terminal
-- }}} -- }}}
-- {{{ Mouse and Key bindings -- {{{ Mouse and Key bindings
RC.globalkeys = binding.globalkeys() RC.global_keys = bindings.global_keys()
RC.globalkeys = binding.bindtotags(RC.globalkeys) RC.global_keys = bindings.tags(RC.global_keys)
-- Set root -- Set root
root.buttons(binding.globalbuttons()) root.buttons(bindings.global_buttons())
root.keys(RC.globalkeys) root.keys(RC.global_keys)
-- }}} -- }}}
-- Keyboard map indicator and switcher -- Keyboard map indicator and switcher
@ -90,8 +90,8 @@ require("deco.statusbar")
-- {{{ Rules -- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal). -- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = main.rules( awful.rules.rules = main.rules(
binding.clientkeys(), bindings.client_keys(),
binding.clientbuttons() bindings.client_buttons()
) )
-- }}} -- }}}