-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeybindings.lua
More file actions
185 lines (148 loc) · 5.54 KB
/
keybindings.lua
File metadata and controls
185 lines (148 loc) · 5.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
-- AWESOME WINDOW MANAGER
-- KEY AND MOUSE BINDINGS
require('func')
require('clients')
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
---
--- Lock screen: Mod+Ctrl+Shift+l
---
awful.key({ modkey , "Control", "Shift"}, "l",
function(c)
awful.util.spawn(CMD_LOCK)
end),
---
--- Switch Between Tags (Virtual Desktops): Mod+Left, Mod+Right
---
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
---
--- Switch Between Windows: Mod+j, Mod+k
---
awful.key({ modkey, }, "j", switch_client_next),
awful.key({ modkey, }, "k", switch_client_prev),
---
--- Move Window Around Layout: Mod+Shift+j, Mod+Shift+k
---
awful.key({ modkey, "Shift" }, "j", swap_client_next),
awful.key({ modkey, "Control" }, "j", swap_client_next),
awful.key({ modkey, "Shift" }, "k", swap_client_prev),
awful.key({ modkey, "Control" }, "k", swap_client_prev),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab", function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Launch Programs
awful.key({ modkey, }, 'Return', function ()
open_terminal_same_cwd(c) end),
awful.key({ modkey, 'Control' }, 'Return', function ()
awful.util.spawn(BROWSER) end),
awful.key({ modkey, 'Control' }, "\\", function ()
awful.util.spawn(BROWSER2) end),
awful.key({ modkey, }, 'F1', function ()
awful.util.spawn('gnome-calculator') end),
awful.key({ modkey, }, 'F2', function ()
awful.util.spawn('gcolor2') end),
awful.key({ }, 'Print', function()
awful.util.spawn('gnome-screenshot') end),
--awful.key({ }, "Print",
-- function () awful.util.spawn_with_shell("DATE=`date +%d%m%Y_%H%M%S`; xsnap -nogui -file $HOME/Temp/xsnap$DATE") end),
-- Standard Program
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, "Control", "Shift" }, "BackSpace",
awesome.quit),
---
--- Change Pane Size: Mod+h, Mod+l
---
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.03) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.03) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incnmaster(1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incncol(1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incncol(-1) end),
-- Directly choose layout
-- TODO: Clean up this code with a table + loop
awful.key({ modkey, }, "1", function ()
awful.layout.set(layouts[1], nil)
end),
awful.key({ modkey, }, "2", function ()
awful.layout.set(layouts[2], nil)
end),
awful.key({ modkey, }, "3", function ()
awful.layout.set(layouts[3], nil)
end),
awful.key({ modkey, }, "4", function ()
awful.layout.set(layouts[4], nil)
end),
awful.key({ modkey, }, "5", function ()
awful.layout.set(layouts[5], nil)
end),
-- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
-- Volume
awful.key({ }, "XF86AudioRaiseVolume", function()
awful.util.spawn_with_shell("pactl set-sink-mute 1 0 && pactl set-sink-volume 1 -- +5%", false)
end),
awful.key({ }, "XF86AudioLowerVolume", function()
awful.util.spawn_with_shell("pactl set-sink-volume 1 -- -5%", false)
end),
awful.key({ }, "XF86AudioMute", function()
awful.util.spawn_with_shell("pactl set-sink-mute 1 `((pactl list sinks | grep -q Mute:.no > /dev/null) && echo 1) || echo 0`", false)
end)
)
clientkeys = awful.util.table.join(
-- Spawn terminal at location
-- NOTE: Not necessary anymore w/ global binding
--awful.key({ modkey, }, "o", function(c)
-- open_terminal_same_cwd(c) end),
--awful.key({ modkey, }, "Return", function ()
-- awful.util.spawn(terminal) end),
-- Toggle fullscreen
awful.key({ modkey, }, "f", function (c)
c.fullscreen = not c.fullscreen end),
-- Kill clients
awful.key({ modkey, "Shift" }, "c", kill_client),
awful.key({ modkey, "Control"}, "c", kill_client),
awful.key({ modkey, "Control"}, "x", kill_clients_on_cur_tag),
-- Move clients to left/right tags
awful.key({ modkey, "Control" }, "Left", move_client_prev_tag),
awful.key({ modkey, "Control" }, "Right", move_client_next_tag),
-- Show/hide
awful.key({ modkey, }, "m", hide_client),
awful.key({ modkey, "Control"}, "m", unminimize_clients_on_cur_tag),
-- Misc
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c)
c.ontop = not c.ontop end)
)
-- Compute the maximum number of digit we need
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(AWESOME_NUM_TAGS, math.max(#tags[s], keynumber));
end
---
--- Allow mouse to raise (select) window
clientbuttons = awful.util.table.join(
--awful.button({ }, 1, function() end), -- Left Click
awful.button({ }, 2, function() end), -- Middle Click
awful.button({ }, 3, function() end), -- Right Click
awful.button({ }, 1, function (c)
client.focus = c; c:raise()
end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)
)
-- Set keys
root.keys(globalkeys)
-- }}}