From 1a834d4e354b2afb62a8468ccbd3bb220dd353d7 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 21 Dec 2020 14:34:10 +0530 Subject: completely removed the hotkeys popup functionality and made the keybindings look cleaner --- awesome/rc.lua | 146 +++++++++++++++++++++++++-------------------------------- 1 file changed, 64 insertions(+), 82 deletions(-) diff --git a/awesome/rc.lua b/awesome/rc.lua index aeb2053d..05b8a98d 100755 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -6,10 +6,6 @@ local wibox = require("wibox") local beautiful = require("beautiful") local naughty = require("naughty") -- local menubar = require("menubar") -local hotkeys_popup = require("awful.hotkeys_popup") --- Enable hotkeys help widget for VIM and other apps --- when client with a matching name is opened: -require("awful.hotkeys_popup.keys") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -36,7 +32,7 @@ do end -- }}} --- {{{ Variable definitions +-- actual config starts here -- Themes define colours, icons, font and wallpapers. beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua") @@ -65,7 +61,6 @@ awful.layout.layouts = { -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, } --- }}} -- Keyboard map indicator and switcher mykeyboardlayout = awful.widget.keyboardlayout() @@ -209,16 +204,16 @@ root.buttons(gears.table.join( -- for window navigation with hjkl -- i.e vim movement keys vimNavKeys = gears.table.join( - awful.key({ "Mod4" }, "j", function () awful.client.focus.bydirection("down") + awful.key({ modkey, }, "j", function () awful.client.focus.bydirection("down") if client.focus then client.focus:raise() end end), - awful.key({ "Mod4" }, "k", function () awful.client.focus.bydirection("up") + awful.key({ modkey, }, "k", function () awful.client.focus.bydirection("up") if client.focus then client.focus:raise() end end), - awful.key({ "Mod4" }, "h", function () awful.client.focus.bydirection("left") + awful.key({ modkey, }, "h", function () awful.client.focus.bydirection("left") if client.focus then client.focus:raise() end end), - awful.key({ "Mod4" }, "l", function () awful.client.focus.bydirection("right") + awful.key({ modkey, }, "l", function () awful.client.focus.bydirection("right") if client.focus then client.focus:raise() end end) ) @@ -226,57 +221,38 @@ vimNavKeys = gears.table.join( -- for manipulating layout with hjkl -- i.e move windows with vim movement keys vimLayoutKeys = gears.table.join( - awful.key({ "Mod4", "Shift" }, "h", function () awful.client.swap.bydirection("left") end, - {description = "move client to the left", group = "client"}), - awful.key({ "Mod4", "Shift" }, "j", function () awful.client.swap.bydirection("down") end, - {description = "move client downwards", group = "client"}), - awful.key({ "Mod4", "Shift" }, "k", function () awful.client.swap.bydirection("up") end, - {description = "move client upwards", group = "client"}), - awful.key({ "Mod4", "Shift" }, "l", function () awful.client.swap.bydirection("right") end, - {description = "move client to the right", group = "client"}) + awful.key({ "Mod4", "Shift" }, "h", function () awful.client.swap.bydirection("left") end), + awful.key({ "Mod4", "Shift" }, "j", function () awful.client.swap.bydirection("down") end), + awful.key({ "Mod4", "Shift" }, "k", function () awful.client.swap.bydirection("up") end), + awful.key({ "Mod4", "Shift" }, "l", function () awful.client.swap.bydirection("right") end) ) layoutKeys = gears.table.join( - awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, - {description = "select next", group = "layout"}), - awful.key({ "Mod4", }, "=", function () awful.tag.incmwfact( 0.05) end, - {description = "increase master width factor", group = "layout"}), - awful.key({ "Mod4", }, "-", function () awful.tag.incmwfact(-0.05) end, - {description = "decrease master width factor", group = "layout"}) - - -- move client to next/prev tag - -- and focus said tag --- awful.key({ "Mod1", }, "l" - --- I don't need these keys since --- I don't use master and stack layout --- because it's CRINGE lol --- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster( 1, nil, true) end, --- {description = "increase the number of master clients", group = "layout"}), --- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(-1, nil, true) end, --- {description = "decrease the number of master clients", group = "layout"}), --- awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, --- {description = "increase the number of columns", group = "layout"}), --- awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, --- {description = "decrease the number of columns", group = "layout"}), + -- cycle through layouts + awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end), + + -- I need these to resize window in magnifier layout + -- increase master width factor + awful.key({ modkey, }, "=", function () awful.tag.incmwfact( 0.05) end), + -- decrease master width factor + awful.key({ modkey, }, "-", function () awful.tag.incmwfact(-0.05) end) ) -- keybindings to navigate b/w monitors --- uncomment multiMonitorNavKeys in --- globalkeys to enable +-- I don't use them multiMonitorNavKeys = gears.table.join( - awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, - {description = "focus the next screen", group = "screen"}), - awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, - {description = "focus the previous screen", group = "screen"}) + -- focus next screen + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + -- focus preious screen + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end) ) tagKeys = gears.table.join( -- cycle tabs using h and l - awful.key({ "Mod1", }, "h", awful.tag.viewprev), - awful.key({ "Mod1", }, "l", awful.tag.viewnext), + awful.key({ "Mod1", }, "h", awful.tag.viewprev), + awful.key({ "Mod1", }, "l", awful.tag.viewnext), -- go back to last tag - awful.key({ "Mod1", }, "Tab", awful.tag.history.restore) + awful.key({ "Mod1", }, "Tab", awful.tag.history.restore) ) @@ -286,19 +262,29 @@ tagKeys = gears.table.join( -- i.e minimizing, maximizing, hiding, closing windows clientkeys = gears.table.join( -- kill client - awful.key({ modkey, "Shift", }, "c", function (c) c:kill() end), + awful.key({ modkey, "Shift", }, "c", function (c) c:kill() end), + -- toggle fulscreen - awful.key({ modkey, }, "f", - function (c) + awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen - c:raise() - end), + c:raise() end), -- minimize focused client awful.key({ modkey, }, "m", function (c) c.minimized = true end), -- unminimize clients - -- TODO: figure out how to unminimize clients + -- somehow this doesn't work if every + -- client on current tag is minimized + awful.key({ modkey, }, "g", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + c:emit_signal( + "request::activate", "key.unminimize", {raise = true} + ) + end + end), -- float/unfloat window awful.key({ modkey, }, "d", awful.client.floating.toggle), @@ -318,38 +304,34 @@ clientkeys = gears.table.join( c.maximized_horizontal = not c.maximized_horizontal c:raise() end), + -- jump to urgent client + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + + -- focus previous client + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + -- move client to master awful.key({ modkey, "Shift" }, "Return", function (c) c:swap(awful.client.getmaster()) end) ) --- {{{ Key bindings +awesomeKeys = gears.table.join( + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit) +) + globalkeys = gears.table.join( + awesomeKeys, vimNavKeys, + multiMonitorNavKeys, vimLayoutKeys, layoutKeys, - tagKeys, - -- multiMonitorNavKeys, - awful.key({ modkey, }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), - - - - awful.key({ "Mod1", }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), - awful.key({ modkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, - {description = "go back", group = "client"}), - - awful.key({ modkey, "Control" }, "r", awesome.restart, - {description = "reload awesome", group = "awesome"}), - awful.key({ modkey, "Shift" }, "q", awesome.quit, - {description = "quit awesome", group = "awesome"}) - + tagKeys ) @@ -407,9 +389,9 @@ for i = 1, 10 do end clientbuttons = gears.table.join( - awful.button({ }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - end), +-- awful.button({ }, 1, function (c) +-- c:emit_signal("request::activate", "mouse_click", {raise = true}) +-- end), awful.button({ modkey }, 1, function (c) c:emit_signal("request::activate", "mouse_click", {raise = true}) awful.mouse.client.move(c) -- cgit v1.2.3