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