awesomewm/bindings.lua

217 lines
9.5 KiB
Lua
Raw Normal View History

2010-06-06 02:56:07 +00:00
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
2012-03-15 08:02:06 +00:00
2010-06-06 02:56:07 +00:00
-- {{{ Key bindings
globalkeys = awful.util.table.join(
2011-04-06 00:09:56 +00:00
--{{{ Focus and Tags
2010-06-06 02:56:07 +00:00
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
2011-04-06 00:09:56 +00:00
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
2010-06-06 02:56:07 +00:00
--}}}
2011-04-06 00:09:56 +00:00
2010-06-06 02:56:07 +00:00
--{{{ Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
awful.key({ "Mod1", }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
--}}}
2011-04-06 00:09:56 +00:00
--
--{{{ Spawns
2010-06-06 02:56:07 +00:00
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
2011-05-09 19:23:03 +00:00
awful.key({ modkey, }, "f", function () awful.util.spawn("webbrowser") end),
awful.key({ modkey, }, "t", function () awful.util.spawn("mail-client") end),
awful.key({ modkey, }, "p", function () awful.util.spawn("im-client") end),
2010-06-29 10:27:30 +00:00
awful.key({ modkey, }, "g", function () awful.util.spawn("gmpc") end),
2010-10-24 15:17:10 +00:00
awful.key({ modkey, }, "w", function () awful.util.spawn("awsetbg -a -r /home/crater2150/.config/awesome/walls/ &") end),
2010-06-06 02:56:07 +00:00
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
2010-09-03 22:52:38 +00:00
awful.key({ }, "Menu", aweswt.switch),
2011-05-10 18:45:31 +00:00
awful.key({ modkey }, "BackSpace", rodentbane.start),
2011-04-06 00:09:56 +00:00
--}}}
2010-06-29 10:27:30 +00:00
2011-04-06 00:09:56 +00:00
--{{{ tabletpc keys
2010-06-29 10:27:30 +00:00
awful.key({ hyper }, "6", function () awful.util.spawn("/usr/local/bin/rotate") end),
2010-09-01 15:52:20 +00:00
awful.key({ modkey }, "x", function () teardrop("cellwriter","top","center", 0.99, 0.4)end ),
2010-06-29 10:27:30 +00:00
awful.key({ modkey, "Control" }, "Delete", function () awful.util.spawn("xlock") end),
2011-04-06 00:09:56 +00:00
2011-05-09 19:23:03 +00:00
awful.key({ hyper }, "1", function () awful.util.spawn("/usr/local/bin/tabletstick 1") end),
awful.key({ hyper }, "2", function () awful.util.spawn("/usr/local/bin/tabletstick 2") end),
awful.key({ hyper }, "3", function () awful.util.spawn("/usr/local/bin/tabletstick 3") end),
awful.key({ hyper }, "4", function () awful.util.spawn("/usr/local/bin/tabletstick 4") end),
awful.key({ hyper }, "5", function () awful.util.spawn("/usr/local/bin/tabletstick 4") end),
2011-12-01 12:02:59 +00:00
--}}}
--{{{ thinkpad
awful.key({ }, "XF86Sleep", function () awful.util.spawn("/usr/local/bin/s2ram")end ),
awful.key({ }, "XF86Away", function () awful.util.spawn("xlock")end ),
awful.key({ }, "XF86TouchpadToggle", function () awful.util.spawn("touchpad")end ),
--}}}
2010-06-06 02:56:07 +00:00
2011-04-06 00:09:56 +00:00
--{{{ Audio control
awful.key({ }, "Print", function () teardrop("urxvtc -e alsamixer","top","center", 0.99, 0.4)end ),
2011-05-09 19:37:59 +00:00
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-")end ),
awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+")end ),
awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") end),
2010-06-06 02:56:07 +00:00
awful.key({ modkey }, "m", function () awful.util.spawn("mpc toggle") end),
2012-03-15 08:02:06 +00:00
awful.key({ modkey }, ">", function () awful.util.spawn("mpc next") end),
awful.key({ modkey }, "<", function () awful.util.spawn("mpc prev") end),
awful.key({ modkey , "Shift" }, "m", mpd_prompt.grabber),
2010-06-06 02:56:07 +00:00
awful.key({ }, "XF86AudioPlay", function () awful.util.spawn("mpc toggle") end),
awful.key({ }, "XF86AudioNext", function () awful.util.spawn("mpc next") end),
awful.key({ }, "XF86AudioPrev", function () awful.util.spawn("mpc prev") end),
2011-05-10 18:59:47 +00:00
awful.key({ modkey }, "`", function () teardrop("urxvtc -e ncmpcpp","bottom","center", 0.99, 0.4)end ),
2011-04-06 00:09:56 +00:00
--}}}
--{{{ Prompt
awful.key({ modkey }, "r", function ()
obvious.popup_run_prompt.set_prompt_string(" Run~ ")
obvious.popup_run_prompt.set_cache("history")
obvious.popup_run_prompt.set_run_function(awful.util.spawn)
obvious.popup_run_prompt.run_prompt()
end),
awful.key({ modkey }, "e", function ()
obvious.popup_run_prompt.set_prompt_string(" exec Lua~ ")
obvious.popup_run_prompt.set_cache("history_eval")
obvious.popup_run_prompt.set_run_function(awful.util.eval)
obvious.popup_run_prompt.run_prompt()
end),
awful.key({ }, "F12", function () teardrop(terminal,"center","center", 0.99, 0.7)end ),
2010-06-06 02:56:07 +00:00
2011-04-06 00:09:56 +00:00
--}}}
2010-06-06 02:56:07 +00:00
2011-04-06 00:09:56 +00:00
--{{{ Default
2010-06-06 02:56:07 +00:00
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, 0) end)
--}}}
)
2012-03-06 07:47:26 +00:00
function client_opacity_set(c, default, max, step)
if c.opacity < 0 or c.opacity > 1 then
c.opacity = default
end
if c.opacity * step < (max-step) * step then
c.opacity = c.opacity + step
else
c.opacity = max
end
end
2010-06-06 02:56:07 +00:00
clientkeys = awful.util.table.join(
awful.key({ modkey, "Shift" }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
2011-04-06 00:09:56 +00:00
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, "Control" }, "o", function (c) c.ontop = not c.ontop end),
2010-06-06 02:56:07 +00:00
awful.key({ modkey, }, "a", function (c) c.sticky = not c.sticky end),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
2011-04-06 00:09:56 +00:00
awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end),
2012-03-06 07:47:26 +00:00
awful.key({ modkey, }, "Up", function(c) client_opacity_set(c, 1, 1, 0.1) end),
awful.key({ modkey, }, "Down", function(c) client_opacity_set(c, 1, 0, -0.1) end),
2011-04-06 00:09:56 +00:00
awful.key({ }, "XF86Calculater", awful.client.movetoscreen )
2010-06-06 02:56:07 +00:00
)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(22, math.max(#tags[s], keynumber));
end
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
-- FKeys: 67-78
for i = 1, keynumber do
if i < 10 then
k = "#" .. i + 9
elseif i == 10 then
k = "#19"
elseif i > 10 then
k = "F" .. i - 10
end
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, k,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, k,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, k,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, k,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- }}}