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