From a3b4c66737a46095145b271a8abb2c2e831f9dd4 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Wed, 15 Sep 2010 22:42:56 +0200 Subject: [PATCH] keymaps --- keymaps/actions.lua | 48 +++++++++++++++++++++++++++++ keymaps/spawn.lua | 73 +++++++++++++++++++++++++++++++++++++++++++++ keymaps/wmbase.lua | 49 ++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 keymaps/actions.lua create mode 100644 keymaps/spawn.lua create mode 100644 keymaps/wmbase.lua diff --git a/keymaps/actions.lua b/keymaps/actions.lua new file mode 100644 index 0000000..a81e8f5 --- /dev/null +++ b/keymaps/actions.lua @@ -0,0 +1,48 @@ +-- Client manipulation +modkey = "Mod4" + +keybinding({ "Mod1" }, "Tab", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end):add() + + + +--From Here default config + +keybinding({ modkey, "Shift" }, "f", function () if client.focus then client.focus.fullscreen = not client.focus.fullscreen end end):add() +keybinding({ modkey, "Shift" }, "c", function () if client.focus then client.focus:kill() end end):add() +keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end):add() +keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1); if client.focus then client.focus:raise() end end):add() +keybinding({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end):add() +keybinding({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end):add() +keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add() +keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add() +keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add() +keybinding({ modkey, "Control" }, "Return", function () if client.focus then client.focus:swap(awful.client.getmaster()) end end):add() +keybinding({ modkey }, "o", awful.client.movetoscreen):add() +keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add() +keybinding({ modkey }, "u", awful.client.urgent.jumpto):add() +keybinding({ modkey, "Shift" }, "r", function () if client.focus then client.focus:redraw() end end):add() + +-- Layout manipulation +keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add() +keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add() +keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add() +keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add() +keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add() +keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add() +keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add() +keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add() + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +keybinding({ modkey }, "t", awful.client.togglemarked):add() + +for i = 1, keynumber do + keybinding({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end):add() +end diff --git a/keymaps/spawn.lua b/keymaps/spawn.lua new file mode 100644 index 0000000..93c88fe --- /dev/null +++ b/keymaps/spawn.lua @@ -0,0 +1,73 @@ + + +keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add() +keybinding({ modkey }, "f", function () awful.util.spawn("firefox") end):add() +keybinding({ }, "XF86AudioLowerVolume", function () awful.util.spawn("voldown 3") end):add() +keybinding({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("volup 3") end):add() +keybinding({ "Shift" }, "XF86AudioLowerVolume", function () awful.util.spawn("voldown 10") end):add() +keybinding({ "Shift" }, "XF86AudioRaiseVolume", function () awful.util.spawn("volup 10") end):add() +keybinding({ modkey }, "XF86Mail", function () awful.util.spawn("xset dpms force off") end):add() +keybinding({ modkey }, "XF86WWW", function () awful.util.spawn(terminal .. " -e apselect") end):add() + + +keybinding({ }, "XF86AudioPlay", function () awful.util.spawn("mpc toggle") end):add() +keybinding({ }, "XF86AudioNext", function () awful.util.spawn("mpc next") end):add() +keybinding({ }, "XF86AudioPrev", function () awful.util.spawn("mpc prev") end):add() +keybinding({ }, "XF86AudioStop", function () awful.util.spawn("mpc stop") end):add() +keybinding({ modkey }, "XF86AudioStop", function () awful.util.spawn("mpc clear") end):add() +keybinding({ modkey }, "XF86AudioPlay", function () + awful.prompt.run({ prompt = "Play Band: " }, + mypromptbox[mouse.screen], playband, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") +end):add() + +function playband(b) + return awful.util.spawn("playband " .. b) +end + + +keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add() + +keybinding({ modkey }, "F1", function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen], awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") +end):add() + +keybinding({ modkey }, "F4", function () + awful.prompt.run({ prompt = "Run Lua code: " }, + mypromptbox[mouse.screen], + awful.util.eval, + awful.prompt.bash, + awful.util.getdir("cache") .. "/history_eval") +end):add() + +keybinding({ modkey, "Ctrl" }, "i", function () + local s = mouse.screen + if mypromptbox[s].text then + mypromptbox[s].text = nil + elseif client.focus then + mypromptbox[s].text = nil + if client.focus.class then + mypromptbox[s].text = "Class: " .. client.focus.class .. " " + end + if client.focus.instance then + mypromptbox[s].text = mypromptbox[s].text .. "Instance: " + .. client.focus.instance .. " " + end + if client.focus.role then + mypromptbox[s].text = mypromptbox[s].text .. "Role: " + .. client.focus.role + end + end + end):add() + + +keybinding({}, "F12", function () + + tags[1][10].selected = not tags[1][10].selected; + +end):add() + diff --git a/keymaps/wmbase.lua b/keymaps/wmbase.lua new file mode 100644 index 0000000..e6d47aa --- /dev/null +++ b/keymaps/wmbase.lua @@ -0,0 +1,49 @@ + +-- Bind keyboard digits +-- Compute the maximum number of digit we need, limited to 9 +keynumber = 0 +for s = 1, screen.count() do + keynumber = math.min(9, math.max(#tags[s], keynumber)); +end + +for i = 1, keynumber do + keybinding({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end):add() + keybinding({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end):add() + keybinding({ modkey, "Shift" }, i, + function () + if client.focus then + if tags[client.focus.screen][i] then + awful.client.movetotag(tags[client.focus.screen][i]) + end + end + end):add() + keybinding({ modkey, "Control", "Shift" }, i, + function () + if client.focus then + if tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end + end):add() +end + +keybinding({ modkey }, "Left", awful.tag.viewprev):add() +keybinding({ modkey }, "Right", awful.tag.viewnext):add() +keybinding({ modkey }, "Escape", awful.tag.history.restore):add() + +keybinding({ modkey, "Control" }, "r", function () + mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart()) + end):add() +keybinding({ modkey, "Shift" }, "q", awesome.quit):add()