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