]> git.rmz.io Git - dotfiles.git/blob - awesome/bindings.lua
vim: don't ag hidden files
[dotfiles.git] / awesome / bindings.lua
1 -- Default modkey.
2 modkey = "Mod4"
3 altkey = "Mod1"
4
5 -- Mouse bindings {{{1
6 root.buttons(awful.util.table.join(
7 awful.button({ }, 3, function () mymainmenu:toggle() end)
8 ))
9
10 clientbuttons = awful.util.table.join(
11 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
12 awful.button({ modkey }, 1, awful.mouse.client.move),
13 awful.button({ modkey }, 3, awful.mouse.client.resize))
14
15 -- Global Keys {{{1
16 globalkeys = awful.util.table.join(globalkeys,
17 -- Awesome Keys {{{2
18 awful.key({ modkey, }, "j",
19 function ()
20 awful.client.focus.byidx(-1)
21 if client.focus then client.focus:raise() end
22 end),
23 awful.key({ modkey, }, "k",
24 function ()
25 awful.client.focus.byidx( 1)
26 if client.focus then client.focus:raise() end
27 end),
28
29 -- Layout manipulation
30 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
31 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
32 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
33 awful.key({ modkey, }, "Tab",
34 function ()
35 awful.client.focus.history.previous()
36 if client.focus then
37 client.focus:raise()
38 end
39 end),
40
41 -- Standard program
42 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
43 awful.key({ modkey, "Control" }, "r", awesome.restart),
44
45 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
46 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
47 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
48 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
49 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
50 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
51
52 awful.key({ modkey, "Control" }, "n", awful.client.restore),
53
54 awful.key({ modkey }, "x",
55 function ()
56 awful.prompt.run({ prompt = "Run Lua code: " },
57 mypromptbox[mouse.screen].widget,
58 awful.util.eval, nil,
59 awful.util.getdir("cache") .. "/history_eval")
60 end),
61 -- Menubar
62 -- awful.key({ modkey }, "p", function() menubar.show() end),
63
64 -- My Keys {{{2
65 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
66 awful.key({ modkey, }, "Down", awful.tag.viewprev ),
67 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
68 awful.key({ modkey, }, "Up", awful.tag.viewnext ),
69
70 -- Menu
71 awful.key({ modkey }, "w", function () mymainmenu:show({ coords = { x = 0, y = 0}}) end),
72 -- Prompt
73 awful.key({ modkey }, "space", function () mypromptbox[mouse.screen]:run() end),
74 -- switch layout
75 awful.key({ modkey }, "]", function () awful.layout.inc( 1, mouse.screen, layouts) end),
76 awful.key({ modkey }, "[", function () awful.layout.inc(-1, mouse.screen, layouts) end),
77 -- resize slave
78 awful.key({ modkey, "Control" }, "j", function () awful.client.incwfact( 0.05) end),
79 awful.key({ modkey, "Control" }, "k", function () awful.client.incwfact(-0.05) end),
80 -- Ksnapshot
81 awful.key({ }, "F13", function () awful.util.spawn("ksnapshot") end),
82 awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end),
83 -- ranger
84 awful.key({ modkey }, "r", function () awful.util.spawn(terminal .. " -e ranger") end),
85 -- Layout manipulation
86 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
87 awful.key({ modkey, }, "#49", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (chronos)
88 awful.key({ modkey, }, "#94", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (shada)
89 awful.key({ modkey, }, "=", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (kinesis)
90 awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_relative( 1) end),
91 awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end),
92 -- Volume
93 awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("ponymix increase 5") end),
94 awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("ponymix decrease 5") end),
95 awful.key({ }, "XF86AudioMute", function () awful.util.spawn("ponymix toggle") end),
96 awful.key({ modkey }, "F10", function () awful.util.spawn("ponymix toggle") end),
97 awful.key({ modkey }, "F11", function () awful.util.spawn("ponymix decrease 5") end),
98 awful.key({ modkey }, "F12", function () awful.util.spawn("ponymix increase 5") end),
99 -- Lock
100 awful.key({ modkey, "Control" }, "Escape", function () awful.util.spawn("xautolock -locknow") end)
101 )
102
103 -- Client keys {{{1
104 clientkeys = awful.util.table.join(
105 -- Awesome Client Keys {{{2
106 awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
107 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
108 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
109 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
110 awful.key({ modkey, }, "n",
111 function (c)
112 -- The client currently has the input focus, so it cannot be
113 -- minimized, since minimized clients can't have the focus.
114 c.minimized = true
115 end),
116 awful.key({ modkey, }, "m",
117 function (c)
118 c.maximized_horizontal = not c.maximized_horizontal
119 c.maximized_vertical = not c.maximized_vertical
120 end),
121
122 -- My Client Keys {{{2
123 -- Move client to screen
124 awful.key({ modkey, "Shift" }, "#94", awful.client.movetoscreen ),
125 awful.key({ modkey, "Shift" }, "#49", awful.client.movetoscreen ),
126 awful.key({ modkey, "Shift" }, "=", awful.client.movetoscreen ), -- kinesis
127 -- ontop and below
128 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
129 awful.key({ modkey, }, "b", function (c) c.below = not c.below end)
130 -- }}}
131 )
132
133 -- Tags {{{1
134 -- Bind all key numbers to tags.
135 -- Be careful: we use keycodes to make it works on any keyboard layout.
136 -- This should map on the top row of your keyboard, usually 1 to 9.
137 for i = 1, 9 do
138 globalkeys = awful.util.table.join(globalkeys,
139 awful.key({ modkey }, "#" .. i + 9,
140 function ()
141 local screen = mouse.screen
142 local tag = awful.tag.gettags(screen)[i]
143 if tag then
144 if tag == awful.tag.selected(screen) then
145 awful.tag.history.restore(screen)
146 else
147 awful.tag.viewonly(tag)
148 end
149 end
150 end),
151 awful.key({ modkey, "Control" }, "#" .. i + 9,
152 function ()
153 local screen = mouse.screen
154 local tag = awful.tag.gettags(screen)[i]
155 if tag then
156 awful.tag.viewtoggle(tag)
157 end
158 end),
159 awful.key({ modkey, "Shift" }, "#" .. i + 9,
160 function ()
161 local tag = awful.tag.gettags(client.focus.screen)[i]
162 if client.focus and tag then
163 awful.client.movetotag(tag)
164 end
165 end),
166 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
167 function ()
168 local tag = awful.tag.gettags(client.focus.screen)[i]
169 if client.focus and tag then
170 awful.client.toggletag(tag)
171 end
172 end))
173 end