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