]> git.rmz.io Git - dotfiles.git/blob - awesome/bindings.lua
add Meta+^+{Left,Right} to switch screens
[dotfiles.git] / awesome / bindings.lua
1 -- {{{ Mouse bindings
2 root.buttons(awful.util.table.join(
3 awful.button({ }, 3, function () mymainmenu:toggle() end),
4 awful.button({ }, 4, awful.tag.viewnext),
5 awful.button({ }, 5, awful.tag.viewprev)
6 ))
7
8 clientbuttons = awful.util.table.join(
9 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
10 awful.button({ modkey }, 1, awful.mouse.client.move),
11 awful.button({ modkey }, 3, awful.mouse.client.resize))
12 -- }}}
13
14 -- {{{ Key bindings
15 globalkeys = awful.util.table.join(
16 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
17 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
18 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
19
20 awful.key({ modkey, }, "j",
21 function ()
22 awful.client.focus.byidx( 1)
23 if client.focus then client.focus:raise() end
24 end),
25 awful.key({ modkey, }, "k",
26 function ()
27 awful.client.focus.byidx(-1)
28 if client.focus then client.focus:raise() end
29 end),
30 awful.key({ modkey, }, "w", function () mymainmenu:show() end),
31
32 -- Layout manipulation
33 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
34 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
35 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
36 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
37 awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_relative( 1) end),
38 awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end),
39 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
40 awful.key({ modkey, }, "Tab",
41 function ()
42 awful.client.focus.history.previous()
43 if client.focus then
44 client.focus:raise()
45 end
46 end),
47
48 -- Standard program
49 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
50 awful.key({ modkey, "Control" }, "r", awesome.restart),
51 awful.key({ modkey, "Shift" }, "q", awesome.quit),
52
53 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
54 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
55 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
56 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
57 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
58 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
59 awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
60 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
61
62 awful.key({ modkey, "Control" }, "n", awful.client.restore),
63
64 -- Prompt
65 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
66
67 awful.key({ modkey }, "x",
68 function ()
69 awful.prompt.run({ prompt = "Run Lua code: " },
70 mypromptbox[mouse.screen].widget,
71 awful.util.eval, nil,
72 awful.util.getdir("cache") .. "/history_eval")
73 end),
74 -- Menubar
75 awful.key({ modkey }, "p", function() menubar.show() end)
76
77 -- Pulseaudio widget
78 --awful.key({ }, "XF86AudioRaiseVolume", APW.Up),
79 --awful.key({ }, "XF86AudioLowerVolume", APW.Down),
80 --awful.key({ }, "XF86AudioMute", APW.ToggleMute)
81 )
82
83 clientkeys = awful.util.table.join(
84 awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
85 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
86 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
87 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
88 awful.key({ modkey, }, "o", awful.client.movetoscreen ),
89 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
90 awful.key({ modkey, }, "n",
91 function (c)
92 -- The client currently has the input focus, so it cannot be
93 -- minimized, since minimized clients can't have the focus.
94 c.minimized = true
95 end),
96 awful.key({ modkey, }, "m",
97 function (c)
98 c.maximized_horizontal = not c.maximized_horizontal
99 c.maximized_vertical = not c.maximized_vertical
100 end)
101 )
102
103 -- Bind all key numbers to tags.
104 -- Be careful: we use keycodes to make it works on any keyboard layout.
105 -- This should map on the top row of your keyboard, usually 1 to 9.
106 for i = 1, 9 do
107 globalkeys = awful.util.table.join(globalkeys,
108 awful.key({ modkey }, "#" .. i + 9,
109 function ()
110 local screen = mouse.screen
111 local tag = awful.tag.gettags(screen)[i]
112 if tag then
113 awful.tag.viewonly(tag)
114 end
115 end),
116 awful.key({ modkey, "Control" }, "#" .. i + 9,
117 function ()
118 local screen = mouse.screen
119 local tag = awful.tag.gettags(screen)[i]
120 if tag then
121 awful.tag.viewtoggle(tag)
122 end
123 end),
124 awful.key({ modkey, "Shift" }, "#" .. i + 9,
125 function ()
126 local tag = awful.tag.gettags(client.focus.screen)[i]
127 if client.focus and tag then
128 awful.client.movetotag(tag)
129 end
130 end),
131 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
132 function ()
133 local tag = awful.tag.gettags(client.focus.screen)[i]
134 if client.focus and tag then
135 awful.client.toggletag(tag)
136 end
137 end))
138 end
139
140 -- Set keys
141 root.keys(globalkeys)
142 -- }}}