From b7c96f96473856ec0aaa2ffdd4454a2fca6c7735 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 3 Oct 2019 11:18:34 +0800 Subject: awesome: Adjust settings and add keybindings --- _config/awesome/rc.lua | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/_config/awesome/rc.lua b/_config/awesome/rc.lua index 18815c8..be775b3 100644 --- a/_config/awesome/rc.lua +++ b/_config/awesome/rc.lua @@ -1,3 +1,7 @@ +-- +-- ~/.config/awesome/rc.lua +-- + -- If LuaRocks is installed, make sure that packages installed through it are -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, "luarocks.loader") @@ -49,14 +53,12 @@ beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") -- This is used later as the default terminal and editor to run. terminal = "xterm" -editor = os.getenv("EDITOR") or "nano" +editor = os.getenv("EDITOR") or "vi" editor_cmd = terminal .. " -e " .. editor +lock_cmd = "slock" -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. --- If you do not like this or do not have such a key, --- I suggest you to remap Mod4 to another key using xmodmap or other tools. --- However, you can use another modifier like Mod1, but it may interact with others. modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. @@ -91,7 +93,8 @@ myawesomemenu = { } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "open terminal", terminal } + { "open terminal", terminal }, + { "lock screen", lock_cmd } } }) @@ -102,9 +105,6 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} --- Keyboard map indicator and switcher -mykeyboardlayout = awful.widget.keyboardlayout() - -- {{{ Wibar -- Create a textclock widget mytextclock = wibox.widget.textclock() @@ -230,7 +230,7 @@ root.buttons(gears.table.join( -- {{{ Key bindings globalkeys = gears.table.join( awful.key({ modkey, }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), + {description = "show help", group = "awesome"}), awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "view previous", group = "tag"}), awful.key({ modkey, }, "Right", awful.tag.viewnext, @@ -324,9 +324,24 @@ globalkeys = gears.table.join( } end, {description = "lua execute prompt", group = "awesome"}), + -- Menubar awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + {description = "show the menubar", group = "launcher"}), + + -- Custom + awful.key({ }, "Print", + function() awful.spawn.with_shell( "scrot -e 'mv $f ~/screenshots/' 2>/dev/null" ) end), + -- Wait for the key release so that scrot can grab the X server. + -- Credit: https://bbs.archlinux.org/viewtopic.php?pid=1698946#p1698946 + awful.key({ "Shift" }, "Print", + function() awful.spawn.with_shell( "sleep 0.5 && scrot -s -e 'mv $f ~/screenshots/' 2>/dev/null" ) end), + awful.key({ "Mod1" }, "F2", + function() awful.spawn.with_shell( "rofi -show run" ) end), + awful.key({ "Mod1" }, "F3", + function() awful.spawn.with_shell( "rofi -show window" ) end), + awful.key({ modkey, }, "l", + function() awful.spawn.with_shell( lock_cmd ) end) ) clientkeys = gears.table.join( @@ -340,6 +355,8 @@ clientkeys = gears.table.join( {description = "close", group = "client"}), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , {description = "toggle floating", group = "client"}), + awful.key({ modkey, }, "f", awful.client.floating.toggle , + {description = "toggle floating", group = "client"}), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, {description = "move to master", group = "client"}), awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, @@ -561,4 +578,4 @@ end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} \ No newline at end of file +-- }}} -- cgit v1.2.2