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