]> git.rmz.io Git - dotfiles.git/blob - awesome/bindings.lua
Backup UH
[dotfiles.git] / awesome / bindings.lua
1 local hotkeys_popup = require("awful.hotkeys_popup").widget
2
3 -- Default modkey.
4 modkey = "Mod4"
5 altkey = "Mod1"
6
7 -- Mouse bindings {{{1
8 root.buttons(awful.util.table.join(
9 awful.button({ }, 3, function () mymainmenu:toggle() end)
10 ))
11
12 -- Global Keys {{{1
13 globalkeys = awful.util.table.join(globalkeys,
14 awful.key({ modkey, }, "s", hotkeys_popup.show_help,
15 {description="show help", group="awesome"}),
16 awful.key({ modkey, }, "Left", awful.tag.viewprev,
17 {description = "view previous", group = "tag"}),
18 awful.key({ modkey, }, "Down", awful.tag.viewprev,
19 {description = "view previous", group = "tag"}),
20 awful.key({ modkey, }, "Right", awful.tag.viewnext,
21 {description = "view next", group = "tag"}),
22 awful.key({ modkey, }, "Up", awful.tag.viewnext,
23 {description = "view next", group = "tag"}),
24 awful.key({ modkey, }, "Escape", awful.tag.history.restore,
25 {description = "go back", group = "tag"}),
26
27 awful.key({ modkey, }, "k",
28 function ()
29 awful.client.focus.byidx( 1)
30 end,
31 {description = "focus next by index", group = "client"}
32 ),
33 awful.key({ modkey, }, "j",
34 function ()
35 awful.client.focus.byidx(-1)
36 end,
37 {description = "focus previous by index", group = "client"}
38 ),
39 awful.key({ modkey, }, "w", function () mymainmenu:show({ coords = { x = 0, y = 0}}) end,
40 {description = "show main menu", group = "awesome"}),
41
42 -- Layout manipulation
43 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
44 {description = "swap with next client by index", group = "client"}),
45 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
46 {description = "swap with previous client by index", group = "client"}),
47 awful.key({ modkey, }, "#49", function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (chronos)
48 {description = "focus the next screen", group = "screen"}),
49 awful.key({ modkey, }, "=", function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (kinesis)
50 {description = "focus the next screen", group = "screen"}),
51 awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end,
52 {description = "focus the next screen", group = "screen"}),
53 awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_relative(-1) end,
54 {description = "focus the previous screen", group = "screen"}),
55 awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
56 {description = "jump to urgent client", group = "client"}),
57 awful.key({ modkey, }, "Tab",
58 function ()
59 awful.client.focus.history.previous()
60 if client.focus then
61 client.focus:raise()
62 end
63 end,
64 {description = "go back", group = "client"}),
65
66 -- Standard program
67 awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
68 {description = "open a terminal", group = "launcher"}),
69 awful.key({ modkey, "Control" }, "r", awesome.restart,
70 {description = "reload awesome", group = "awesome"}),
71
72 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
73 {description = "increase master width factor", group = "layout"}),
74 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
75 {description = "decrease master width factor", group = "layout"}),
76 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
77 {description = "increase the number of master clients", group = "layout"}),
78 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
79 {description = "decrease the number of master clients", group = "layout"}),
80 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
81 {description = "increase the number of columns", group = "layout"}),
82 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
83 {description = "decrease the number of columns", group = "layout"}),
84 -- resize slave
85 awful.key({ modkey, "Control" }, "j", function () awful.client.incwfact( 0.05) end,
86 {description = "increase focused client window factor", group = "layout"}),
87 awful.key({ modkey, "Control" }, "k", function () awful.client.incwfact(-0.05) end,
88 {description = "decrease focused client window factor", group = "layout"}),
89
90 -- switch between layouts
91 awful.key({ modkey, }, "]", function () awful.layout.inc( 1) end,
92 {description = "select next", group = "layout"}),
93 awful.key({ modkey, }, "[", function () awful.layout.inc(-1) end,
94 {description = "select previous", group = "layout"}),
95
96 awful.key({ modkey, "Control" }, "n",
97 function ()
98 local c = awful.client.restore()
99 -- Focus restored client
100 if c then
101 client.focus = c
102 c:raise()
103 end
104 end,
105 {description = "restore minimized", group = "client"}),
106
107 -- Prompt
108 awful.key({ modkey }, "space", function () awful.screen.focused().mypromptbox:run() end,
109 {description = "run prompt", group = "launcher"}),
110
111 awful.key({ modkey }, "x",
112 function ()
113 awful.prompt.run {
114 prompt = "Run Lua code: ",
115 textbox = awful.screen.focused().mypromptbox.widget,
116 exe_callback = awful.util.eval,
117 history_path = awful.util.get_cache_dir() .. "/history_eval"
118 }
119 end,
120 {description = "lua execute prompt", group = "awesome"}),
121
122 -- Applications {{{2
123 -- Ksnapshot
124 awful.key({ }, "F13", function () awful.spawn("ksnapshot") end),
125 awful.key({ }, "Print", function () awful.spawn("ksnapshot") end),
126 -- ranger
127 awful.key({ modkey }, "r", function () awful.spawn(terminal .. " -e ranger") end),
128 -- Volume
129 awful.key({ }, "XF86AudioMute", function () awful.spawn("ponymix toggle") end,
130 {description = "toggle mute", group = "volume"}),
131 awful.key({ }, "XF86AudioLowerVolume", function () awful.spawn("ponymix decrease 5") end,
132 {description = "decrease volume", group = "volume"}),
133 awful.key({ }, "XF86AudioRaiseVolume", function () awful.spawn("ponymix increase 5") end,
134 {description = "increase volume", group = "volume"}),
135 awful.key({ modkey }, "F10", function () awful.spawn("ponymix toggle") end,
136 {description = "toggle mute", group = "volume"}),
137 awful.key({ modkey }, "F11", function () awful.spawn("ponymix decrease 5") end,
138 {description = "decrease volume", group = "volume"}),
139 awful.key({ modkey }, "F12", function () awful.spawn("ponymix increase 5") end,
140 {description = "increase volume", group = "volume"}),
141 -- Lock
142 awful.key({ modkey, "Control" }, "Escape", function () awful.spawn("i3lock -nc 000000") end),
143 -- VimWiki
144 awful.key({ modkey }, "i", function ()
145 awful.spawn(terminal.." -name vimwiki -e vim -c 'call vimwiki#base#goto_index(v:count1)'")
146 end)
147 )
148
149 -- Client keys {{{1
150 clientkeys = awful.util.table.join(
151 awful.key({ modkey, }, "f",
152 function (c)
153 c.fullscreen = not c.fullscreen
154 c:raise()
155 end,
156 {description = "toggle fullscreen", group = "client"}),
157 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
158 {description = "close", group = "client"}),
159 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
160 {description = "toggle floating", group = "client"}),
161 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
162 {description = "move to master", group = "client"}),
163 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
164 {description = "toggle keep on top", group = "client"}),
165 awful.key({ modkey, }, "b", function (c) c.below = not c.below end,
166 {description = "toggle keep below", group = "client"}),
167 awful.key({ modkey, }, "n",
168 function (c)
169 -- The client currently has the input focus, so it cannot be
170 -- minimized, since minimized clients can't have the focus.
171 c.minimized = true
172 end ,
173 {description = "minimize", group = "client"}),
174 awful.key({ modkey, }, "m",
175 function (c)
176 c.maximized = not c.maximized
177 c:raise()
178 end ,
179 {description = "maximize", group = "client"}),
180
181 -- Move client to screen
182 awful.key({ modkey, "Shift" }, "#94", function (c) c:move_to_screen() end,
183 {description = "move to screen", group = "client"}),
184 awful.key({ modkey, "Shift" }, "#49", function (c) c:move_to_screen() end,
185 {description = "move to screen", group = "client"}),
186 awful.key({ modkey, "Shift" }, "=", function (c) c:move_to_screen() end,
187 {description = "move to screen", group = "client"})
188 )
189
190 -- Tags {{{1
191 -- Bind all key numbers to tags.
192 -- Be careful: we use keycodes to make it works on any keyboard layout.
193 -- This should map on the top row of your keyboard, usually 1 to 9.
194 for i = 1, 9 do
195 globalkeys = awful.util.table.join(globalkeys,
196 -- View tag only.
197 awful.key({ modkey }, "#" .. i + 9,
198 function ()
199 local screen = awful.screen.focused()
200 local tag = screen.tags[i]
201 if tag then
202 if tag.selected then
203 awful.tag.history.restore(screen)
204 else
205 tag:view_only()
206 end
207 end
208 end,
209 {description = "view tag #"..i, group = "tag"}),
210 -- Toggle tag display.
211 awful.key({ modkey, "Control" }, "#" .. i + 9,
212 function ()
213 local screen = awful.screen.focused()
214 local tag = screen.tags[i]
215 if tag then
216 awful.tag.viewtoggle(tag)
217 end
218 end,
219 {description = "toggle tag #" .. i, group = "tag"}),
220 -- Move client to tag.
221 awful.key({ modkey, "Shift" }, "#" .. i + 9,
222 function ()
223 if client.focus then
224 local tag = client.focus.screen.tags[i]
225 if tag then
226 client.focus:move_to_tag(tag)
227 end
228 end
229 end,
230 {description = "move focused client to tag #"..i, group = "tag"}),
231 -- Toggle tag on focused client.
232 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
233 function ()
234 if client.focus then
235 local tag = client.focus.screen.tags[i]
236 if tag then
237 client.focus:toggle_tag(tag)
238 end
239 end
240 end,
241 {description = "toggle focused client on tag #" .. i, group = "tag"})
242 )
243 end
244
245 -- Client Buttons {{{1
246 clientbuttons = awful.util.table.join(
247 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
248 awful.button({ modkey }, 1, awful.mouse.client.move),
249 awful.button({ modkey }, 3, awful.mouse.client.resize))