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