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