]> git.rmz.io Git - dotfiles.git/blob - awesome/bindings.lua
awesome: add mod+r key to launch ranger
[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 awful.button({ }, 4, awful.tag.viewnext),
9 awful.button({ }, 5, awful.tag.viewprev)
10 ))
11
12 clientbuttons = awful.util.table.join(
13 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
14 awful.button({ modkey }, 1, awful.mouse.client.move),
15 awful.button({ modkey }, 3, awful.mouse.client.resize))
16
17 -- Global Keys {{{1
18 globalkeys = awful.util.table.join(globalkeys,
19 -- Awesome Keys {{{2
20 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
21 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
22
23 awful.key({ modkey, }, "j",
24 function ()
25 awful.client.focus.byidx( 1)
26 if client.focus then client.focus:raise() end
27 end),
28 awful.key({ modkey, }, "k",
29 function ()
30 awful.client.focus.byidx(-1)
31 if client.focus then client.focus:raise() end
32 end),
33
34 -- Layout manipulation
35 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
36 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
37 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
38 awful.key({ modkey, }, "Tab",
39 function ()
40 awful.client.focus.history.previous()
41 if client.focus then
42 client.focus:raise()
43 end
44 end),
45
46 -- Standard program
47 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
48 awful.key({ modkey, "Control" }, "r", awesome.restart),
49
50 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
51 awful.key({ modkey, }, "l", 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 -- My Keys {{{2
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, "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 -- Client keys {{{1
98 clientkeys = awful.util.table.join(
99 -- Awesome Client Keys {{{2
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 -- My Client Keys {{{2
117 -- Move client to screen
118 awful.key({ modkey, "Shift" }, "#94", awful.client.movetoscreen ),
119 awful.key({ modkey, "Shift" }, "#49", awful.client.movetoscreen ),
120 -- ontop and below
121 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
122 awful.key({ modkey, }, "b", function (c) c.below = not c.below end)
123 -- }}}
124 )
125
126 -- Tags {{{1
127 -- Bind all key numbers to tags.
128 -- Be careful: we use keycodes to make it works on any keyboard layout.
129 -- This should map on the top row of your keyboard, usually 1 to 9.
130 for i = 1, 9 do
131 globalkeys = awful.util.table.join(globalkeys,
132 awful.key({ modkey }, "#" .. i + 9,
133 function ()
134 local screen = mouse.screen
135 local tag = awful.tag.gettags(screen)[i]
136 if tag then
137 awful.tag.viewonly(tag)
138 end
139 end),
140 awful.key({ modkey, "Control" }, "#" .. i + 9,
141 function ()
142 local screen = mouse.screen
143 local tag = awful.tag.gettags(screen)[i]
144 if tag then
145 awful.tag.viewtoggle(tag)
146 end
147 end),
148 awful.key({ modkey, "Shift" }, "#" .. i + 9,
149 function ()
150 local tag = awful.tag.gettags(client.focus.screen)[i]
151 if client.focus and tag then
152 awful.client.movetotag(tag)
153 end
154 end),
155 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
156 function ()
157 local tag = awful.tag.gettags(client.focus.screen)[i]
158 if client.focus and tag then
159 awful.client.toggletag(tag)
160 end
161 end))
162 end